Vim + LaTeX and YOU!

Author’s note: I think I can make this one short.

Let’s start with a preview sure to make a reader envious with desire to to actually read forward.

Notice how we’re still in insert mode and that this file hasn’t been saved yet. For some, this is all they want, the ability to have a live preview rendering of their drawing. To receive that WYSIWYG culture intersected with the WYSIWYM dogma which is life. That’s what  the kids want these days. I didn’t write this, it’s simply yet another plug-in for vim. What I will go over, is how this tool in combination with a few little hacks helps to streamline report making.

Okay, the secret sauce is in the makefile.

For yourself, the “filename” variable should be changed to your filename without the extension. So if your filename is “myFinalReport002.tex” the first line should read “TARGET=myFinalReport002”. PDFVIEWER should be set to whichever pdfviewer you prefer on your machine. Evince is the one used here.

mkdir a  folder for your latex report. In this folder, you’ll want both this makefile and the myFinalReport002.tex that you’re working on. The sample *.tex file in the screen shot above is simply this

With these two files in your working directory you can simply call make, make clean, make veryclean, make submit, make view, and finally makelpr (for when you want to print and are on the go). A person can pretty much put whatever commands they want to inside the makefile, but here’s something neat about using vim with the makefile.

Just as you normally would :w or :wq,  vim has an inbuilt function where it runs commands inside of a makefile that’s in the same directory. There’s no need to open up a 2nd terminal screen or to exit vim to check you work (or submit the report). If typing in :make view is too much for you, you can always remap the commands in your .vimrc like so

If typing :mv becomes too much for you, and constantly checking and rechecking your work puts a strain on your body, mind, and soul; then there’s a way to make this viewing thing a bit more automated. Aforementioned, there’s a plugin.

cd into your ~/.vim/bundle and simply

To begin, all you need to do is invoke :LLPSTartPreview in your vim terminal, but adjust that .vimrc for a more pleasant experience. The instructions for this plugin does not explicitly mention pathogen(), but /bundle is the defacto /plugin folder. These quick instructions should get most people started, but for this plugin to work you’ll need to make sure that your vim has been compiled with a specific configuration, e.g. python. Most vim installs on a new system are meant to be light weight, and quick to load. If you’re having issues while compiling your own heavy duty vim installation you might find this post helpful.