* Bug: unexpected behavior of nesting braces when exporting to LaTeX @ 2021-08-20 4:45 Chlo De 2021-08-22 7:27 ` Jeremie Juste 2021-08-23 9:56 ` Nicolas Goaziou 0 siblings, 2 replies; 4+ messages in thread From: Chlo De @ 2021-08-20 4:45 UTC (permalink / raw) To: emacs-orgmode Hello, I use Org-mode to take notes. I found that when there are nesting braces inside \emph{ }, \textit{ }, etc. the output is unexpected. The following org text \emph{{n+1}-a} \textit{a{b}c} will be translated as LaTeX expressions \emph\{\{n+1\}-a\} \textit\{a\{b\}c\} Can this be fixed? Best, Yue ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX 2021-08-20 4:45 Bug: unexpected behavior of nesting braces when exporting to LaTeX Chlo De @ 2021-08-22 7:27 ` Jeremie Juste [not found] ` <466664A7-58C7-4552-A2AF-FC2A8B01BFB4@gmail.com> 2021-08-23 9:56 ` Nicolas Goaziou 1 sibling, 1 reply; 4+ messages in thread From: Jeremie Juste @ 2021-08-22 7:27 UTC (permalink / raw) To: Chlo De; +Cc: emacs-orgmode Hello Yue, On Friday, 20 Aug 2021 at 00:45, Chlo De wrote: > \emph{{n+1}-a} > \textit{a{b}c} > > will be translated as LaTeX expressions > > \emph\{\{n+1\}-a\} > \textit\{a\{b\}c\} I'm not sure it is a bug. Could you specify what do you expect in these cases? Note that there are native org-syntax for \emph and \textbf *n+1 - a* /a{b}c/ (info "(org) Emphasis and Monospace") HTH, -- Jeremie Juste ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <466664A7-58C7-4552-A2AF-FC2A8B01BFB4@gmail.com>]
* Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX [not found] ` <466664A7-58C7-4552-A2AF-FC2A8B01BFB4@gmail.com> @ 2021-08-22 15:03 ` Jeremie Juste 0 siblings, 0 replies; 4+ messages in thread From: Jeremie Juste @ 2021-08-22 15:03 UTC (permalink / raw) To: Chlo De; +Cc: Org Mode Hello Yue, Posting your mail below back to the list where you have a better chance of getting the right explanation. I totally understand that many times copy directly latex chunk is a nice feature org-mode offers. From your example below, exporting the following script to latex would work ok in org-mode. #+BEGIN_SRC org #+options: toc:nil #+LATEX_HEADER: \usepackage{amsthm} #+LATEX_HEADER:\theoremstyle{theorem} #+LATEX_HEADER: \newtheorem{theorem}{Theorem}\usepackage{setspace} #+end_src * Theorem The longest word in this sentence is \emph{emphasized}. \begin{theorem} An emphasized a word looks \emph{distinguished}. \end{theorem} Yes, for my part I usually wrap into a source block, if I need native latex syntax #+BEGIN_SRC latex \emph{{n+1}-a} \textit{a{b}c} #+end_src I don't know if it is the case by design or if it is a bug. HTH, Jeremie On Sunday, 22 Aug 2021 at 09:03, Chlo De wrote: > Hello Jeremie, > > Thank you for your reply. > > As both \emph and \textit are commonly used LaTeX commands, I would > expect everything inside the braces be interpreted in LaTeX way, i.e., > plain { } are for semantic use only and are omitted in the output. > > I appreciate that you mentioned native org-syntax. There are two reasons > that I prefer the LaTeX way. > - I sometimes need to copy large chunk of tex contents from my other > notes or papers. It would be easier if I don’t need to convert them one > by one, as it is hard to spot such a thing in a long document. > - \emph is not exactly \textbf or \textit. With its default definition, > in text, \emph behaves like \textit. However, in an environment where the > text is italic by default, say, theorem, \emph will turn the text into > normal font. Here is a minimal example. > \documentclass{article} > \usepackage{amsthm} > \theoremstyle{theorem} > \newtheorem{theorem}{Theorem} > > \begin{document} > The longest word in this sentence is \emph{emphasized}. > \begin{theorem} > An emphasized a word looks \emph{distinguished}. > \end{theorem} > \end{document} > > The output is > > [cid] > > Besides, this question seems related > https://emacs.stackexchange.com/questions/52510/not-scape-braces-in-latex-org-mode > > Best, > Yue > > On Aug 22, 2021, at 03:27, Jeremie Juste <jeremiejuste@gmail.com> > wrote: > > Hello Yue, > > On Friday, 20 Aug 2021 at 00:45, Chlo De wrote: > > \emph{{n+1}-a} > \textit{a{b}c} > > will be translated as LaTeX expressions > > \emph\{\{n+1\}-a\} > \textit\{a\{b\}c\} > > I'm not sure it is a bug. Could you specify what do you expect in > these > cases? > > Note that there are native org-syntax for \emph and \textbf > > *n+1 - a* > /a{b}c/ > > (info "(org) Emphasis and Monospace") > > HTH, > -- > Jeremie Juste > -- Jeremie Juste ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX 2021-08-20 4:45 Bug: unexpected behavior of nesting braces when exporting to LaTeX Chlo De 2021-08-22 7:27 ` Jeremie Juste @ 2021-08-23 9:56 ` Nicolas Goaziou 1 sibling, 0 replies; 4+ messages in thread From: Nicolas Goaziou @ 2021-08-23 9:56 UTC (permalink / raw) To: Chlo De; +Cc: emacs-orgmode Hello, Chlo De <shiyue9621@gmail.com> writes: > I use Org-mode to take notes. I found that when there are nesting braces inside \emph{ }, \textit{ }, etc. the output is unexpected. The following org text > > \emph{{n+1}-a} > \textit{a{b}c} > > will be translated as LaTeX expressions > > \emph\{\{n+1\}-a\} > \textit\{a\{b\}c\} > > Can this be fixed? Org only supports a limited part of the LaTeX syntax as raw syntax. This is not AucTeX mode! For complex macros (e.g., with nested braces), you need to use dedicated environments, as pointed out by Jérémie. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-23 9:57 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-08-20 4:45 Bug: unexpected behavior of nesting braces when exporting to LaTeX Chlo De 2021-08-22 7:27 ` Jeremie Juste [not found] ` <466664A7-58C7-4552-A2AF-FC2A8B01BFB4@gmail.com> 2021-08-22 15:03 ` Jeremie Juste 2021-08-23 9:56 ` Nicolas Goaziou
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).