0

I solved my problem, but I would like to know why it appeared in the first place.

The following code is a MWE of the code I had. It worked for quite long until I updated a lot of my software on my computer. After that it just did not work anymore and with the errors I couldn't directly find the solution.

\documentclass{scrbook}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
    \tikzsetnextfilename{.tikz_external/fig1}%
    \begin{tikzpicture}
        \draw (0,0 ) -- (1,1);
    \end{tikzpicture}
\end{document}

If you notice, I used to store all externalized figure stuff in the folder .tikz_external. After a long while I noticed that this is the problem. If I delete the point in the folder name, everything works again.

Now I would like to know why this behavior changed. Furthermore, even after finding the problem, I found nothing about that behavior. Is this not described anywhere?

edit: I'm using the latest MikTex distribution (2.9.6360).

the error ist

! I can't write on file `.tikz_external/fig1.md5'.
<to be read again> 
                   \relax 
l.10    \end{tikzpicture}

Please type another output file name
! Emergency stop.
<to be read again> 
                   \relax 
l.10    \end{tikzpicture}

*** (job aborted, file error in nonstop mode)

from this error, I just knew pdflatex can't write on the file but not why. And as I said, before I updated the distribution everything worked as expected.

bene
  • 2,090

1 Answers1

1

You don't give any of the following pieces of information:

  1. what error message you get, if any, or whether it fails to work in some other way;
  2. which distribution of TeX you are using.

Hence, it is impossible to say for sure.

On a current TeX Live installation, the code fails simply because a path beginning with a dot is among those which, by default, TeX is forbidden to open as an output stream.

This is determined in texmf.cnf

% Do we allow TeX \input or \openin (openin_any), or \openout
% (openout_any) on filenames starting with `.' (e.g., .rhosts) or
% outside the current tree (e.g., /etc/passwd)?
% a (any)        : any file can be opened.
% r (restricted) : disallow opening dot files
% p (paranoid)   : as `r' and disallow going to parent directories, and
%                  restrict absolute paths to be under $TEXMFOUTPUT.
openin_any = a
openout_any = p

The setting p for openout_any tells you which files TeX may and may not open for output streams; the setting a for openin_any tells you which it may and may not open for input streams.

Clearly, p forbids writing to dot files. The problem has nothing to do with externalisation. The error is triggered simply because you can't write to such a file and explains why.

pdflatex: Not writing to .tikz_external/fig1.md5 (openout_any = p).

! I can't write on file `.tikz_external/fig1.md5'.
<to be read again> 
                   \relax 
l.41     \end{tikzpicture}

(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: 
cfr
  • 198,882
  • I'm using MikTex. I added the exact error message I got in my original comment. With MikTex there is no hint on the openout_any = p – bene Sep 21 '17 at 06:02