LaTeX forum ⇒ General"Can't write on file" error, but this isn't a ../ reference: why?

LaTeX specific issues not fitting into one of the other forums of this category.
henrylaw
Posts: 2
Joined: Fri Mar 30, 2018 5:41 pm

"Can't write on file" error, but this isn't a ../ reference: why?

Postby henrylaw » Fri Mar 30, 2018 6:03 pm

pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian)
kpathsea version 6.2.1

My directory structure is as follows:
  1. . all the main .tex files
  2. ./graphics image files
  3. ./pod machine-generated .tex files
  4. ./pdf output

The include statements in the master document (acsd.tex) are of the form
  1. %\chapter{General overview}
  2. \include{acsd-010}
  3. %\chapter{The network}
  4. \include{acsd-020}
  5. ... etc; and later
  6. % Include from-POD documentation
  7. \include{pod/ssmcCmd}
  8. \include{pod/ssmcConsole}
  9. ... etc

From the root directory I issue the command pdflatex -output-directory ./pdf acsd.tex

And the formatter run crashes at the first include for the subdirectory, i.e. \include{pod/ssmcCmd}, with the message
  1. I can't write on file `pod/ssmcCmd.aux'.
  2. \@include ...\immediate \openout \@partaux #1.aux
  3. \immediate \write \@partau...
  4. l.94 \include{pod/ssmcCmd}

Now I understand the FAQ "LaTeX won’t include from other directories" but that applies to include statements referring to directories up the tree (\include{../bar/xyz.tex}) but I'm not trying to do that, and yet the error I have looks like the same thing.

What am I doing wrong?

henrylaw
Posts: 2
Joined: Fri Mar 30, 2018 5:41 pm

Postby henrylaw » Fri Mar 30, 2018 8:42 pm

I continued fiddling about (as you do) and discovered that if I omit the -output-directory flag then it all works fine. Can it be that in order to implement the -output-directory flag the code changes to that directory, after which the imbed of ./foo/bar becomes ../foo/bar and fails because of the limitation?

Would this count as a bug? It's certainly counter-intuitive.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8733
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Mar 30, 2018 8:49 pm

Hi,

and welcome to the forum!

I read your posts and thought about it. I just could not test as I'm traveling. Good to read that it probably works fine without the -output-directory flag!

Your TeX version is old though, of 2015. I know, stable Debian is behind the official TeX Live releases, though that's ok for common TeX documents without new features. TeX Live 2018 is in the testing phase and will be released in some weeks, I hope. Perhaps (after release) consider a TeX install from tug.org/texlive instead of from Debian repositories, it should work fine. I do that with Debian (servers) and Ubuntu (desktop, based on Debian).

Stefan
Site admin

rais
Posts: 152
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Sat Mar 31, 2018 11:47 am

henrylaw wrote:Can it be that in order to implement the -output-directory flag the code changes to that directory, after which the imbed of ./foo/bar becomes ../foo/bar and fails because of the limitation?

Not quite. Whenever you \include something, a partial aux file is opened for writing and when you change your output directory, this will be opened under that directory. However, this routine does not create missing folders on the fly...
In other words: your \include{foo/bar} tells LaTeX to create .pdf/foo/bar.aux which fails, because you did not create a subfolder foo in ./pdf.

Another possibility would be to use \input instead of \include, because \input just reads the file.

KR
Rainer


Return to “General”

Who is online

Users browsing this forum: No registered users and 13 guests