[Tex/LaTex] TexStudio sees the wrong version of TexLive

texlivetexstudio

When I compile a document from within TexStudio on my Linux Mint 17 the software reports:

Process started: pdflatex -synctex=1 -interaction=nonstopmode "community-detection".tex

and the log file starts with:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)

But when I run exactly the same command from the Terminal I get:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)

When I run Help > Check LaTeX Installation I get:

which pdflatex: /usr/bin/pdflatex

but running which pdflatex from my Terminal results in:

pdflatex is /usr/local/texlive/2014/bin/x86_64-linux/pdflatex
pdflatex is /usr/bin/pdflatex
pdflatex is /usr/local/texlive/2014/bin/x86_64-linux/pdflatex
pdflatex is /usr/local/texlive/2014/bin/x86_64-linux/pdflatex

So what is the /usr/bin/pdflatex file doing there and which package should I uninstall to get rid of it?

Best Answer

Many places on the web linux users will find the advise: add blah blah to PATH in ~/.bashrc. In general this is not a good idea, because only when ~/.bashrc has been executed, is the PATH change visible to programmes.

If you are a command line jockey (like me) and open every program through a terminal, you will not see the difference. However, if you start, say, an editor through a menu or a keyboard short cut, then chances are that whenever that editor is going to make a system call to pdflatex, it will not do this in a manner where ~/.bashrc has been executed, thus the PATH change is not found.

In the case of LaTeX, this often shows up as the editor now using an old LaTeX installation instead of the TeX Live 2014 one had just installed manually.

For Ubuntu based systems the proper solution is

  • If this is a single user system: add the PATH change to ~/.profile instead. This is executed globally at login.

  • If you manage a multi user system, prepend the PATH variable found in /etc/environment (remember to make a backup of this file, and remember that paths are separated by :)

Afterwards log out and log in again.


Note: If you plan to login to your Linux box using SSH and then running latex, then it is a good idea to have the PATH change in .bashrc as well, as the .profile settings are not executed when you login via SSH.