5

To make my latex folder clean, I tried to hide all auxiliary files with the following DOS command:

attrib +S +H *.aux
......
attrib +S +H *.toc

But when I tried to compile my latex file again, xelatex and pdflatex in MiKTeX threw the following error:

I can't write on file `somename.aux'.

Is it possible to enable xelatex and pdflatex to write on auxiliary files, while these files remain hidden?

BTW: I don't want to put auxiliary files to other folder, since this way causes other problems.

  • Did you try without +S? +S sets the system file attribut, perhaps only writable/removable if the application (in this case TeX) is run by the administrator or has administrator rights, which is probably not true when you run MikTeX as normal user. I can not test my proposition since I do not work on Windows, its just a remembrance back to 1996, when I used DOS commands for the last time, before switching to Linux ;-) – user31729 Jun 15 '14 at 7:51
  • @ChristianHupfer Actually, I tried without +S, and the result was the same. – Z.H. Jun 15 '14 at 8:07
  • Did you check whether the hidden *.aux etc. files are writable at all? – user31729 Jun 15 '14 at 8:49
  • @ChristianHupfer Yes, I opened one .aux file with text editor, modified and saved it. No problem. – Z.H. Jun 15 '14 at 9:08
  • 1
    The solution (in Linux/TeXLive) involves editing texmf.cnf tex.stackexchange.com/a/198631/1871 . There must be an equivalent file in MikTeX – alfC Aug 30 '14 at 8:49
1

It appears that Windows hidden files can only be opened in read/write or append mode and not in plain write mode. Oddly I can't seem to find much official documentation on this, but you can test this yourself with code or a simple cmd.exe script (which I ran on Windows 8.1):

C:\>echo "hello" > temp.aux
C:\>attrib +H temp.aux
C:\>echo "hello" >> temp.aux
C:\>echo "hello" > temp.aux
Access is denied.

Using Procmon.exe one can see that the error is when pdflatex tries to open the .aux file in write mode. Other programs have this problem as well (I think wordpad, and the GitHub client with .gitignore/.gitattributes files that are hidden).

Your best bet is to wrap the PDF compilation call with hide and unhide calls in a script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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