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

T T t34www at googlemail.com
Thu Jun 11 00:03:12 CEST 2009


On 10/06/2009, Joseph Wright <joseph.wright at morningstar2.co.uk> wrote:
> T T wrote:
>> Joseph, your batch is not going to work. Here's another one:
>>
>> @latex %1 && dvips "%~dpn1.dvi" && ps2pdf "%~dpn1.ps"
>
> I didn't check, but why not?

Several mistakes:

> @echo off
> if "%1%" == "" goto :error

It should be %1 instead of %1% and it's better to use:
  if "%~1" == "" ...
or
  if [%1]==[] ...
since "%1" == "" will not work for quoted file names

>
> goto :end

This will end the batch, nothing else will execute.

>
> latex %1
> IF ERRORLEVEL 0 (

This condition will always test true. 'IF ERRORLEVEL _N_' tests if
last exit code is _N_ *or* higher. It should be:

IF NOT ERRORLEVEL 1 (

>   dvips %1
>   ps2pdf %1
> )
> goto L:end

This will produce an error, since there is no label L.

>
> :error
>
> echo.
> echo Please supply a file name
> echo.
>
> :end
> --
> Joseph Wright
>


More information about the texworks mailing list