*Bug: LaTeX: inline maths expression in \textrm is not fully supported@ 2020-12-13 1:30 Firmin Martin2020-12-13 10:24 ` Eric S Fraga 0 siblings, 1 reply; 3+ messages in thread From: Firmin Martin @ 2020-12-13 1:30 UTC (permalink / raw) To: emacs-orgmode Sometimes, we want to nest inline maths expression in \textrm to handle spaces easily and avoid repetition. Examples: 1. $A = \{n : \textrm{$n$ odd in $X$}\}$ 2. $A = \{n : \textrm{\(n\) odd in \(X\)}\}$ 3. \(A = \{n : \textrm{\(n\) odd in \(X\)}\}\) 4. \(A = \{n : \textrm{$n$ odd in $X$}\}\) are all equivalent to - $A = \{n : n \textrm{ odd in } X}\}$ But Org mode exports them in LaTeX as \begin{enumerate} \item \$A = $\backslash${n : \textrm{$n$ odd in $X$}$\backslash$}\$ \item \(A = \{n : \textrm{\(n\) odd in \(X\)}\}\) \item \(A = \{n : \textrm{\(n\) odd in \(X\)\}$\backslash$}$\backslash$) \item \(A = \{n : \textrm{$n$ odd in $X$}\}\) \end{enumerate} Namely, only cases 2. and 4., where nested maths delimiters are different than the outer-most maths delimiters, are correctly exported. On the other hand, Cases 1. and 3. introduced extra $\backslash$. Interestingly, display style maths expressions are correctly exported. 5. $$A = \{n : \textrm{$n$ odd in $X$}\}$$ 6. $$A = \{n : \textrm{\(n\) odd in \(X\)}\}$$ 7. \[A = \{n : \textrm{\(n\) odd in \(X\)}\}\] 8. \[A = \{n : \textrm{$n$ odd in $X$}\}\] exports to \begin{enumerate} \item $$A = \{n : \textrm{$n$ odd in $X$}\}$$ \item $$A = \{n : \textrm{\(n\) odd in \(X\)}\}$$ \item \[A = \{n : \textrm{\(n\) odd in \(X\)}\}\] \item \[A = \{n : \textrm{$n$ odd in $X$}\}\] \end{enumerate} without extra $\backslash$. Best, Firmin Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2020-10-16 Package: Org mode version 9.4 (9.4-55-g706ba9-elpaplus @ ~/.emacs.d/elpa/org-20201207/) ^ permalink raw reply [flat|nested] 3+ messages in thread

*2020-12-13 1:30 Bug: LaTeX: inline maths expression in \textrm is not fully supported Firmin MartinRe: Bug: LaTeX: inline maths expression in \textrm is not fully supported@ 2020-12-13 10:24 ` Eric S Fraga2020-12-14 6:33 ` Firmin Martin 0 siblings, 1 reply; 3+ messages in thread From: Eric S Fraga @ 2020-12-13 10:24 UTC (permalink / raw) To: Firmin Martin;+Cc:emacs-orgmode On Sunday, 13 Dec 2020 at 02:30, Firmin Martin wrote: > Sometimes, we want to nest inline maths expression in \textrm to > handle spaces easily and avoid repetition. > > Examples: > > 1. $A = \{n : \textrm{$n$ odd in $X$}\}$ I think you may be expecting too much of org's simple inline LaTeX parser. As soon as you have complex LaTeX, it's best to be explicit about it being LaTeX, e.g.: 1. @@latex:$A = \{n : \textrm{$n$ odd in $X$}\}$@@ HTH, eric -- : Eric S Fraga via Emacs 28.0.50, Org release_9.4-160-g7c8dce ^ permalink raw reply [flat|nested] 3+ messages in thread

*Re: Bug: LaTeX: inline maths expression in \textrm is not fully supported2020-12-13 10:24 ` Eric S Fraga@ 2020-12-14 6:33 ` Firmin Martin0 siblings, 0 replies; 3+ messages in thread From: Firmin Martin @ 2020-12-14 6:33 UTC (permalink / raw) To: Eric S Fraga;+Cc:emacs-orgmode > I think you may be expecting too much of org's simple inline LaTeX > parser. As soon as you have complex LaTeX, it's best to be explicit > about it being LaTeX, e.g.: > > 1. @@latex:$A = \{n : \textrm{$n$ odd in $X$}\}$@@ Thank you for the advice! This does work for LaTeX export, but if one would also want to export in HTML, the LaTeX expression is lost. I will stay with the "multiple \textrm" solution for now. Best, Firmin Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Sunday, 13 Dec 2020 at 02:30, Firmin Martin wrote: >> Sometimes, we want to nest inline maths expression in \textrm to >> handle spaces easily and avoid repetition. >> >> Examples: >> >> 1. $A = \{n : \textrm{$n$ odd in $X$}\}$ > > I think you may be expecting too much of org's simple inline LaTeX > parser. As soon as you have complex LaTeX, it's best to be explicit > about it being LaTeX, e.g.: > > 1. @@latex:$A = \{n : \textrm{$n$ odd in $X$}\}$@@ > > HTH, > eric > > -- > : Eric S Fraga via Emacs 28.0.50, Org release_9.4-160-g7c8dce ^ permalink raw reply [flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-14 6:34 UTC | newest]Thread overview:3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-13 1:30 Bug: LaTeX: inline maths expression in \textrm is not fully supported Firmin Martin 2020-12-13 10:24 ` Eric S Fraga 2020-12-14 6:33 ` Firmin Martin

Org-mode mailing list This inbox may be cloned and mirrored by anyone: git clone --mirror https://orgmode.org/list/0 list/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 list list/ https://orgmode.org/list \ emacs-orgmode@gnu.org public-inbox-index list Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.yhetil.org/yhetil.emacs.orgmode nntp://news.gmane.io/gmane.emacs.orgmode AGPL code for this site: git clone https://public-inbox.org/public-inbox.git