[texworks] Passing $synctexoption to Windows batch script?

Duncan Murdoch murdoch.duncan at gmail.com
Wed Feb 19 21:09:48 CET 2020

On 19/02/2020 12:54 p.m., Kyle Woodward wrote:
> Hi,
> I am having trouble with a custom typesetting script (Windows batch). I 
> would like to pass $synctexoption to the script (in my case, `-synctex=1`).

If you are always using -synctex=1, why not hard code that in your 
script, instead of trying to pass it as a command line argument?
> When I read command-line arguments, batch reads = as a delimiter. I wind 
> up with (e.g.) %1 being `-synctex` and %2 being `1`. If I try to enclose 
> $synctexoption in quotes, "$synctexoption", TeXworks escapes the 
> quotation marks, giving %1 as `\"-synctex=1\"`, and thus %~1 is also 
> `\"-synctex=1\"`. That is, batch cannot natively remove the quotation marks.

If you sometimes have other synctex options, why not code your batch 
file to ignore %1 and put "-synctex=%2" in the right place within it?

Duncan Murdoch

> There are many feasible workarounds within the batch script, but the 
> most straightforward would be for TeXworks to not escape the quotation 
> marks. Is there an option somewhere to disable this escaping? (I have 
> disabled in-editor quotation mark escaping, but this is a separate thing)
> [sorry for mixing backticks and quotes; I hope the problem is clear]
> Thanks,
> Kyle

More information about the texworks mailing list.