jrbn
jrbn

Reputation: 303

macvim + Latex + results compilation?

Yes, I'm contemplating to switch from emacs to vim (a big decision in a programmer's life!), but I have problems setting up vim for latex editing.

My problem is the following:

I use macvim in combination with the excellent vim-latex suite. I learned that I can compile the .tex files using the command \ll, but the problem is that the results of this process are shown on a temporary window, which is immediately removed after the process is finished (the window is kept opened only if there are some errors).

Now, I would like to know how I can tell vim to keep this window visible, at least for one or two seconds, so that I can check if the details of the compilation process (e.g. the number of pages produced). I found out that the command :copen re-opens the window, but it shows only a few lines, and not all the results of the compilation.

Does any of you know how to do it?

Upvotes: 1

Views: 643

Answers (2)

Bertrand Caron
Bertrand Caron

Reputation: 2667

I use a rather dodgy combination of mapping and script calling to compile my TEX documents that could potentially help you out :

"Add this to the content  of ~/.vimrc
:map ® :! ./render.sh <CR> <CR>     //® is just Alt+r on a mac
:map  :! ./render.sh <CR>      //Same thing but with Alt+z

and place a render.sh, chmoded+x compiling script in your working directory :

#Content of render.sh
/usr/texbin/pdflatex YourFile.tex <<EOF
s   //Whatever compiling options you may want to use
EOF
open /Applications/Preview.app YourFile.pdf //Open the PDF File, or don't ;)

You can now compile using Alt+r or Alt+z, the second one displaying the compiling stdout and going back to vim straight away, the first one stopping, being scrollable and waiting for a carriage return. You could even imagine grepping out errors or warning in the render script, it's up to you.

EDIT : This works fine in VIM but it seems you may need absolute paths for your render.sh script when working with MacVim (a simple :! ls shows the working directory would be ~).

EDIT2 : Yes, it does. Put render.sh in your home and we'll find a way to localize it later if you like the idea ;)

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172758

Find the place in the plugin where the external Latex tool is invoked, and append ; sleep 2 to it to keep the window for a little while longer.

As the quickfix list in Vim (:copen) is filled, you could also edit the 'errorformat' option; it determines which lines from the output are parsed and added to the list.

But none of that is trivial for a beginner in Vim. Why don't you try to submit an enhancement request to the plugin's author?

Upvotes: 2

Related Questions