[OS X TeX] TeXShop typesetting and macro questions

Jonathan Kew jonathan_kew at sil.org
Tue Oct 3 12:54:32 EDT 2006


On 3 Oct 2006, at 3:07 pm, Chris Goedde wrote:

> My original question stands: Is there a way to write an applescript  
> macro in TeXShop to pass the "-jobname NAME" option to pdfetex? I  
> want to do this on a per-document basis, so hard-coding something  
> into a preference or shell script won't do it. Does anyone know if  
> this can be done, or how to do it?

If I'm understanding your requirement properly, I guess the way to do  
it would be to write an AppleScript that edits an .engine file to add  
the -jobname option, or writes the jobname you want into a temporary  
file somewhere for a custom engine to read.

That seems pretty hacky, though; it might be easier to forget  
AppleScript and simply use a shell script (running as a TeXShop  
engine). What is the source of the -jobname value you want to pass?  
If it's something easily recognizable in the source file, then you  
could use a shell script that first uses grep/awk/perl/sed/whatever  
to locate and extract the appropriate name, then calls pdfetex with  
the option you want.

An engine file along these lines might work:

   #!/bin/bash

   PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/teTeX/bin/`uname -p`- 
apple-darwin-current

   JOBNAME=`perl -ne 'if (/^%!TEX jobname=([^\s]+)/) { print $1;  
exit; }' "$1"`

   pdfetex -jobname="$JOBNAME" "$1"

This is intended to find a line of the form

   %!TEX jobname=something

in the source, and run pdfetex with that jobname. I haven't tried it,  
though; I hope someone will find and fix the errors, if I didn't get  
it right!

HTH,

JK

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list