emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Thibaut Verron <thibaut.verron@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Orgtbl-mode in latex: escaped braces and dollars, and other arbitrary transformations
Date: Thu, 26 Jun 2014 12:38:02 +0200	[thread overview]
Message-ID: <878uoknegl.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <loom.20140626T100930-457@post.gmane.org> (Thibaut Verron's message of "Thu, 26 Jun 2014 09:55:46 +0000 (UTC)")

Hello,

Thibaut Verron <thibaut.verron@gmail.com> writes:

> I'm forwarding this question asked on stackexchange: 
> http://tex.stackexchange.com/questions/186605/with-orgtbl-how-to-ensure-
> that-braces-and-dollars-are-not-escaped 
>
> After some investigation, it seems that the behavior is hidden deep in the 
> export routines, and I was wisely suggested to ask the question on this list 
> instead.
>
> I have given some tex-related details in the linked question, including some 
> motivations and an example, the tl;dr is that in some conditions, the 
> orgtbl-to-latex exporter will perform arbitrary escape of some characters in 
> the cells, or other kind of transformations:
>
>  $\text{test}$ 
> is exported verbatim (OK).
>
> But
>  \pbox{test}    
> becomes
>  \pbox\{test\}

You should upgrade to Org 8.

>  {test}
> becomes
>  \{test\}

This is intended.

>  {$test$}
> becomes
>  \{\$test\$\}

This is to be expected as matching single dollar math snippets is
fragile. I suggest to use \(...\) instead: {\(test\)}

> And the exporter seems to be trying to be smart, because it will still 
> ensure that the result is correct:
>
>  {$\infty$}
> becomes
>  \{\$$\infty$\$\}

Ditto. Use \(...\). Or, better, {\infty} as \infty is an Org entity
which will properly translated into LaTeX code.

> The weirdest of all might be this one:
>  \pbox{Foo: \\${bar= (2^{3},1)}$, ${baz= (8^{4})}$}
> becomes 
>  \pbox\{Foo: \\${bar= (2^{3},1)}$, \$\{baz= (8$^{\text{4}}$)\}\$\}

You cannot write raw LaTeX macros with complicated arguments (e.g.,
containing braces) in an Org buffer. In this case, you have to tell the
exporter it is LaTeX code and don't expect it to find it out:

  @@latex:\pbox{Foo: \\${bar= (2^{3},1)}$, ${baz= (8^{4})}$}@@

This will be ignored in any exporter but latex (and beamer).

> The option `:no-export`, as expected, has no effect, since it only controls 
> whether `#_^&%` are escaped or not. 

This option doesn't exist anymore in Org 8.

> Is this a known feature, or a bug? And is there a known workaround?

Actually, this is consistent if you understand the limitations of Org.
As a rule of thumb, avoid using $..$ constructs and macros with
convoluted arguments (but "\hfill{}" and "\vspace{1cm}" are fine) when
writing raw LaTeX in an Org buffer.

For anything more complicated, use @@latex:...@@
or #+BEGIN_LATEX...#+END_LATEX (inline and non-inline version).

Again, all this assumes you are using Org 8.

HTH,


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-06-26 10:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26  9:55 Orgtbl-mode in latex: escaped braces and dollars, and other arbitrary transformations Thibaut Verron
2014-06-26 10:38 ` Nicolas Goaziou [this message]
2014-06-26 11:57   ` Thibaut Verron
2014-06-26 12:22     ` Thibaut Verron
2014-06-26 13:17       ` Nicolas Goaziou
2014-06-26 13:53         ` Thibaut Verron
2014-06-26 19:07           ` Nicolas Goaziou

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=878uoknegl.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=thibaut.verron@gmail.com \
    /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).