0

I am trying to write LaTex matrizes in org-mode. It works fine with exporting tables via #+attr_latex :mode math :environment matrix.

However, when I try

\begin{pmatrix}
1 & 2\\
3 & 4\\
\end{pmatrix}

this exports to

\begin{pmatrix}
1 \& 2\\
3 \& 4
\end{pmatrix}

in the latex document. And that gives me a literal & in the final latex document.

Is this default behaviour? How can I fix this?

  • The strange thing is that it exports just fine for me to both latex and HTML without any ampersand escaping. I tried with emacs -Q and it exports just fine as well. It might be due to something in your configuration. Try exporting with emacs started with the -Q option. – darcamo Nov 10 at 18:47
0

You should probably enclose the latex fragments in export latex blocks:

#+begin_export latex
\[
\begin{pmatrix}
1 \& 2\\
3 \& 4
\end{pmatrix}
\]
#+end_export
| improve this answer | |
  • But in that case, it won't export to HTML, which the OP might or might not be interested in. – darcamo Nov 10 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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