TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(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
up vote 19 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 '14 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 – David Carlisle Aug 30 '14 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 Apr 19 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. – David Carlisle Apr 20 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 Apr 20 at 17:20

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.