[TxMt] Inline PDF

Allan Odgaard allan at macromates.com
Tue Feb 8 00:52:54 UTC 2005


On Feb 8, 2005, at 1:14, Rob Walton wrote:

> I would like to be able to preview latex equations as I'm writing.  I
> really like writing latex, but can't wrap my mind around all the
> brackets in latex equations.  There is a service called "equation
> service".  In the text editor, you highlight the text you would like
> previewed and call the equation service.  It cuts the highlighted text
> into the clipboard, turns it into a pdf, and then copies this into the
> clipboard and pastes it into your document [...]

You can't display PDF inline like that, so TextMate won't work with  
this service. You can however mimic the service from inside TextMate  
and use the HTML output option to display the equation, if you have the  
PDF browser plugin installed.

I created a new command (in TextMate) with input set to selection and  
output to show as HTML and then the actual command(s) like this:

cd ~/Library/Application\ Support/Equation\ Service/Output
cat >myeqn.tex
cp ../Templates/pdflatex/basemathmode.tex .
pdflatex basemathmode.tex
echo '<meta http-equiv="Refresh"  
content="0;URL=file:///Users/'${USER}'/Library/Application%20Support/ 
Equation%20Service/Output/basemathmode.pdf">'

It writes the selected text to myeqn.tex (in the output directory for  
the Equation Service), copies over the basemathmode template, runs  
pdflatex on this template (which inputs myeqn.tex) and then outputs an  
HTML header that makes the HTML output window 'redirect' to the PDF  
file, which triggers the PDF browser plugin.

That said, when I tested this, I got black rectangles instead of digits  
in the output (but the symbols were okay). Though I also get that when  
I use the service directly (i.e. outside TextMate), and pdflatex does  
give a 'this is obsolete'-warning, so I think the templates from ES  
just needs to be updated to the latest pdflatex (distribution).




More information about the textmate mailing list