the lazy guy I am, I’d like to use MathType to type my equations, and see them nicely in Scrivener. Now that works pretty well, but here’s a quirk: I’d like to see the equations in Scrivener, as they are transferred using MathType, but I’d like to have the raw LaTeX code as well in Scrivener, so that I can then further on export to be processed by LaTeX.
Right now I can see that in the rtf, there’s something like
So without having tried to reverse that, it appears that for even relatively short equations, there’s quite some code added to the rtf, in something that may be a pdf format.
Have you tried putting the MathType equation inside an inline annotation?
[size=80][/size]
It seems to be working well for me. When I compile the image inside the annotation is stripped out, leaving only the LaTeX code, which I copied from MathType and pasted into Scrivener after inserting the prefab equation.
As for the data in the RTF, yup, that’s how MT loads the original data out of the image when Scrivener sends the whole blob to it for editing. I don’t know if anyone but MT can do anything useful with it however.
Thanks AmberV. Yes, makes sense - I was just hoping to not having to edit the MT equation both in MT as well as in Scrivener. Kind of a round-trip thing - what I’d probably need is to just have a way to copy the LaTeX version of the equation from MT into the clipboard, and then when I come back from MT to Scrivener, paste it there.
Won’t work with more complex things like alignat - but for common things it should work.
Yeah I don’t know about the pasting of LaTeX code into MT, but you can set its copy mode in its Preferences/Cut and Copy Preferences pane, and even choose your flavour. So you input the equation, quick Cmd-A/Cmd-C, then save it back to Scrivener and paste to get the functional code in place.
The workflow for editing is to simply double-click on the equation, and when you’re done with the edit, do the same copy, close and paste dance as before. That part I can’t think of a way to make more efficient (well, maybe with a BetterTouchTool/Keyboard Maestro override on Cmd-W)—but the part about getting to the editable equation is already right there in the image.
Hmm, maybe the LaTeXiT approach might be a little smoother? Granted you don’t get the GUI for editing equations, which might defeat the purpose, but LaTeXiT can convert an image directly into code, and then you can select code and convert it back into an image. For those fluent in the code, it’s an easy way of editing the equation and then dropping it back to a picture when you’re done. This is all done through a big set of Services—pop some shortcuts on the ones you need and the whole thing should be pretty fluid. Since the typesetting is LaTeX, it’s theoretically fine to leave it that way as an image, too, depending on the output requirements of course.
Coolest is that I can copy existing equations in LaTeX format into MT, and it will show them up just right.
It does also copy [ ] with it, which I have to remove each time when inside a more complex equation, and I’ve to put a % at the end of the image if I am within an equation environment (otherwise the first letter of the actual equation will be textrm), but still, it is pretty cool.
Nice, looks great! How are you stripping the image itself out, is there a style you’re using to strip the image out? That would be a better approach than annotations come to think of it, if you needed to make an ePub for whatever reason, you could just swap which styles are being removed.
The image is stripped out using the RTF2TXT handler in TeXDown. TeXDown, about which I had posted elsewhere on this forum, is a content extractor and parser for Scrivener I’ve written.
Above is a more annotated screen shot:
Double-clicking on the equation opens MathType.
Leaving MathType updates the equation
But before Leaving MathType, I do Cmd+A, Cmd+C to copy the equation in LaTeX as LaTeX code. That’s what’s used to generate the actual output.
I add a label, which I refer to using TeXDown syntax
That label gets converted to an equation number, and
Also, only when I refer to it, the equation get’s a number on the right.
Similarly, I use BibDesk for creating / managing my references, which gives me cite keys.
8 ) I use those cite keys in TeXDown syntax,
which gets converted to LaTeX code
For section headers etc. I’ve created a number of format templates. They are just visual, because
TeXDown uses the #### etc. at the beginning to convert them to LaTeX code.
Here’s how a TeXDown run looks like (I’m showing some configuration files first):