Hello, Rasmus <ras...@gmx.us> writes:
> This example produces invalid LaTeX code: > > #+CAPTION: test > #+ATTR_LATEX: :mode math :environment pmatrix > | \alpha | \beta | \gamma | > > Namely, > > \begin{equation} > \caption{test text} > \mathbf{H}=\begin{pmatrix} > \vdots & 0 & \vdots \\ > \vdots & H & \vdots \\ > \vdots & 0 & \vdots \\ > \end{pmatrix}. > \end{equation} > > But an equation cannot have a caption. > > I'm not sure what the desired behavior is. (i) To silently drop the > caption, (ii) to wrap the equation in some sort of float and give it a > caption; or (iii) to print the text sans the \caption{ยท}. > > (iii) can be archived with math-prefix. (ii) is a bit weird, but > could be archived relatively easy, but it's not really what one would > expect; it's consistent with how captions work for tables (turned into > a float when a caption is present). (i) is also a bit weird, but > seems the most reasonable to me. > > Since I don't know what the correct behavior is, I don't have a patch > right now. As a short term solution, I think the (i) is the best. That's exactly what happens to LaTeX environments: in `org-latex-latex-environment', the caption is dropped and only the label, if any, is inserted in the environment. As a long term solution, it would be interesting to be able to do (ii), for both tables in math mode (but not in inline-math) and LaTeX environments: captioning an equation is a reasonable request. Regards, -- Nicolas Goaziou