[OS X TeX] Neat trick: Embedding applescript source code in LaTeX
Ramón Figueroa-Centeno
ramonf at hawaii.edu
Thu Jun 3 21:12:47 EDT 2010
Aloha,
Here is a neat trick. You can embed in a link in LaTeX an applescript. When
the link is clicked the Applescript Editor opens with the code inserted. Try
the following,
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{applescript://com.apple.scripteditor?action=new\%26script=display\%20dialog\%20\%22hello\%22}{Click
me!}
\end{document}
You can use a utility named ApplescriptHTML
<http://homepage.mac.com/tkurita/scriptfactory/en/index.html> to do most of
the conversion for you (it generates HTML so you have to escape % to \% for
it to work in LaTeX).
I am adding similar functionality to my "TeXShop Webpage Helper" so we could
embed TeX in links in web pages and PDFs that open in TeX. Imagine having a
symbols list in a PDF or favorite snippets and clicking on a link and then
having the code inserted into your current document or a new one. You do not
have to worry about the encoding because I have already written a TeXShop
macro that does all the ugly work: you select some text, run the macro and
an encoded URL for the protocol texshop:// is placed in the clipboard. We
could write live LaTeX manuals and tutorials for our students. Anyway I am
geeked :)
Mahalo,
Ramón
--
View this message in context: http://macosx-tex.576846.n2.nabble.com/Neat-trick-Embedding-applescript-source-code-in-LaTeX-tp5137666p5137666.html
Sent from the MacOSX-TeX mailing list archive at Nabble.com.
More information about the MacOSX-TeX
mailing list