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

Peter Dyballa Peter_Dyballa at Web.DE
Wed Oct 19 16:53:38 EDT 2005


Am 19.10.2005 um 20:53 schrieb Maarten Sneep:

>> 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).

That's obvious.

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

The sed expression s(ubstitutes) in a (with grep) given string, that 
starts with %SourceDoc and ends in one or more spaces, that string with 
nothing. So the rest of the line remains in the variable sourcedoc.

For example:

	sourcedoc=`grep ^%SourceDoc "$frontdoc" | sed -e 's/^%SourceDoc *//'`

--
Greetings

   Pete

The day Microsoft makes something that doesn't suck is the day they 
start selling vacuum cleaners.

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