emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX


From: Jeremie Juste
Subject: Re: Bug: unexpected behavior of nesting braces when exporting to LaTeX
Date: Sun, 22 Aug 2021 17:03:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]