Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

(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?

share|improve this question

1 Answer 1

up vote 17 down vote accepted

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.

share|improve this answer
    
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 Aug 30 at 8:48
8  
@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 –  David Carlisle Aug 30 at 8:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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