Friday, March 27, 2015

A Fast Way to Generate LaTeX Document using VIM

Finally, I found a fast way to generate a LaTeX document using VIM, which allows me have a basic LaTeX document within few seconds. However, a little background knowledge on MarkDown syntax is required (MarkDown Cheatsheet is here).

Step 0: setup

a. install pandoc

b. add one line of setting into .vimrc (only have to do once)

map \md <ESC>:!pandoc -V geometry:margin=1in % -s -o %<.pdf<CR>:!open %<.pdf<CR>
This is for Mac, if you are using other system, please change "open" to any PDF reader you have on your machine.

Step 1: open a new .md file

vim test.md

Step 2: write some MarkDown and save

## This is title

### Header is here

- list 1

- list 2

Step 3: press following keys in vim: <ESC> \ m d


PDF file will popup automatically

Notice

  • More settings can be passed into pandoc by adding parameters.
  • This is fast way to have basic LaTeX documents, but may not be the most customised way.

No comments:

Post a Comment