emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [export] latex: texorpdfstring in heading
@ 2014-11-24 15:16 Andreas Leha
  2014-11-24 16:22 ` Eric S Fraga
  2014-11-24 16:24 ` Nicolas Goaziou
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Leha @ 2014-11-24 15:16 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

Background: I am always loading the hyperref package in my latex
exports.  That one complains (warns) about math in headings.  ("Token
not allowed in a PDF string")

The proposed solution in LaTeX is to use \texorpdfstring{}{}.  I've used
that successfully in the past also from org.

As it seems that stopped working as the {}{} get escaped now during
export.

So, here is my question: How do I use \texorpdfstring correctly in an
org heading?


And here is a minimal example:

--8<---------------cut here---------------start------------->8---
#+latex_header: \usepackage{hyperref}

* This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
For some reason.
--8<---------------cut here---------------end--------------->8---

which exports to

--8<---------------cut here---------------start------------->8---
\section{This contains \texorpdfstring\{\$\(\prod_{\text{k=1}}^{\text{N}}\)\$\}\{product 1toN\} math}
\label{sec-1}
For some reason.
--8<---------------cut here---------------end--------------->8---


Thanks,
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-24 15:16 [export] latex: texorpdfstring in heading Andreas Leha
@ 2014-11-24 16:22 ` Eric S Fraga
  2014-11-25  1:25   ` Andreas Leha
  2014-11-24 16:24 ` Nicolas Goaziou
  1 sibling, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2014-11-24 16:22 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

On Monday, 24 Nov 2014 at 15:16, Andreas Leha wrote:

[...]

> So, here is my question: How do I use \texorpdfstring correctly in an
> org heading?
>
> #+latex_header: \usepackage{hyperref}
>
> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
> For some reason.

Use the @@latex:xxx@@ directive, as in

* This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-558-g83d8a2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-24 15:16 [export] latex: texorpdfstring in heading Andreas Leha
  2014-11-24 16:22 ` Eric S Fraga
@ 2014-11-24 16:24 ` Nicolas Goaziou
  2014-11-24 21:15   ` Andreas Leha
  2014-11-25 13:23   ` Andreas Leha
  1 sibling, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2014-11-24 16:24 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Hello,

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> So, here is my question: How do I use \texorpdfstring correctly in an
> org heading?
>
>
> And here is a minimal example:
>
> #+latex_header: \usepackage{hyperref}
>
> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
> For some reason.

  * This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-24 16:24 ` Nicolas Goaziou
@ 2014-11-24 21:15   ` Andreas Leha
  2014-11-25 13:23   ` Andreas Leha
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Leha @ 2014-11-24 21:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> So, here is my question: How do I use \texorpdfstring correctly in an
>> org heading?
>>
>>
>> And here is a minimal example:
>>
>> #+latex_header: \usepackage{hyperref}
>>
>> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
>> For some reason.
>
>   * This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math
>

That should have occurred to me as well.  Ähem.

Thank you very much for the quick answer!

Regards,
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-24 16:22 ` Eric S Fraga
@ 2014-11-25  1:25   ` Andreas Leha
  2014-11-25 11:16     ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Leha @ 2014-11-25  1:25 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Monday, 24 Nov 2014 at 15:16, Andreas Leha wrote:
>
> [...]
>
>> So, here is my question: How do I use \texorpdfstring correctly in an
>> org heading?
>>
>> #+latex_header: \usepackage{hyperref}
>>
>> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
>> For some reason.
>
> Use the @@latex:xxx@@ directive, as in
>
> * This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math

Thank you very much!  That should have been obvious to me as well...

(It seems that you sent your reply even earlier than Nicolas --
unfortunately I only just saw it now appearing on the list)

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-25  1:25   ` Andreas Leha
@ 2014-11-25 11:16     ` Eric S Fraga
  0 siblings, 0 replies; 10+ messages in thread
From: Eric S Fraga @ 2014-11-25 11:16 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

On Tuesday, 25 Nov 2014 at 01:25, Andreas Leha wrote:

[...]

> (It seems that you sent your reply even earlier than Nicolas --
> unfortunately I only just saw it now appearing on the list)

Yes: I process most of my emails while commuting and offline and my
emails only get sent once I connect again...  My emails therefore
sometimes cross others in the æther!

Anyway, glad you got this working to your satisfaction.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-581-g0e52f0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-24 16:24 ` Nicolas Goaziou
  2014-11-24 21:15   ` Andreas Leha
@ 2014-11-25 13:23   ` Andreas Leha
  2014-11-25 14:55     ` Rasmus
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Leha @ 2014-11-25 13:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> So, here is my question: How do I use \texorpdfstring correctly in an
>> org heading?
>>
>>
>> And here is a minimal example:
>>
>> #+latex_header: \usepackage{hyperref}
>>
>> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
>> For some reason.
>
>   * This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product 1toN}@@ math
>

