2

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.

Torbjørn T.
  • 206,688
DKS
  • 1,309

1 Answers1

3

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 ] }

\documentclass{article}
\begin{document}
Hello world!
\end{document}

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
test.tex
testdir$ arara test.tex
  __ _ _ __ __ _ _ __ __ _ 
 / _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
 \__,_|_|  \__,_|_|  \__,_|

Running LaTeX... SUCCESS
Running DVIPS... SUCCESS
Running PS2PDF... SUCCESS
Running CleaningTool... SUCCESS
Running CleaningTool... SUCCESS
testdir$ ls
test.aux  test.log  test.pdf  test.tex
testdir$ 
Torbjørn T.
  • 206,688