[Tex/LaTex] Configuring TeXworks processing tools

texworks

I am trying to configure TeXworks to run the following chains:

  1. latex with automatic dvi viewer opening
  2. latex+dvips with automatic ps viewer opening

Essentially, I want to learn how to configure TeXworks to create my own chains of commands possibly with a long list of executables that are usable and commands used within TeXworks. That is, what can go under Program and Arguments.

For example, from the post: https://tex.stackexchange.com/a/18938/10898 if I want to compile
via latex+dvips+ps2pdf, I would need to use

-e
$latex='latex -synctex=1'
-e
$dvips='dvips -P pdf -t a4'
-pdfps
$fullname

with latexmk as the Program as shown below:

enter image description here

When I analyze the pdfLaTeX settings its much simple than the one shown above. Any clarifications on how to create these settings and explanation or tutorials to understand TeXworks at this level will be very helpful. Is latexmk the only Program which can be used? I have tried changing it to latex.exe or the sort but no good results.

Best Answer

I would suggest that you create your own batch file doing exactly what you want. I'm not on windows now, but I believe it should look like this:

latex -synctex=1 "%1.%2" && dvips -P pdf -t a4 "%1.dvi" && ps2pdf "%1.ps"

(The && ensure that the next stages are not executed in the case of an error.) Save it under some unique name like myldpp.bat (MY Latex Dvi Ps Pdf) in the folder where TeXworks look for it, e.g. the ./bin/win32 of your texmf tree. Finally create a rule in TeXworks that calls myldpp.bat with two arguments $basename, $suffix.

The complete list of $... arguments to TeXworks:

$synctexoption   expands to "-synctex=1" if your tools support SyncTeX
$fullname        expands to the full name of your root document (e.g. rootfile.tex)
$basename        expands to the name (without ext.) of your root document (e.g. rootfile)
$suffix          expands to the extension of your root document (e.g. tex)
$directory       expands to the absolute path to the directory containing your root document

The webpage also suggest slight improvement of the .bat file that I incorporated to the answer now.

Related Question