There is now the obvious follow-up question: What do I do if I want to
export that same document to other backends as well?

I assume I'd have to list each of the others individually as well like:
@@latex:foo@@ @@html:bar@@ @@ascii:bar@@ @@odt:bar@@ ?

Or is there some functionality @@latex:foo@else@bar@@ or @@non-latex:bar@@?


Thanks,
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-25 13:23   ` Andreas Leha
@ 2014-11-25 14:55     ` Rasmus
  2014-11-25 15:00       ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2014-11-25 14:55 UTC (permalink / raw)
  To: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi,
>
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> Hello,
>>
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> So, here is my question: How do I use \texorpdfstring correctly in an
>>> org heading?
>>>
>>>
>>> And here is a minimal example:
>>>
>>> #+latex_header: \usepackage{hyperref}
>>>
>>> * This contains \texorpdfstring{$\prod_{k=1}^N$}{product 1toN} math
>>> For some reason.
>>
>>   * This contains @@latex:\texorpdfstring{$\prod_{k=1}^N$}{product
>> 1toN}@@ math
>>
>
> There is now the obvious follow-up question: What do I do if I want to
> export that same document to other backends as well?
>
> I assume I'd have to list each of the others individually as well like:
> @@latex:foo@@ @@html:bar@@ @@ascii:bar@@ @@odt:bar@@ ?

You could use a macro if it's only for one document, see
(info "(org) Macro replacement").

Otherwise you could use a custom link and cond through your backends
backends, see `org-add-link-type' or
(info "(org) Adding hyperlink types").

Hope it helps,
Rasmus



-- 
And I faced endless streams of vendor-approved Ikea furniture. . .

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-25 14:55     ` Rasmus
@ 2014-11-25 15:00       ` Nicolas Goaziou
  2014-11-25 15:07         ` Andreas Leha
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2014-11-25 15:00 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> You could use a macro if it's only for one document, see
> (info "(org) Macro replacement").

E.g, something like

  #+MACRO: latex-or-not (eval (if (org-export-derived-backend-p org-export-current-backend 'latex) "$1" "$2"))

  {{{latex-or-not(latex code,something else)}}}


Regards,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [export] latex: texorpdfstring in heading
  2014-11-25 15:00       ` Nicolas Goaziou
@ 2014-11-25 15:07         ` Andreas Leha
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Leha @ 2014-11-25 15:07 UTC (permalink / raw)
  To: emacs-orgmode

Hi Rasmus and Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> You could use a macro if it's only for one document, see
>> (info "(org) Macro replacement").
>
> E.g, something like
>
>   #+MACRO: latex-or-not (eval (if (org-export-derived-backend-p org-export-current-backend 'latex) "$1" "$2"))
>
>   {{{latex-or-not(latex code,something else)}}}
>
>

Thank you very much!  That is very nice.

Regards,
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-11-25 15:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 15:16 [export] latex: texorpdfstring in heading Andreas Leha
2014-11-24 16:22 ` Eric S Fraga
2014-11-25  1:25   ` Andreas Leha
2014-11-25 11:16     ` Eric S Fraga
2014-11-24 16:24 ` Nicolas Goaziou
2014-11-24 21:15   ` Andreas Leha
2014-11-25 13:23   ` Andreas Leha
2014-11-25 14:55     ` Rasmus
2014-11-25 15:00       ` Nicolas Goaziou
2014-11-25 15:07         ` Andreas Leha

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