Discussion:
[O] LaTeX export: Handle hash symbol in footnote url links
Michael Bach
2014-02-21 10:52:14 UTC
Permalink
Dear org-mode Devs and Users,

I am trying to export the following snippet

#+BEGIN_ORG
* LaTeX export of url with hash symbol

The Org mode export facilities can be used to export Org documents or
parts of Org documents to a variety of other formats.[fn:1]

* Footnotes

[fn:1] [[http://orgmode.org/org.html#Exporting]]
#+END_ORG

Now the exported .tex file contains the link as
: \footnote{\url{http://orgmode.org/org.html#Exporting}}

Which LaTeX does not like:
: Illegal parameter number in definition of \***@tempa

FWIW, there is a workaround for the percent symbol described on SO[1]
using `\urldef` - but this does not work with the hash symbol.

Is there another workaround/solution that works with org-mode?

[1] bit.ly/1cwYJaM
Vladimir Lomov
2014-02-21 11:14:08 UTC
Permalink
Hello,
Post by Michael Bach
Dear org-mode Devs and Users,
I am trying to export the following snippet
#+BEGIN_ORG
* LaTeX export of url with hash symbol
The Org mode export facilities can be used to export Org documents or
parts of Org documents to a variety of other formats.[fn:1]
* Footnotes
[fn:1] [[http://orgmode.org/org.html#Exporting]]
#+END_ORG
Now the exported .tex file contains the link as
: \footnote{\url{http://orgmode.org/org.html#Exporting}}
FWIW, there is a workaround for the percent symbol described on SO[1]
using `\urldef` - but this does not work with the hash symbol.
Is there another workaround/solution that works with org-mode?
Hash (#), as well as several other symbols have to be espaced when used
as is in LaTeX documents. See, for example, "The Not So Short
Introduction to LaTeX2e", 1.3.2 Special Characters. In general it is
duty of ox-latex (LaTeX export backend) to espace such characters.
Post by Michael Bach
[1] bit.ly/1cwYJaM
---
WBR, Vladimir Lomov
--
God grant us the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.
Michael Bach
2014-02-21 12:57:51 UTC
Permalink
Hello Vladimir,
Post by Vladimir Lomov
Hello,
Post by Michael Bach
Dear org-mode Devs and Users,
I am trying to export the following snippet
#+BEGIN_ORG
* LaTeX export of url with hash symbol
The Org mode export facilities can be used to export Org documents or
parts of Org documents to a variety of other formats.[fn:1]
* Footnotes
[fn:1] [[http://orgmode.org/org.html#Exporting]]
#+END_ORG
Now the exported .tex file contains the link as
: \footnote{\url{http://orgmode.org/org.html#Exporting}}
FWIW, there is a workaround for the percent symbol described on SO[1]
using `\urldef` - but this does not work with the hash symbol.
Is there another workaround/solution that works with org-mode?
Hash (#), as well as several other symbols have to be espaced when used
as is in LaTeX documents. See, for example, "The Not So Short
Introduction to LaTeX2e", 1.3.2 Special Characters. In general it is
duty of ox-latex (LaTeX export backend) to espace such characters.
Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.

I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
Nicolas Goaziou
2014-02-26 14:11:42 UTC
Permalink
Hello,
Post by Michael Bach
Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.
I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
Bastien
2014-03-21 08:39:34 UTC
Permalink
Hi Nicolas,
This needs to be properly defined.
Where protecting characters in verbatim parts of the buffer should
happen? Within footnotes only? In every verbatim part? And on which
characters?
AFAIK in footnotes only, for the # ^ ! & characters (% is already
escaped.)

But I'm not sure we should fix this at Org's level: there is the
bigfoot package* that is fixes it, it seems a common LaTeX problem
and solution:

* http://www.ctan.org/tex-archive/macros/latex/contrib/bigfoot/
--
Bastien
Michael Bach
2014-04-10 17:25:16 UTC
Permalink
Post by Vladimir Lomov
Hello,
Post by Michael Bach
Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.
I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
Michael Bach
2014-04-10 17:25:16 UTC
Permalink
Post by Vladimir Lomov
Hello,
Post by Michael Bach
Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.
I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
Michael Bach
2014-02-21 12:57:51 UTC
Permalink
Hello Vladimir,
Post by Vladimir Lomov
Hello,
Post by Michael Bach
Dear org-mode Devs and Users,
I am trying to export the following snippet
#+BEGIN_ORG
* LaTeX export of url with hash symbol
The Org mode export facilities can be used to export Org documents or
parts of Org documents to a variety of other formats.[fn:1]
* Footnotes
[fn:1] [[http://orgmode.org/org.html#Exporting]]
#+END_ORG
Now the exported .tex file contains the link as
: \footnote{\url{http://orgmode.org/org.html#Exporting}}
FWIW, there is a workaround for the percent symbol described on SO[1]
using `\urldef` - but this does not work with the hash symbol.
Is there another workaround/solution that works with org-mode?
Hash (#), as well as several other symbols have to be espaced when used
as is in LaTeX documents. See, for example, "The Not So Short
Introduction to LaTeX2e", 1.3.2 Special Characters. In general it is
duty of ox-latex (LaTeX export backend) to espace such characters.
Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.

I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
Loading...