While using the pdf latex chain, how can one delete the *.ps file automatically right after the pdf has been created? *.ps files can be big (~100 MB). Hence, this question.

  • 5
    I use pdftex, which doesn't create a .ps file. In general, the same program you used to make the chain may have an option to delete the .ps file afterwards.
    – vadim123
    Jan 27, 2014 at 5:32
  • 1
    If you have to follow the DVI > PS > PDF chain, perhaps using xelatex might be of help to compile directly to PDF.
    – Werner
    Jan 27, 2014 at 6:04
  • Assuming latex -> dvips - > ps2pdf, it's down to the script you use for the build to do the deletion. We'll need more detail about how you do things.
    – Joseph Wright
    Jan 27, 2014 at 6:56
  • 3
    Presumably this question should not be tagged pdftex, as there are no ps files in that case Jan 27, 2014 at 10:01
  • 1
    @DavidCarlisle: You can edit the tags of questions. :-) Jan 28, 2014 at 10:39

1 Answer 1


One way of doing this is to compile with arara instead of the usual build chain in TeXstudio. arara is a compilation tool where you describe which steps should be part of the compilation sequence in comments placed at the top of the file. A description of setting up arara in TeXstudio can be found in https://tex.stackexchange.com/a/118899/586

A minimal example is

% arara: latex
% arara: dvips
% arara: ps2pdf
% arara: clean: { files: [ test.dvi, test.ps ] }

Hello world!

If this is saved in test.tex, then running arara test.tex will compile the sequence latex - dvips - ps2pdf, and then remove the test.dvi and test.ps files. Note that in %arara: ps2pdf the ps2pdf part is not the name of a binary, it is the name of a rule, which is defined by arara. As such, you can't just put the name of any program here.

Sample terminal output:

testdir$ ls
testdir$ arara test.tex
  __ _ _ __ __ _ _ __ __ _ 
 / _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
 \__,_|_|  \__,_|_|  \__,_|

Running LaTeX... SUCCESS
Running CleaningTool... SUCCESS
Running CleaningTool... SUCCESS
testdir$ ls
test.aux  test.log  test.pdf  test.tex

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.