This is somewhat unorthodox, but this thread was the first place I came to when I encountered this problem. Please only consider this solution when you have latexmk installed, but vimtex not discovering it.
I recently purged texlive from a computer I have that is running Ubuntu because of some missing templates, and then followed-up with a texlive quick install.
After having done this, I can run latexmk from the terminal without any issue, but when loading vim it would throw errors of the form:
This was particularly odd to me since typing latexmk in the terminal would work, and the same is true for bibtex. This seems to me to be a unique problem while also being very similar to some of the other closed issues I have read in this thread.
A solution
I think this is a minimal solution, since it does not require any changes to your .vimrc, nor any changes to vimtex, texlive, .latexmkrc.
These errors I have listed above occur when vimtex cannot find latexmk or bibtex, and simply I think a cheap solution is with a symbolic link. Here is the step by step procedure of what I did.
type command.type latexmk which returned latexmk is /usr/local/texlive/2019/bin/x86_64-linux/latexmk
Create the symbolic link in /usr/local/bin. To do this I used the ln -s command with the path from step (1).
-- sudo ln -s /usr/local/texlive/2019/bin/x86_64-linux/latexmk /usr/local/bin
Finally, repeat this process for bibtex.
-- type bibtex which returned bibtex is hashed (/usr/local/texlive/2019/bin/x86_64-linux/bibtex)
-- sudo ln -s /usr/local/texlive/2019/bin/x86_64-linux/bibtex /usr/local/bin
This seems to have solved my problem, however any additional insight is always welcome. My apologies for the unorthodox posting style of putting my solution with the problem.
Are you sure /usr/local/texlive/2019/bin/x86_64-linux/ was in your $PATH variable as defined in say .bashrc or .zshrc ? Perhaps it was still pointing to the folder for 2018.
First, I'm happy to hear that you already solved the issue. Also, I do not mind that you post your issue and a solution!
To address your issue more directly: A typical reason for the behaviour that you are seeing is that the PATH variable is set differently in your Vim instance and in your shell. I would also suspect that you are using gvim.
I would start by comparing my PATH variable:
PATH variable with e.g. echo $PATH | tr : "\n". It should include /usr/local/texlive/2019/bin/x86_64-linux.:echo substitute($PATH, ':', "\n", 'g') (or simply :echo $PATH).I met the same problem "latexmk is not executable. bibtex is not executable."
Must we set $PATH in .vimrc?
How do we set $PATH in vimrc?
(I admit that I have set $PATH for shell but never for vim)
Thank you,
Hongying
P.S. I installed texlive via MacPort. (Previously via MacTeX, and vimtex worked fine.)
➜ ~ which latexmk
/opt/local/bin/latexmk
➜ ~ which bibtex
/opt/local/bin/bibtex
I don't think you should set the PATH variable in your vimrc, but rather in your environment. I can't really help with that since I don't know much about Macs, but I would guess that you can find much help by searching.
As I mentioned, I would propose that you first confirm that your MacVim (or whatever you are using) really do operate with a different value of $PATH than your normal shell. I am surprised if this is not the cause of your issue.
Btw, I'm closing this since this is not a real vimtex issue.
Previously I had the same problem described in the issue title under Mac (with zsh as default shell), when MacVim is launched from the launcher rather than from the command line by issuing $ mvim.
Yes. The problem is about $PATH variable.
And the solution is in the official MacVim Troubleshooting (search "For zsh users").
Hey the comments here helped me resolve the same issue.
Here's useful link for with some extra context for other users in simlar positions.
https://tex.stackexchange.com/questions/29744/where-is-path-modified-to-include-usr-texbin
Cheers!
Most helpful comment
Hey the comments here helped me resolve the same issue.
Here's useful link for with some extra context for other users in simlar positions.
https://tex.stackexchange.com/questions/29744/where-is-path-modified-to-include-usr-texbin
Cheers!