When I try to compile my latex document from within vim by issuing: :w|!lualatex % (leaving out the w command does not solve the problem) it compiles but it does not save any files. If I call lualatex directly from the command line lualatex FILE.tex it compiles and saves the files as expected.

The behaviour is especially strange since I never had this problem before. So basically I cannot point to what the problem may be. I'm on an archlinux box.

Does anyone have any suggestion how to solve this problem or at least has some ideas what tests might allow me to find possible causes?

  • 2
    is your vim instance in the same directory as the tex file? I'd assume you started it somewhere else and the results/artifacts of the latex compilation are placed inside this directory... – Ulrich Dangel Jul 12 '14 at 9:49
  • Thanks, but that is not the case. I have checked that. Furthermore, my .vimrc contains the lines cmap cwd lcd %:p:h and cmap cd. lcd %:p:h which automatically switch the working directory to that of the current file. – lord.garbage Jul 12 '14 at 9:58
  • The only reason I can think of is that lualatex received an update that causes the problem. Which would make it a latex related question and should probably go on Stackoverflow. But I thought I’d check with other vim enthusiasts. – lord.garbage Jul 12 '14 at 10:01
  • I revoke my previous command and assert the exact opposite: It is exactly as you said @Ulrich Dangel. Despite this never happening before and my .vimrc setup vim did indeed compile in the wrong directory. Could you post your comment as an answer? – lord.garbage Jul 12 '14 at 10:21

Based on your description, it is very likely that the current working directory for vim or for your lualatex process is not the directory you were looking at, as:

  • If you run lualatex directly it works as expected
  • You don't get any error when running lualatex from vim

That indicates that:

  1. lualatex works in general
  2. there must be a difference between when you run it from vim and directly from your terminal

Two typically differences are either environment variables or the current working directory if you launch a process from within another one. As there seem to no errors/issues related to environment variables (e.g. PATH) it is very likely that your current working directory in that vim instance is different to the directory you looked for your ouptut.

  • I reran lcd %:p:h one single time from vim and everything works as expected again. I can close vim and open it again and it will switch working directories as expected. Strange... Sorry about the fuss. – lord.garbage Jul 12 '14 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.