# LatexIt: how to include code?

I am trying to use LatexIt for code inclusion in the presentation (keynote). I have added the \usepackage{listings} in the body templates => preamble and the MWE* is here:

\begin{lstlisting}
public class test{
}
\end{lstlisting}


So, when I try to "Latex it!" it gives errors:

Missing \$ inserted.
Missing \endgroup inserted.
Missing \endgroup inserted.
Missing } inserted.
Missing } inserted.


and so on.

Any tips?

*Should be MNWE = Minimal Not Working Example.

Screenshot:

• I think latexit is meant for inserting formulas IIRC. – user11232 Feb 17 '14 at 23:03
• I don't think LaTeXIt is meant for general LaTeX compilation; it does formulas, that's all. – egreg Feb 17 '14 at 23:17
• Your example works for me with the latest version of LaTeXIt (2.5.4). A possible problem with your example might be that you have to select text. – Guido Feb 18 '14 at 0:06
• @egreg LaTeXIt can pretty well be used for general LaTeX compilation as long as the result is just a single page. I have used it quite a lot for including TikZ images and listings into my Keynote presentations. The point is the body/preamble templates, which have to be set up to include the respective packages. – Daniel Feb 18 '14 at 6:22
• Your example works well here, please provide us the complete preamble template and body. – Daniel Feb 18 '14 at 6:23

• is your texlive version 2013? – user3232 Feb 18 '14 at 22:14
• The version of LaTeXIt that ships with MacTeX/texlive is not the latest stable version. The latest stable version is 2.5.4. Also, I get your result when I do not select Text. – Guido Feb 19 '14 at 10:14