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

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

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.

  • 2
    Perhaps related/useful: arara does helps with this kind of thing – cmhughes Dec 4 '12 at 1:19
  • @cmhughes I have read about arara but haven't implemented its use. – azetina Dec 4 '12 at 1:20
  • Maybe, I understand you wrong, but perhaps my answer knitr with TeXworks helps a bit? – Speravir Dec 4 '12 at 1:36
  • BTW from the help menu in TeXworks there is a link to “A short manual for TeXworks”. This ain’t helpful? – Speravir Dec 4 '12 at 1:43
  • @Speravir Not quite. It contains only basic information about TeXworks and no specifications in creating processing tools. – azetina Dec 4 '12 at 2:13

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.

  • I have read a lot about the batch file. What I am also looking for is the specific inputting of the code names such as $fullname, $synctexoption, etc that TeXworks uses. I want to learn them so that I can create them within TeXworks. Is there a manual or paper that specifies these commands and how to create the processing tools within TeXworks? – azetina Dec 4 '12 at 16:58
  • answer edited . – yo' Dec 4 '12 at 17:27
  • It would be good if someone can make a documentation about all of this. Like how to create the processing tools within TeXworks and as batch files later. – azetina Dec 4 '12 at 23:15
  • 3
    @azetina Two things are needed: (1) arara rule for TeXworks (2) good documentation of arara. I believe both of them exist. – yo' Dec 4 '12 at 23:20
  • $fullname does not give the expected result when it contains spaces, do you know how to fix that? tex.stackexchange.com/questions/398024/… – Bart Michels Sep 26 '19 at 9:22

Here are some useful information from David Arnold at redwood university. http://msenux.redwoods.edu/math/workshops/LatexWorkshop/ConfigureWindows.php

In the Texworks Preferences, Typesetting tab again, under Processing Tools, click the plus sign, then enter the following:

Name: latex=>dvips=>ps2pdf
Program: c:\miktex\miktex\bin\latex-dvips-ps2pdf.bat
Arguments: $basename

Check "View PDF after running". Click OK to finish.
Open Texworks and create a new file. Enter this line:

@latex -synctex=1 "%1.tex" && dvips "%1.dvi" && ps2pdf "%1.ps"

Save the file as c:\miktex\miktex\bin\latex-dvips-ps2pdf.bat.


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.