0

I'm trying to migrate my LaTeX documents to better work with Git. One step in this is separating them out, which given the length is a good idea even if I wasn't using Git.

To this end I am trying some basic examples, but even these are failing with both latex and pdflatex.

The test.tex (the main file):

\documentclass[12pt,a4paper,oneside]{book}
\usepackage[utf8]{inputenc}

\begin{document}  
    \include{/tmp/page1}  
    \input{page2.tex}  
\end{document}

The original reason I had included the full path was as a troubleshooting step (which I forgot to revert). The issue was I was getting blank output. I'll try to troubleshoot this other issue first, and then likely ask another question. This is the source of the error by the way.

page1 (no extension, which is why it was failing to produce output):

Hello World

page2.tex:

another page

If I use input for both, there is no issue, however written like this, it fails. With just the \include{/tmp/page1} or \include{page1} line, it also fails. The second line with page2.tex is to show that it is working with \input. The error message is

I can't write on file `/tmp/page1.aux'. \include{/tmp/page1}
Emergency stop. \include{/tmp/page1}

which from an internet search I can tell is the message you normally get if you include the .tex extension, but I've omitted that.

I'm using TeXstudio, but I get the same error when I run latex in terminal without any options (i.e. latex test.tex).

$ pdflatex --version pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) kpathsea version 6.3.0 Copyright 2018 Han The Thanh
(pdfTeX) et al. There is NO warranty. Redistribution of this software
is covered by the terms of both the pdfTeX copyright and the Lesser
GNU General Public License. For more information about these matters,
see the file named COPYING and the pdfTeX source. Primary author of
pdfTeX: Han The Thanh (pdfTeX) et al. Compiled with libpng 1.6.34;
using libpng 1.6.34 Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with poppler version 0.64.0

  • You can't use absolute paths in \include. Just use \input – egreg Jul 27 '18 at 14:42
  • 1
    Normally for security reasons tex won't write to absolute pathes and as \include is trying to create an aux-file in /tmp it won't work – Ulrike Fischer Jul 27 '18 at 14:42
  • I get the error with or without the absolute path, but thank you for that. (scratch that. Let me update the question since its failing in a different way now.) – Nero gris Jul 27 '18 at 14:42
  • Actually, I think I should instead try to figure out why its failing in this new way first, and then ask another question. Its failing to produce output now, without an error. – Nero gris Jul 27 '18 at 14:44
  • 1
    actualy, i don't think your example shows what you want it to. if you said instead \include{/tmp/page1} \input{page1} that should test whether it is necessary to specify the path. (but i do assume that the files should have a .tex extension.) – barbara beeton Jul 31 '18 at 13:57
1

As was said in the comments, the problem was with my use of full path. For security reasons LaTeX doesn't allow this. Instead I needed to use the relative path.

As for the other problem I mentioned, which is not the main question asked, the issue was that I had left off the .tex on the file itself. LaTeX expects an extension there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.