Adding `./src` to path
If you are not using latexmk
or for some other reason need too add the ./src/
subfolder to laTeX search-path, here is how to do it:
Using MiKTeX
MiKTeX makes this very easy by adding an option for that. Just add -include-directory=./src
to your call to pdflatex
.
For building from sub folders, just add a second -include-directory=../src
to your call.
Using Texmaker and MiKTeX
As stated above, you just need to extend your Latex-call with the needed include path.
To do this, go to Options → config Texmaker → Commands
change the pdflatex command to:
pdflatex -synctex=1 -interaction=nonstopmode -include-directory=./src -include-directory=../src %.tex
Using VS Code with LaTeX Workshop
In VS Code you can configure your launch to set environment variables. Just edit your settings.json
, so that your pdflatex tool contains a env:
(add it, if it isn't there yet). If you use the template below, you will also get some additional nice configurations. See also
here for some additional configs.
"latex-workshop.latex.tools": [
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-aux-directory=%OUTDIR%/.aux",
"-output-directory=%OUTDIR%",
"%DOC%"
],
"env": {
"TEXINPUTS": "%DIR%/src/;%DIR%/../src/"
}
}
]
On Overleaf
As explained here,
add the latexmkrc
file and put this line into it (which is already part of the latexmkrc
provided by the project):
$ENV{'TEXINPUTS'}='./src/:';