LaTeXiT magic

I tried something for fun and it could be quite helpful. As of now I include latex equations in scrivener as pure latex code with for example:

If you have LaTeXiT installed mark the this text and right click ->services ->Typeset LaTeX text

Now you well see the typeset equation in scrivener. (Including the typeset but I can live with that for now.)
The magical thing is that this also works in the other direction! So going back from the image produced by LaTeXiT to the code.

So what I would like to do is to use this pure latex code and covert it to the typeset equations and back all with one command. That would be perfect! Imagine “seeing” all your equations as they are inside scrivener but with the latex code in the background. So it would be perfect if the compile routine in scrivener could to that or some AppleScript service. I guess this could be done quite easily… Maybe I do it myself but I’m not a pro I’m AppleScript.

Imagine if this would also be possible for images! :smiley:

That is very useful.

If the are distracting you could set up preset replacements for compile so

\begin{equation} converts to <!-- \begin{equation}

and

\end{equation} converts to \end{equation}–>

Then you would only see your equation while you are working but the Latex code would go through commented on compile.

thanks for the tip!

I actually succeeded in using the same principle also for figures!

You need to to the following:
1.) use absolute paths, (without spaces unfortunately)
2.) add \usepackage{graphics} into LaTeXiT: preferences -> Templates

So this may be now a solution or the beginning of an solution to get the best of both worlds! You could already use fancy LaTeX stuff inside scrivener and see figures and equations as images. Then for compilation you need do go back to latex code.

An applescript which detects all equations and figures and uses LaTeXiT would be very handy. Maybe this could even be included in scrivener!

This is great, a big fat +1 to add this scan to compile – perhaps you should add a thread to the wishlist, I doubt our benign developing overlord often ventures into the MMD forums…

Actually does anyone know how to go back from the image to the latex text, although I have the “Revert equations back to latex” service activated it doesn’t show in Scrivener when selecting an image…

@nontroppo: just right click => Services
or you could assign an shortcut in LaTeXit.

This works well but if I want to select all images and revert all of them it does not work. It works though inside one single document but not if I select all text over several documents. Any ideas?

edit:
The problem are the selected lines which separate Scrivenings.
I changed it to “separte screenings with singe line breaks” but then there is another strange symbol in the way. Can this be avoided somehow?
Or is there a way to just select images in side several documents?