Latex writing workflow
Tools
- Latex distribution: TexLive
- Compiling: latexmk
Vim plugins
- Ale: Linting & Fixing
- Coc: LSP
- Deoplete: Autocomplete
- Utlisnips: Snippets
- Vimtex: Latex tools
- ctags(Gutentags): tags
- Vim Surround: Make easier to add brackets:
Vim workflow
- Completion: Deoplete/Coc + Vimtex
- Snippets:
Quickly insert environments -> Vim snippets(f.ex fig + tab)
- Auto close environment:
press ]] in insert mode to auto-close an environment
- Mappings:
:h vimtex-default-mappings
cse: change an environment
dse: delete an environment
tse:toggle stared env and no-star env, e.g., change from equation* to equation and vice versa.
]]: close an environment (only work in insert mode, in normal mode, it will bring cursor to next subsection instead). After you have typed begin{ENV}, use ]] to auto-close it with \end{ENV}
- Jump between references + definitions:
See ctags documentation
:VimtexInfo: show all relevant info about current LaTeX project.
:VimtexTocOpen: show table of contents window
:VimtexTocToggle: toggle table of contents window
:VimtexCompile: Compile the current LaTeX source file and opens the viewer after successful compilation.
:VimtexStop: Stop compilation for the current project.
:VimtexClean: clean auxiliary files generated in compliation process.
- Live PDF preview with Okular/Zathura & Vimtex
:VimtexCompile
- Linting + Syntax check with Ale
- lacheck
- chktex
- Proselint
- Tex directives
Compile latex with xelatex
%!TeX program = xelatex
- Table of contents
Show table of contents:
VimtexTocOpen
- Document compliation with vimtex & latexmk:
:VimtexCompile
- Motions
Move between section boundaries with [[, [], ][, and ]]
Move between environment boundaries with [m, [M, ]m, and ]M
Move between comment boundaries with [* and ]*
Move between matching delimiters with %
Snippets
- Automate every repetitive keystroke using vim
snippets
(In vim use UltiSnips) - Create course specific snippets and load them on your
.vimrc
though a simlink:set rtp+=~/current_course
Latex math snippets
mk
: Inline mathmd
: Displayed math- Use subscript:
A1
->A_1
- Fractions:
// → \frac{}{}
3/ → \frac{3}{}
4\pi^2/ → \frac{4\pi^2}{}
(1 + 2 + 3)/ → \frac{1 + 2 + 3}{}
(1+(2+3)/) → (1 + \frac{2+3}{})
(1 + (2+3))/ → \frac{1 + (2+3)}{}
- Postfix snippets: F.ex
v,. → \vec{v}
Math specific
- Use
Sympy
andMathematica
to evaluate mathematical expressions
Compiling and see(Hot reload) document
Use
latexmk
to compile latex document.
In vim use vimtex
command: :VimtexCompile
to automatically compile the latex document on save and hot reload document on the preferred PDF viewer(F.ex Zathura)
Searching in notes
Rg + RegEx
Drawing figures
Use Inkscape to draw figures and import them with latex into document
Grammar and Vocabulary
Use a key binding to automatically correct spelling mistakes without interrupting the flow
- Press
Ctrl + L
to correct the previous spelling mistake
See vim specific documentation file for further spelling and grammar related tools.
Citations
Use Zothero as citation manager.
- Zothero Browser extension for fast documentation.
- Export Zothero resources to desired format(F.ex BibTex) and use them in the Latex document.
Resources
See special resources file: Resources file
Latex
- https://castel.dev/post/lecture-notes-1/
- https://www.quora.com/Can-people-actually-keep-up-with-note-taking-in-Mathematics-lectures-with-LaTeX/answer/Gilles-Castel-1
- https://www.quora.com/Can-people-actually-keep-up-with-note-taking-in-Mathematics-lectures-with-LaTeX
- https://gist.github.com/gillescastel/8da990dbc83c1c86f8ca048bc83624f0
- https://www.youtube.com/watch?v=10wGMzYgnqM
- https://github.com/lervag/vimtex
Snippets
- https://github.com/SirVer/ultisnips
- Good Ultisnips tutorial: https://yufanlu.net/2016/10/30/ultisnips/
- https://codefor.life/ultisnips/
- https://gist.githubusercontent.com/gillescastel/8da990dbc83c1c86f8ca048bc83624f0/raw/442ae72c3c92295bf9afc6d038ed76d79e655b7a/Ultisnip%2520snippets
Vim as latex editor
- https://jdhao.github.io/2019/03/26/nvim_latex_write_preview/#fn:
- https://tex.stackexchange.com/questions/474765/are-there-any-alternatives-to-vim-latex
- https://github.com/w0rp/ale
- https://github.com/neoclide/coc.nvim
- https://github.com/Shougo/deoplete.nvim
- https://github.com/lervag/vimtex
- https://www.reddit.com/r/vim/comments/4fm7vo/vim_not_very_well_suited_for_latex/
- https://castel.dev/post/lecture-notes-1/
- https://octetz.com/posts/vim-as-go-ide