0

I am trying to run GVim with Vim LaTex-Suite to be able to compile LaTeX documents. I have two ways of running GVim:

  1. Open Terminal, then type gvim and enter
  2. Use an application launcher e.g. xfce4-appfinder on Xubuntu or dmenu_run on i3

When I use method 1 and launch GVim through the Terminal, I can compile fine, however when I launch GVim via method 2 through a launcher, I cannot compile when running the command !pdflatex -interaction=nonstopmode main.tex from GVim. It says:

kpathsea: Running mktexfmt pdflatex.fmt

mktexfmt: No such file or directory

I can't find the format file `pdflatex.fmt'!

I'm not sure this is an issue with GVim or LaTeX-Suite since it's working but only depends on the way I start it.

Would you have any ideas on how to make it work for both methods 1 and 2 and why this is happening?

Thanks!

Zili
  • 3
  • "I cannot compile" You need to provide more details in your question: What command(s) are you using, and what is the output to them? – Murphy Sep 05 '17 at 14:53
  • Move your environment variable definitions from .bashrc to .profile. Yup. See https://unix.stackexchange.com/questions/3052/is-there-a-bashrc-equivalent-file-read-by-all-shells – Gilles 'SO- stop being evil' Sep 05 '17 at 22:30

1 Answers1

4

One common cause of this type of error is differences in the shell environment. Most likely your PATH variable and/or your current working directory is different and affecting your script.

You can check with one procedure.

To check the difference in the environment and working directories do this:

  1. Start gvim from the terminal and in that gvim, enter:

    :!env > /tmp/env.terminal
    
  2. Start gvim from the launcher and in that gvim enter:

    :!env > /tmp/env.launcher
    
  3. In a Terminal window, at the shell prompt, enter

    diff /tmp/env.terminal /tmp/env.launcher
    

This diff command will show the difference in the environments of both gvim instances.

Look at the differences in the environments. Be sure to check the values of both the PATH and PWD variables.

RobertL
  • 6,780
  • Thanks! Indeed, there are a few differences. How should I add to the PATH environment variable used by the launcher? – Zili Sep 05 '17 at 15:40
  • @Zili There are many ways to accomplish that. It can also depend on whether you installed vim-latexsuite from your distribution repositories or installed it yourself, etc. (If possible you should install vim-latexsuite via your system's package management system.) First, I would make sure you have the correct variables in your $HOME/.bash_profile (or possibly $HOME/.profile, or others), logout of your windowing system and then log back in. See the INVOCATION section of the bash man page. – RobertL Sep 05 '17 at 16:09
  • @Zili, there many ways these situations can occur. If you post the actual differences or errors, you'll get correct and more accurate answers more quickly. If you don't give enough information, don't show code and output etc, you get "more than likely" answers such as this, because the answer can only be based on similar situations that have been seen in the past and not tailored to your specific situation. – RobertL Sep 05 '17 at 16:15
  • The path to the LaTeX distribution was specified in my .bashrc but not in .profile. When I added the path to .profile, it works fine.

    I thought .bashrc and .profile were equivalent? Why did this happen?

    – Zili Sep 05 '17 at 17:54
  • @Zili, Again I refer you to the INVOCATION section of the bash man page. Bash sources the ~/.bashrc file only for interactive, non-login shells. Some distributions (eg. Debian, Ubuntu) set up ~/.profile to source the ~/.bashrc upon login. You, apparently, do not have . ~/.bashrc in your .profile. I recommend reading the bash man page, especially the INVOCATION section, and examining the various profiles in your distribution: /etc/profile/, /etc/profile.d/, the /etc/skel/ etc. Add a new user to your system and look at the default setup, etc. Hope this helps. – RobertL Sep 06 '17 at 16:58