3

I am trying to set up a repository for my slides and talks, so I have a repository with two folders

  • slides/
  • talks/

Now due to the security setup as mentioned here (How) can I include the file somedir/file.tex in the file somedir/subdir/anotherfile.tex it does not work to \include my slides. I want to run either xelatex or latexmk, so what if I actually do want to include these files? I found a few answers here and there but I seem to not get beyond the error message that the aux file can not be written for about the last hour.

So: What is the setting that allows me to run xelatex (or latexmk) in this situation?

I am on VS code and setting the output directory like

        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "--output-directory=%OUTDIR%",
                "%DOC%"
            ]
        },

does not help. Patching this would be my favourite way of a solution.

Ronny
  • 6,110

1 Answers1

1

One way is to set the environment variable TEXINPUTS so that it includes the parent directory as part of the search path for .tex files. This can be conveniently done with latexmk with an appropriate command line.

On a Unix-like operating system, the following works:

latexmk -pdfxe -e '$ENV{TEXINPUTS}="..:"' main

On Windows, the rules for quoting are different, and the separator character in TEXINPUTS is different. The following works:

latexmk -pdfxe -e "$ENV{TEXINPUTS}='..;'" main

An OS-independent version can be made by using a documented subroutine of latexmk:

latexmk -pdfxe -e "ensure_path('TEXINPUTS','..')" main

The command lines can be translated to whatever VS code needs of course.

The \include line must no longer have ../ for the parent directory. I used

\include{sub/ch.tex}

My directory/files relative to the top directory are document/main.tex and sub/ch.tex, and the compilation is done in the document subdirectory.

John Collins
  • 11,183
  • 3
  • 32
  • 33