More elaborate answer on my PC...
In "13.10.5 Tables in LaTeX export" in the manual
(https://orgmode.org/org.html#Tables-in-LaTeX-export to be precise), I read:
<quote>
':mode'
The LaTeX export backend wraps the table differently depending on the
mode for accurate rendering of math symbols.</quote> ....
<quote>
For ‘math’ or ‘inline-math’ mode, LaTeX export backend wraps the table
in a math environment, but every cell in it is exported as-is.
</quote>
A failing example:
#+attr_latex: :mode math :environment align*
| f(x) = | x^3 + 3*x^2 + 3*x + 1 |
| = | (x^2 + 2*x + 1) * (x+1) |
produces:
\[
\begin{align*}
f(x) = & x^3 + 3*x^2 + 3*x + 1 \\
= & (x^2 + 2*x + 1) * (x+1) \\
\end{align*}
\]
as promised in the manual. Replace math with inline-math and you'll see
the environment wrapped in \(\).
Now, my patch, using :mode math* will produce an unwrapped
\begin{align*}
f(x) = & x^3 + 3*x^2 + 3*x + 1 \\
= & (x^2 + 2*x + 1) * (x+1) \\
\end{align*}
which compiles.
The only enhancement I see is to narrow the use of :mode math* to
:environments like align and align* and warn that other attributes may
not be exported.
Best, /PA
On 14/11/26 18:19, Ihor Radchenko wrote:
"Pedro A. Aranda" <[email protected]> writes:
Attached is a patch to allow the 'align' and 'align*' environments for
aligned tables.
Thanks!
For =math= or =inline-math= mode, LaTeX export backend wraps the
table in a math environment, but every cell in it is exported as-is.
- For =tabbing= the LaTeX tabbing environment is used and the correct
- tabbing delimiters =\>= are used.
- The LaTeX export backend determines the default mode from
+ The =math*= mode behaves like similarly, but without wrapping the
+ table in any sort of math environment[fn::This should be used for
+ the =align=, =align*= or other environments, where inlining results
+ in a LaTeX error.]. For =tabbing= the LaTeX tabbing environment is
+ used and the correct tabbing delimiters =\>= are used. The LaTeX
+ export backend determines the default mode from
~org-latex-default-table-mode~. The LaTeX export backend merges
contiguous tables in the same mode into a single environment.
My understanding is that the purpose of math and inline-math is grouping
subsequent tables together under the same \[...\] or \(...\) umbrella:
\[
<table 1>
<table 2 with caption and name stripped>
<table 3 with caption and name stripped>
...
\]
I come to this conclusion when reading the code in
`org-latex--wrap-latex-matrices'.
However, in the proposed math* mode, that extra stripping of captions
and table names does not seem reasonable.
Looking at `org-latex-table', I see that we already have
:mode verbatim and :mode tabbing for special handling of text inside table.
May we simply have :mode align and :mode align* working the same way?
--
Pedro A. Aranda
ox-latex & ox-beamer maintainer
Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy