0

I would like to streamline 3 commands into one, but I keep getting error message.

tex | dvips | ps2pdf file.tex

or possibly

tex file.tex | dvips | ps2pdf

Then divps says there is no file. Or I might try

tex file.tex > dvips > ps2pdf

Then I do get file.dvi but does not get handled by dvips. It's dangerous to guess this way and I clearly don't understand the > and | operators.

What is the correct way to run all 3 commands? The fact that this is TeX hardly matters.

  • Try make file.pdf or pdftex file.tex – Stéphane Chazelas Feb 5 '16 at 21:57
  • @StéphaneChazelas make: *** No rule to make target 'text.pdf'. Stop. – john mangual Feb 5 '16 at 22:00
  • you will probably need to use appropriate switches for all the commands that you are using to take data from appropriate streams (stdin) and write them to appropriate streams (stdout). It might not be default. Did you open manual pages? – Jakuje Feb 5 '16 at 22:08
2

The name of the output file is always the original name with the extension changed (unless you specify something other with command switches) so you could do this instead of piping.

tex file.tex; dvips file.dvi; ps2pdf file.ps

This executes the commands one after the other. I don't think the tex command has any way of outputting the result of its processing to stdout so you can't do piping with it.

EDIT:

As per Jeff's suggestion then this is a better way since the remaining commands are only executed if the previous command returns a successful exit status, that is status 0.

tex file.tex && dvips file.dvi && ps2pdf file.ps
  • Suggestion: change the semicolons to && so that subsequent commands only run if the previous ones were successful – Jeff Schaller Feb 5 '16 at 23:52

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.