DEV Community

Aaditya Sinha
Aaditya Sinha

Posted on

Latex with Vim

Latex

A LaTeX document is a text file that contains the markup code for a document that will be typeset by LaTeX. The markup code specifies the structure and formatting of the document, such as the headings, paragraphs, lists, figures, and tables. LaTeX documents typically have the file extension .tex.
LaTeX documents can be used to create a wide variety of documents, including technical papers, books, presentations, and even letters. They are especially well-suited for documents that contain complex mathematical equations or other specialized formatting.

Vimtex

So as you have already know about vim and latex, there is a plugin which is called vimtex that can be used to compile the .tex file and shows you the output just like the screenshot above. But before diving into the features of this plugin you must add this plugin into you lvim or nvim config file.

Writing latex using vim

" vim-plug
Plug 'lervag/vimtex'

" packer.nvim
use 'lervag/vimtex'

Enter fullscreen mode Exit fullscreen mode

After installing vimtex you must add the latex_compiler to compile the .tex file using this line into you .vimrc or init.vim
let g:vimtex_compiler_method = 'latexrun'
There are so many commands for vimtex, the commands which I use everytime is \ll (to compile the latex file).
For pdf viewer I have used zathura which is minimalistic pdf viewer with vim key bind.

Conclusion

I hope this article helped you getting to know about latex file and vimtex plugin, how we can use it in vim :)
See you in the next article.
https://github.com/lervag/vimtex.git

Enter fullscreen mode Exit fullscreen mode

Top comments (0)