2

With the following mini-template, I want to copy the distnate pdf file into another one automatically as I run pdflatex with --shell-escape:

\documentclass{article}
\begin{document}
  Just a test.

\write18{cmd /c copy\jobname.pdf \jobname-print.pdf}
\end{document}

The problem is that this can't work, since the file jobname.pdf is using by the engine. I will get a copy of empty file of size 0.

Also, please consider we are working in writing a cls file, it also expected to work as

\AtEndDocument{
\write18{cmd /c copy \jobname.pdf \jobname-print.pdf}
}
user19832
  • 1,585
  • By the way, my plateform is Windows. But Linux also welcome... – user19832 Nov 13 '15 at 12:41
  • also I try to use \write18{cmd /c timeout 5 && copy \jobname.pdf \jobname-print.pdf} but not work. – user19832 Nov 13 '15 at 12:49
  • is pdflatex -jobname print.pdf source.tex from the command line an option (parameterized in a shell script)? See also http://tex.stackexchange.com/questions/19182/how-to-influence-the-name-of-the-pdf-file-created-with-pdflatex-from-within-the – Marijn Nov 13 '15 at 13:05
  • 1
    You can't do it during compilation. Isn't it easier to use a simple script (a .bat on Windows)? – egreg Nov 13 '15 at 16:48

0 Answers0