16

(This question may make sense only in Linux.)

I have the following simple file called .main.tex. Note that it is a "hidden" file because of its name.

\documentclass[]{article}
\begin{document}
sample
\end{document}

I cannot compile it the usual way pdflatex .main.tex because I get this error:

$ pdflatex .interpolation.tex
This is pdfTeX, Version 3.1415926-2.6-1.40.14 (TeX Live 2014/dev)
 restricted \write18 enabled.
entering extended mode
(./.main.tex
...
No file .main.aux.
pdflatex: Not writing to .main.aux (openout_any = p).
! I can't write on file `.main.aux'.
\document ...ate \openout \@mainaux \jobname .aux 
                                                  \immediate \write \@mainau...
l.4 \begin{document}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: 

Of course if the filename were main.tex it would work.

Is there a workaround to compile dot files directly?

Or is this another limitation of how TeX detects file extensions (confused by the dots)?


Note that other related but different questions where asked before, this is however different:

(windows) TeX engine can't write on hidden aux files in Windows

(cleanup related) Is there a way to configure pdflatex to make all but the .tex and .pdf files hidden files?

(limitations of extension handling) How to avoid automatic .tex extension in filenames?

1 Answer 1

22

It depends on how paranoid your settings in texmf.cnf are. Mine (default texlive 2014) says:

% Allow TeX \openin, \openout, or \input 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 "dotfiles".
% p (paranoid)   : as `r' and disallow going to parent directories, and
%                  restrict absolute paths to be under $TEXMFOUTPUT.
openout_any = p
openin_any = a

So this gives the error you get, tex can read your main file, but is prevented from writing the aux file with a name starting with a dot.

note r prevents opening dotfiles.

5
  • openout_any = a in my /usr/share/texlive/texmf-dist/web2c/texmf.cnf (line 598) solved it. This also explains why I was never able to compile from a different directory! (It is the first time I see that creating dot files is a security problem.)
    – alfC
    Commented Aug 30, 2014 at 8:48
  • 9
    @alfC if you leave it as a generally then copying a malicious MWE from a tex web site and running it could trash your system files like .profile .login etc... unless you are totally sure what the macros are doing Commented Aug 30, 2014 at 8:55
  • Shouldn't you make these changes in /usr/local/texlive/2014/texmf.cnf rather than in texmf-dist/web2c/texmf.cnf? That is, according to the comments at the top of the former file, customisations should not me made in the latter but only the former.
    – cfr
    Commented Apr 19, 2016 at 21:04
  • @cfr yes but you need to look in the system one to see the current settings. In general better to then put the new values in a local cfg so not overwritten by updates, although tl2014 isn't likely to be updated now anyway. Commented Apr 20, 2016 at 8:05
  • @DavidCarlisle Yes, of course. But your answer here is being taken as a template for making changes for later editions of TeX Live and interpreted as telling people to make the changes in the system file. Since this is not good practice, it would be better, in my opinion, not to encourage it. That is, you may know not to make the changes in the system file for TL 2015 or 2016 or whatever, but your answer suggests it is fine to do that. I know it doesn't say that. But that's the way it is being interpreted, which is the only reason I commented. (& if David says it is OK, it must be, right?)
    – cfr
    Commented Apr 20, 2016 at 17:20

You must log in to answer this question.

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