# Is it possible to make LaTeXit reference internal equations properly?

Minimum example in LaTeXit text mode

$$\label{1} x^2$$
\eqref{1}


Explain how to get \eqref{1} to typeset as (1) rather than (??) and you've solved my problem

I tend to misuse LaTeXit to typeset page-long documents on my mac, the code of which are collected into large proper documents down the line. I would like equation references within these page long previews to appear properly, not appear as "(??)". I figure all you need to do is somehow get LateXit to rerun LateX in the same directory in which it creates the aux file, but with all the Linux based directory shifting LaTeXit does, I lack the nous to make the necessary incision into the code. Interpage references are more rare, so I can live without those, but intrapage references are too common to leave as improperly formatted. Can anyone help me out? Cheers:)

• – Claudio Fiandrino Feb 26 '13 at 9:15
• Would be happy too! My problem is I don't know how to compile twice in LaTeXit. Clicking LaTeXit twice doesn't work because the LaTeXit code spits the auxiliary files into temporary directories or something. – tomminn Feb 26 '13 at 22:36
• In my opinion LaTeXiT is not intended to do so. You just should compile the equations or expressions, not full documents. – Manuel Feb 26 '13 at 22:48
• Couldn't agree more @Manuel. But it's really useful to me in a purpose that it wasn't intended for (aware of this I did say in my question 'I tend to misuse LaTeXit...'). If this isn't the place for this kind of question I can move my query to different forum if you think that's more appropriate? – tomminn Feb 27 '13 at 2:46
• @Tom The question is appropriate here. LaTeXit is a TeX related tool, even if you want to misuse it. :) I tried using arara as the compilation script but that didn't seem to work either. – Alan Munn Feb 27 '13 at 3:26

Here's a way to do it (at least with LaTeXiT 2.3.0-2.8.1):

1. Go to LaTeXiT -> Preferences -> Typesetting (or Composition) -> Behaviour.
2. Copy the name of the program it is using (e.g., /Library/TeX/texbin/pdflatex)
3. Click on the "Additional scripts" tab.
4. Turn on the "Enabled" checkbox next to "Pre-processing".
5. Choose the "Define a script" option.
6. Leave the Shell as /bin/sh (or whatever).
7. In the Script textbox, paste the location of your pdflatex program, or just type pdflatex. Then add a space and $INPUTTEXFILE. This will give you a one-line script like /Library/TeX/texbin/pdflatex$INPUTTEXFILE or pdflatex \$INPUTTEXFILE
8. Close the Preferences dialog box. At this point, clicking the "LaTeX it!" button should correctly resolve cross-references.

This seems to work fairly reliably, but it slows down typesetting, since pdflatex runs twice. If you want to be able to turn this mode on or off easily, you could use the Configurations pop-up menu on the Typesetting preferences pane to create a new "resolve refs" configuration.

LaTeXit is intended for typesetting individual equations then using the output in other non-TeX programs. As such, cross-refs and the like are 'outside of scope' for it. Things like cross-refs need a 'full' TeX system: for example you could use the standalone package to generate PDF files for insertion.