/latex-ide

Automatically runs latex when the source file changes. Spawns synctex aware pdf viewer and text editor.

Primary LanguageTeXMIT LicenseMIT

latex-ide

Have one command that spawns a pdf viewer and an editor and automatically compiles the tex file when it changes.

latexmk can do everything I want. Just use the latexmkrc in this repository.

  • latexmk supports out-of-source builds
  • latexmk -pvc supports watching for file changes and automatically runs pdflatex
  • by specifying two programs as $pdf_previewer, latexmk spawns the pdf viewer and the editor. I set it up so that they can talk to each other via synctex.
  • multiple instances for different tex files are supported by using vim's --servername feature.
  • mklatex knows how to find .bst and .bib files in subdirectories
  • mklatex -pvc monitors all dependencies, including .bib files, includes, and even style files, and initiates a build if any of them changes
  • use texfot for filtering the output of pdflatex

Usage

  • Have a tex distribution with latexmk installed. I use texlive on debian. It installs latexmk by default.
  • Have zathura and gvim installed
  • Copy the file latexmkrc to your home directory or to where your .tex file sits.
  • Try it with the tex file in this repository:
$ latexmk -pvc test.tex

Synctex

  • Ctrl-click on the pdf to jump to the source location in vim.
  • For jumping to the pdf location from the source code, have the following in your vimrc:
function! SyncTexForward()
  let execstr = "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . g:tex_pdf_output_file
  exec execstr
endfunction
nmap <Leader>f :call SyncTexForward()<CR><C-l>

Version Numbers

The pdflatex command generates a file version.tex in the _build directory that contains the current git hash. See test.tex for how to use it.

Deprecated

The old sources for latex-ide can be found on the branch deprecated.