6

Does anyone have a good way to produce LaTeX mathematics matrices from org-mode tables?

I found this thread but it doesn't seem to have a ready-made solution.

This gets me close.

#+LATEX: \begin{equation}
#+LATEX: \begin{matrix}
| a | b |
| c | d |
#+LATEX: \end{matrix}
#+LATEX: \end{equation}

which exports to:

\begin{equation}
\begin{matrix}
\begin{center}
\begin{tabular}{ll}
a & b\\
c & d\\
\end{tabular}
\end{center}
\end{matrix}
\end{equation}
\end{document}

And I only have to take out the tabular and center directives.

2
  • 1
    Could you be more precise as to what you want? If you write a table in an org file and use the export to latex feature, you obtain a latex table. If you are looking for something integrated in latex documents, radio tables might be what you're looking for. orgmode.org/manual/…
    – T. Verron
    Jun 19, 2016 at 14:34
  • 2
    Take a look at (info "(org) LaTeX specific attributes"). The following will change your environment: #+attr_latex: :mode math :environment matrix.
    – mutbuerger
    Jun 20, 2016 at 14:46

1 Answer 1

10

Take a look at (info "(org) LaTeX specific attributes"). The following table attributes

#+attr_latex: :mode math :environment matrix
| a | b |
| c | d |

will export a LaTeX matrix in math mode:

\[
\begin{matrix}
 a & b \\
 c & d \\
\end{matrix}
\]
1
  • 3
    For the sake of completeness: If you wish to give your matrix a name, the way to go is inserting the corresponding string (e.g. "M =") as an argument to :math-prefix in the option list of the table. Figuring this out took me a while, so I hope this saves everyone else some time. Nov 6, 2019 at 13:45

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.