Simple and effective LaTeX editing on Linux/Cygwin/etc

First, install and use Vim.

Second, add this to ~/.vimrc:

syntax enable
command L !pdflatex %

(I would also add set mouse=, but maybe that is just me.) Third, create the PDF if it does not already exist.

$ pdflatex myfile.tex

Fourth, open the PDF in gv with the -watch option, and adjust the window to occupy half your screen. You can use the ‘-spartan’ gv option if you want less framing and more content.

$ gv -spartan -watch myfile.pdf &

Fifth, open the tex file in Vim and adjust Vim (that is, your terminal emulator) to occupy half your screen.

$ vim myfile.tex

Sixth, edit the file in Vim, using the :L command to compile it as and when you want to.

That’s it. gv will watch the PDF file and reload it when it changes — unasked. No need to leave the Vim window, no need to click. You will need to tab out the gv and Page Up or Page Down as needed, but that’s it.

I find this has the following advantages:

  • very quick to configure, so I don’t have to ‘miss’ my personalisations when I use another machine
  • very few dependencies (though I’ll admit, given the enormous bloat of a full TeX distribution, that may not mean much)
  • low resource requirements
  • low mouse use (better for your joints)
  • gives a very simple, clutter-free screen that is good for concentration and focus.

With a little effort, it is easy enough to add any other commands you might need to .vimrc (eg biblatex), or to have several files open at once (.tex, .bib …) but the whole point of this is to be simple and nondistracting.

screenshot
Vim on the left. gv on the right. That’s it.

On Debian, the update frequency is controlled by resources in the file /etc/X11/app-defaults/GV. If the updating of the PDF file view is too fast/slow, you can try changing:

!GV.watchFileFrequency: 1000

(Remove ! and change 1000, which is in ms)

Probably should copy this line into a local .gv file. For example:

$ cat ~/.gv
GV.watchFileFrequency: 5000
GV.version:		gv 3.6.7.90

If gv does not like your .gv file, run:

gv-update-userconfig

after adding the new resources.

Author: Darren

I'm a scientist by training, currently working as a writer, trainer and editor.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.