Juan Manuel MacĂ­as writes: >> As for {[}{]}, it is a bit difficult to implement. Especially when we >> also consider user filters and derived backends. If we have several >> transcoders of consequent elements, there is always a risk that even >> when a given filter/transcoder is generating a valid LaTeX code, >> concatenating them may still cause issues like we have with \\. > > I see. I think pandoc's solution is what Leslie Lamport recommends > (naturally, Lamport doesn't say to enclose /all/ brackets in curly > braces). This turned out to be a lot easier than I thought. See the attached patch. >> \command >> [unrelated text] >> >> If there are, we may actually want to consider pandoc's approach >> seriously. > > In principle, any environment that takes an optional argument in a > "dangerous" position. Just do a simple test. Something like this: > > #+begin_figure > [lorem] ipsum > #+end_figure > > will throw an error like ''LaTeX Error: Unknown float option...'' > > Of course, putting an empty line after #+begin... usually solves it. But > the user may not know it. > > There are also a number of commands with an optional argument. For > example \pagebreak. Something like this will give an error: > > lorem @@latex:\pagebreak@@ [ipsum] > > \item is another typical example, but in this case org adds \relax. With the patch, I am getting the following: * This is test lorem @@latex:\pagebreak@@ [ipsum] #+begin_figure [lorem] figure #+end_figure | [foo] | 2 | | [bar] | 3 | - [bax] - [aur] exports to lorem \pagebreak {[}ipsum] \begin{figure} {[}lorem] figure \end{figure} \begin{center} \begin{tabular}{lr} {[}foo] & 2\\[0pt] {[}bar] & 3\\[0pt] \end{tabular} \end{center} \begin{itemize} \item {[}bax] \item {[}aur] \end{itemize}