[OS X TeX] Number of pages with AppleScript in TeXShop

Maarten Sneep maarten.sneep at xs4all.nl
Wed Oct 19 14:53:57 EDT 2005


On 19 Oct 2005, at 0:10, Peter Dyballa wrote:

> Am 18.10.2005 um 23:23 schrieb Maarten Sneep:
>
>> # find the real master file (TeXShop 2.0 Style first)
>> sourcedoc=`awk -F= '/^%!TEX *[Rr]oot/{print $2}' < $frontdoc`
>>
>> # if the new method didn't give a result, try the old method:
>> if [ "$sourcedoc" = "" ]; then
>>     sourcedoc=`awk '/^%SourceDoc/{print $2}' < $frontdoc`
>> fi
>>
>> I realise just now that this only works on files without spaces in  
>> their names. How does TeXShop do this (does it actually work?) I  
>> guess I should be using sed or cut to get the correct value. OK,  
>> we'll add a statement that support for filenames with spaces is  
>> limited.
>
> Maarten, you shouldn't worry! Just try another method: sed -e 's/^% 
> SourceDoc *//' ... $frontdoc needs double quotes.

Actually, it works for the new syntax (because I split on =, not on  
whitespace). The old syntax requires some work, and somehow I don't  
think this sed snippet completely does what I need. For lines  
starting with %SourceDoc, I need the rest of the line (not just the  
second whitespace delimited chunk). This script will set sourcedoc to  
the wholefile except the %SourceDoc line.

Still looking for something.

Maarten
------------------------- 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