(Emacs: v27.1, Org: v9.5, pdfTeX: v3.14159265-2.6-1.40.21)

I am using the following Python code block to print LaTeX code:

#+BEGIN_SRC python :session :exports both :results output :wrap math

That prints:

M^{1} = \left[\begin{matrix}15000.0 \\ 15000.0\end{matrix}\right] \\

However, when I export to a LaTeX document, it is interpreted as:

M\textsuperscript{1} = [15000.0 $\backslash$\ 15000.0] \\

And that causes the LaTeX compilation to fail. How can I prevent Emacs from reinterpreting the output?

1 Answer 1


I think you should change :wrap math to :wrap export latex.

That should wrap the output in a #+begin_latex: block, which should in turn export the way you want.

  • Wrap just sets the value inside of the \begin{} and \end{} blocks surrounding the output. So :wrap latex does \begin{latex} ... \end{latex} Commented Mar 2, 2021 at 23:34
  • yes, I edited the answer, it should be :wrap export latex. Then it exports the correct way for me. Commented Mar 2, 2021 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.