emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Firmin Martin <firmin.martin@ens-lyon.fr>
To: emacs-orgmode@gnu.org
Subject: Bug: LaTeX: inline maths expression in \textrm is not fully supported
Date: Sun, 13 Dec 2020 02:30:15 +0100	[thread overview]
Message-ID: <87h7oq1oig.fsf@ens-lyon.fr> (raw)

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/)


             reply	other threads:[~2020-12-13  1:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  1:30 Firmin Martin [this message]
2020-12-13 10:24 ` Bug: LaTeX: inline maths expression in \textrm is not fully supported Eric S Fraga
2020-12-14  6:33   ` Firmin Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7oq1oig.fsf@ens-lyon.fr \
    --to=firmin.martin@ens-lyon.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).