3

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!

4
  • can't you do cd Test; latexmk main.tex so you are running in the documents directory? Jan 29, 2018 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 ../) Jan 29, 2018 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, 2018 at 20:22
  • But the cd Test; ... worked! Thank you very much!
    – ExtremOPS
    Jan 29, 2018 at 20:42

1 Answer 1

3

It usually works best to run tex from the document directory, so

cd Test; latexmk main.tex

rather than

latexmk Test/main.tex
2
  • I try run pipeline like yours, but because bibliography and glossary all times appear error. You know how to solve? Nov 4, 2020 at 21:12
  • @DanielSousa if you have an error message that you don't understand, post a new question showing the error and the code that causes it. Nov 4, 2020 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .