[OS X TeX] Equation Service, Pages from iWork, inclusion of LaTeX source / untypesetting and baseline issues

Doug Rowland dougrowland at mac.com
Sat Feb 26 16:04:03 CET 2005

Lately I have benefited greatly from discussions with Maarten Sneep  
about elegant ways to vastly improve Equation Service's method of  
saving the LaTeX source within the PDF file.  Previously I had to do  
some encodings (substituting for various control characters), and  
including the substituted code as a pdfannot in the PDF file.  Due to  
my simple-minded substitution scheme this caused many problems and  
collisions, where some text wouldn't be extractable back from the PDF.

Also, as several have pointed out, ES makes the equation available as a  
TIFF or PDF file (preferring PDF).  In cases where the requesting  
application doesn't allow direct insertion of PDFs via services  
(TextEdit for one), this gives you the chance to use ES anyway, but you  
give up (for now) the ability to untypeset your equation.

Some ideas I thought of trying to make the untypeset service more  
useful, across more requesting applications:

	1)	steganography (encoding the pdflatex source in the image file  
	2)	including the pdflatex source as a comment in the image file  
(possible with certain graphics formats)
	3)	using a nice, searchable library system where you could always go  
in and find any equation you wanted to save and re-edit it (inelegant,  
and not good for documents you want to send to someone else)

Then I finally hit upon the possible solution - we can have ES send its  
output as an RTFD file (with the option of secondarily sending PDF or  
TIFF in that order of preference).  This allows you to "wrap" the PDF  
file in a container that many Mac OS X apps prefer.  In principle, you  
could include the LaTeX source both in the PDF file (which is wrapped  
in the RTFD) and also as comments / zero-point font in the RTFD file.

In addition to expanding the range of apps with which ES should work,  
this should allow transparent untypesetting that works uniformly across  
a wide range of apps.

Also, this could very well solve the "baseline" problem to which Bruno  
refers.  In Rich Text, you can specify the baseline of each individual  
element (relative to the current document baseline), including the  
"wrapped" PDF file.  So you could spit out a RTFD file with the  
equation baseline matching that of the surrounding text.  The only  
hangup for me is that I'm not enough of a LaTeX guru to figure out how  
to get the baseline information out of a LaTeX run.

If anyone has a good snippet of LaTeX code that will determine the  
amount below the baseline that a given bit of text descends, and writes  
this information to a small text file, I would greatly appreciate it.

In addition, this gave me ideas on how to implement the suggestion from  
several users that ES have a mode that typesets the equation in the  
same point size and color as the selected text (instead of taking in  
plain text, now we could take in the selected text as RTF, and parse  
the RTF to find the font characteristics).  This could be particularly  
useful in Keynote.

This is all still in development, and given my schedule, it may be a  
while before it is implemented.  Any offers of help would be greatly  


Doug Rowland
Laboratory for Extraterrestrial Physics
NASA Goddard Space Flight Center Code 696

work: 	(301) 286-6659	email: drowland at lepvax.gsfc.nasa.gov
fax:		(301) 286-1648	

--------------------- 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 Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the macostex-archives mailing list