Skip to content
Snippets Groups Projects

Adding `./src` to path

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Jan Wille
    Edited

    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/:';
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment