[texworks] help

Duncan Murdoch murdoch.duncan at gmail.com
Sun Mar 22 17:14:39 CET 2020


On 22/03/2020 4:03 a.m., Ovi Chitayat wrote:
> Hi,
> I just figured out that
> \usepackage[miktex]{gnuplottex}
> is required for gnuplot to work under windows/miktex while running the 
> same job under MacOS
> requires
> \usepackage{gnuplottex}
> Is there a way to accomplish a conditional loading of packages based on 
> the platform?
> Or an 'optional option' passed to the package loader somehow?
> Ovi
> 

Your question looks like a LaTeX question rather than a TeXworks 
question, but in fact I think it is not.  As far as I know by the time 
LaTeX is involved it is hard to know which system it is working in:  I 
can't see that MikTeX defines special macros, for example.

The decision you want to make is more easily done in a preprocessor 
step.  If you are directly typing LaTeX code into TeXworks, then the 
simplest preprocessing is probably via a TeXworks hook script.

Unfortunately, I can't find recent documentation on hook scripts.  The 
best I can find is here: 
https://twscript.paulanorman.com/docs/index.html, and that was last 
updated in 2012, so may not be valid any more.  Those scripts are 
written in Javascript.

An alternative to working with TeXworks scripts would be to change the 
Typeset script to hook in some preprocessing.  For example, my 
TeXworks/configuration/tools.ini has this for pdfLatex:

[002]
name=pdfLaTeX
program=pdflatex
arguments=$synctexoption, $fullname
showPdf=true

Change that program entry to your own favourite shell script that 
preprocesses then runs pdflatex and you should be good.  The 
preprocessing would figure out whether pdflatex is coming from MikTeX 
and patch the $fullname file as appropriately.

Hopefully someone else will offer a simpler answer!

Duncan Murdoch


More information about the texworks mailing list.