4

I run LaTeX under OSX, and I would like to attempt to hide all of the LaTeX helper files from the finder after compiling. It strikes me that the simplest thing to do is not to move them or delete them or try to package them together, but just to set the BSD "hidden" flag on each file. Right now I end up just manually running a script like:

chflags hidden *.nav *.out *.log *.gz *.snm *.toc *.aux *.bbl *.blg"

in each directory after compiling a new file.

What I would like to do is to simply set this flag immediately after a compile, via the bash shell. I'm assuming that this can just be included in the setup for the pdfTeX command, but I can't figure out the proper way of referencing it. Ideally, I'd like this to work in TeXShop or in TeXStudio, but if someone has a similar thing working for different front end, I could at least try to port that.

  • try pdflatex <file.tex> && chflags hidden *.nav *.out *.log *.gz *.snm *.toc *.aux *.bbl *.blg" You can also put that into a formal bash script #!/bin/bash etc. – A Feldman Feb 9 '16 at 3:38
  • When I try to implement that in TexStudio, it doesn't work for reasons I can't quite diagnose. It says it's executing this, and if I run the identical command in the Terminal, it works fine, but it's somehow not executing the second part from the GUI. TexShop is just baffling me. I can't get new custom engines to appear at all. – WildGunman Feb 9 '16 at 20:37
  • Did the answer solve the issue? If so I would appreciate if you would mark it as the accepted answer. – A Feldman Feb 25 '16 at 1:24
  • This solution appears to work under TexStudio. I can't get it to work under TexShop, but that's probably my issue understanding how it works. It does generate an "exit with error" issue regarding the files which may not have been created. Is there any smart way around this? – WildGunman Feb 26 '16 at 17:22
3

You might try this:

Make a plain text file < filename.sh >

and put the following in it:

#!/bin/bash -

pdflatex "$1";

chflags hidden *.nav *.out *.log *.gz *.snm *.toc *.aux *.bbl *.blg

Save the file and make it executable (in linux chmod +x < filename >). Put a link to it in /usr/local/bin (or the mac equivalent of a system wide directory for users) so that you can run it system wide. Test it at the command line by typing:

<name of script>  <name of .tex file> 

Once you see that it works then try incorporating it into texstudio.

  • 1
    It would be better: #!/bin/bash -, <path>/pdflatex "$1"; (or set PATH explicitly) and add an explicit exit at the end. (Preferably with a meaningful exit code.) Also, is that " correct? I know it is in the question, but it looks very wrong. – cfr Feb 9 '16 at 23:39
  • @cfr thanks, I took out the " I usually end up just making my scripts and linking them to make them system wide, although this may not be good practice. As far as explicit exit with meaningful exit code, I don't know how to do that, yet. Actually, as far as dealing with paths in my scripts, I also don't know how to do that, yet. :) I don't really even know if the above will work at all, as my system is linux and the environment is Mac, but I tried. – A Feldman Feb 10 '16 at 3:22
  • 1
    Adding ` - ` after bash and quoting the argument "$1" would make this significantly safer, even if you don't yet know how to do the other things. – cfr Feb 10 '16 at 3:34
  • @cfr like that? – A Feldman Feb 10 '16 at 3:37

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.