How to let Julia use my LaTeX installed in a different directory

I am running Julia on a cluster system and I installed a separate LaTeX engine in my personal directory:

/PATH_TO_LATEX/

But in my julia console, it is using a different latex engine as when I type

Sys.which("latex")

then it returns

"/usr/bin/pdftex"

which is wrong.

How do people permanently shift Julia to search in the correct path?

Note that which will give you the first executable found according to your PATH environment variable.

Either set this not to include /usr/bin (which could have unintended consequences), or just use PATH_TO_LATEX directly.

(Also, this is not really Julia-specific, and certainly has nothing to do with performance, so I am moving the topic.)

In truth, the better solution would be changing your PATH to search in PATH_TO_LATEX before /usr/bin. It is very common for linux users to have their own script/binary folders in the start of their PATH before the system ones.

Here is a tutorial, it just adds $HOME/bin instead of PATH_TO_LATEX so you only need to change that.

If you want to always use your version of latex over others (in all programs respecting PATH) make this global and permanent, as in the tutorial. If you just want this in Julia, and in specific sessions, you can call Julia like this:

$ PATH="PATH_TO_LATEX:$PATH" julia