* latex export of \ce question
@ 2014-04-21 23:35 John Kitchin
2014-04-22 4:14 ` Richard Lawrence
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: John Kitchin @ 2014-04-21 23:35 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
Hi all,
I often have to use the mhchem latex package to write chemical formulas,
and I have teh following export issue.
If I have this in an org file:
\ce{ABO_3}
\ce{ABO_{3-\delta}}
this exports as
\ce{ABO_3}
\ce\{ABO$_{\text{3-}\delta}$\}
The first one is fine, but the second one is not. The nested {} seems to
mess it up. Is there a way to get this to export correctly?
thanks,
John
-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu
[-- Attachment #2: Type: text/html, Size: 951 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: latex export of \ce question
2014-04-21 23:35 latex export of \ce question John Kitchin
@ 2014-04-22 4:14 ` Richard Lawrence
2014-04-22 12:32 ` Rasmus
2014-04-22 22:44 ` John Hendy
2 siblings, 0 replies; 6+ messages in thread
From: Richard Lawrence @ 2014-04-22 4:14 UTC (permalink / raw)
To: emacs-orgmode; +Cc: John Kitchin
Hi John,
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> If I have this in an org file:
>
> \ce{ABO_3}
> \ce{ABO_{3-\delta}}
>
> this exports as
> \ce{ABO_3}
> \ce\{ABO$_{\text{3-}\delta}$\}
>
> The first one is fine, but the second one is not. The nested {} seems to
> mess it up. Is there a way to get this to export correctly?
Hmm. I've played around with this a little, and the best solution I've
got is to use an explicit fallback to LaTeX, like:
#+LATEX: \ce{ABO_{3-\delta}}
...or whatever literal LaTeX is the right output for your situation.
(What is the correct export output in this case? In particular, should
the contents of the subscript be in math mode?)
The problem does indeed seem to be the embedded braces...I'm guessing
this is an inherent limitation, resulting form the fact that Org uses
regular expressions to recognize LaTeX expressions.
If this is something you need to do all the time, and the #+LATEX syntax
doesn't work for you (e.g. if you also need HTML export), you could look
into an Org macro or an export filter.
Best,
Richard
(If possible, please encrypt your reply to me using my PGP key:
Key ID: CF6FA646
Fingerprint: 9969 43E1 CF6F A646.
See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: latex export of \ce question
2014-04-21 23:35 latex export of \ce question John Kitchin
2014-04-22 4:14 ` Richard Lawrence
@ 2014-04-22 12:32 ` Rasmus
2014-04-22 15:03 ` John Kitchin
2014-04-22 22:44 ` John Hendy
2 siblings, 1 reply; 6+ messages in thread
From: Rasmus @ 2014-04-22 12:32 UTC (permalink / raw)
To: emacs-orgmode
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> Hi all,
>
> I often have to use the mhchem latex package to write chemical formulas,
> and I have teh following export issue.
>
> If I have this in an org file:
>
> \ce{ABO_3}
>
> \ce{ABO_{3-\delta}}
>
> this exports as
> \ce{ABO_3}
>
> \ce\{ABO$_{\text{3-}\delta}$\}
>
> The first one is fine, but the second one is not. The nested {} seems to
> mess it up. Is there a way to get this to export correctly?
You could use snippets. If you prefer the macro syntax you could also
use that. . .
#+MACRO: ce @@latex:ce($1)@@
@@latex:ce{ABO_{3-\delta}}@@
{{{ce(ABO_{3-\delta})}}}
--
This is the kind of tedious nonsense up with which I will not put
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: latex export of \ce question
2014-04-22 12:32 ` Rasmus
@ 2014-04-22 15:03 ` John Kitchin
0 siblings, 0 replies; 6+ messages in thread
From: John Kitchin @ 2014-04-22 15:03 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
Thanks. I was going crazy looking for the snippet syntax!
On Tue, Apr 22, 2014 at 8:32 AM, Rasmus <rasmus@gmx.us> wrote:
> #+MACRO: ce @@latex:ce($1)@@
> @@latex:ce{ABO_{3-\delta}}@@
> {{{ce(ABO_{3-\delta})}}}
>
John
-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu
[-- Attachment #2: Type: text/html, Size: 971 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: latex export of \ce question
2014-04-21 23:35 latex export of \ce question John Kitchin
2014-04-22 4:14 ` Richard Lawrence
2014-04-22 12:32 ` Rasmus
@ 2014-04-22 22:44 ` John Hendy
2014-04-26 13:51 ` John Kitchin
2 siblings, 1 reply; 6+ messages in thread
From: John Hendy @ 2014-04-22 22:44 UTC (permalink / raw)
To: John Kitchin; +Cc: emacs-orgmode@gnu.org
On Mon, Apr 21, 2014 at 6:35 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> Hi all,
>
> I often have to use the mhchem latex package to write chemical formulas, and
> I have teh following export issue.
>
> If I have this in an org file:
>
> \ce{ABO_3}
>
> \ce{ABO_{3-\delta}}
>
I've taken to using \( \) around LaTeX stuff. I also have:
#+options: tex:t
so that might be required. I tried your example, and I get an
undefined control sequence error (not sure why...), but it seems to
look right in the PDF. Just another option that might work for you
(maybe less typing for one-off situations?).
\(\ce{ABO_{3-\delta}}\)
John
> this exports as
> \ce{ABO_3}
>
> \ce\{ABO$_{\text{3-}\delta}$\}
>
> The first one is fine, but the second one is not. The nested {} seems to
> mess it up. Is there a way to get this to export correctly?
>
> thanks,
>
> John
>
> -----------------------------------
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: latex export of \ce question
2014-04-22 22:44 ` John Hendy
@ 2014-04-26 13:51 ` John Kitchin
0 siblings, 0 replies; 6+ messages in thread
From: John Kitchin @ 2014-04-26 13:51 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 510 bytes --]
On Tue, Apr 22, 2014 at 6:44 PM, John Hendy <jw.hendy@gmail.com> wrote:
> #+options: tex:t
Thanks for all the ideas. In the end I found the best way is to use ^:{} as
options, and then use regular subscripts. For chemical formulas works fine.
So that is ABO_{3} and ABO_{3-\delta}.
John
-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu
[-- Attachment #2: Type: text/html, Size: 1020 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-26 13:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-21 23:35 latex export of \ce question John Kitchin
2014-04-22 4:14 ` Richard Lawrence
2014-04-22 12:32 ` Rasmus
2014-04-22 15:03 ` John Kitchin
2014-04-22 22:44 ` John Hendy
2014-04-26 13:51 ` John Kitchin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.