9

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.

azetina
  • 28,884

2 Answers2

9

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.

yo'
  • 51,322
  • 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 04 '12 at 16:58
  • answer edited . – yo' Dec 04 '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 04 '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 04 '12 at 23:20
  • $fullname does not give the expected result when it contains spaces, do you know how to fix that? https://tex.stackexchange.com/questions/398024/texworks-issues-with-files-with-spaces – Bart Michels Sep 26 '19 at 09:22
  • @Schneider Have you tried "$fullname" ? – yo' Sep 26 '19 at 11:36
3

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.

Heiko Oberdiek
  • 271,626
tml
  • 39