# GitLab CI Runner with relative paths in main.tex

I have a LaTeX document where I include another TeX file with a relative path like \include{../Meta/commands.tex}. If I compile it on my local machine all works fine.

Now I also want to use the CI feature of GitLab. I have my runner working in a way that following file gets compiled without an error.

\documentclass{article}
\begin{document}
Hello World!
\end{document}


My .gitlab-ci.yml files looks like this:

compile_pdf:
image: aergus/latex
script:
- latexmk -pdf -interaction=nonstopmode ./Test/main.tex
artifacts:
paths:
- main.pdf
expire_in: 1 week


If now the main.tex file contains a relative path to \include{../Meta/commands.tex}, then I get the following error:

Latexmk: Missing input file: '../Meta/commands.tex' from line
'! LaTeX Error: File ../Meta/commands.tex' not found.'


Does anybody know how to resolve this unpleasant issue? Most likely I have to resolve the relative paths but I do not know how...

Thanks for any help!

• can't you do cd Test; latexmk main.tex  so you are running in the documents directory? – David Carlisle Jan 29 '18 at 20:06
• note that \include{../Meta/commands.tex} may fail anyway it would need to write ../Meta/commands.aux and by default tex is prevented from writing to files not under the document directory (paths starting ../) – David Carlisle Jan 29 '18 at 20:08
• I propably know my mistake... I will check it tomorrow when I am back in the bureau and keep you then posted. Thank you anyways for your suggestions! – ExtremOPS Jan 29 '18 at 20:22
• But the cd Test; ... worked! Thank you very much! – ExtremOPS Jan 29 '18 at 20:42

cd Test; latexmk main.tex

latexmk Test/main.tex
`