[texworks] latex->dvips->ps2pdf on Windows

Joel C. Salomon joelcsalomon at gmail.com
Thu Jun 11 01:56:21 CEST 2009

Joseph Wright wrote:
> David Arnold wrote:
>> Has anyone successfully set up Texworks to run latex->dvips->ps2pdf on a
>> windows machine? If so, can you share how?
> Probably easiest to set up a batch file that does the job

In December ’06 I posted figtex.bat to the PSTricks list, which ran a
similar command set.  The magic in the parameter expansion is documented
I give you dvi2pdflatex.bat:

@echo off
if "%~1"=="" (
    echo usage: %~n0 file
    exit /b 1
echo %~n0^> latex %1
latex %1
if errorlevel 1 exit /b 1
echo %~n0^> dvips "%~dpn1.dvi" -o "%~dpn1.ps"
dvips "%~dpn1.dvi" -o "%~dpn1.ps"
if errorlevel 1 exit /b 1
echo %~n0^> ps2pdf "%~dpn1.ps"
ps2pdf "%~dpn1.ps"

I find it helpful to echo the commands being executed (with a prefix to
distinguish the commands from their output).  If you don’t want that,
then the simple one-liner Tomek posted is nice too.

—Joel Salomon

More information about the texworks mailing list