* LaTeX export: Handle hash symbol in footnote url links @ 2014-02-21 10:52 Michael Bach 2014-02-21 11:14 ` Vladimir Lomov 0 siblings, 1 reply; 6+ messages in thread From: Michael Bach @ 2014-02-21 10:52 UTC (permalink / raw) To: emacs-orgmode 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 \Hy@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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: LaTeX export: Handle hash symbol in footnote url links 2014-02-21 10:52 LaTeX export: Handle hash symbol in footnote url links Michael Bach @ 2014-02-21 11:14 ` Vladimir Lomov 2014-02-21 12:57 ` Michael Bach 0 siblings, 1 reply; 6+ messages in thread From: Vladimir Lomov @ 2014-02-21 11:14 UTC (permalink / raw) To: emacs-orgmode Hello, ** Michael Bach [2014-02-21 11:52:14 +0100]: > 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 \Hy@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? 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. > [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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: LaTeX export: Handle hash symbol in footnote url links 2014-02-21 11:14 ` Vladimir Lomov @ 2014-02-21 12:57 ` Michael Bach 2014-02-26 14:11 ` Nicolas Goaziou 0 siblings, 1 reply; 6+ messages in thread From: Michael Bach @ 2014-02-21 12:57 UTC (permalink / raw) To: Vladimir Lomov, emacs-orgmode Hello Vladimir, On 21/02/2014 12:14, Vladimir Lomov wrote: > Hello, > ** Michael Bach [2014-02-21 11:52:14 +0100]: > >> 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 \Hy@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? > > 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. From a typographic point of view, I figured url links in footnotes are not that unusual. Best Regards, Michael >> [1] bit.ly/1cwYJaM > > --- > WBR, Vladimir Lomov > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: LaTeX export: Handle hash symbol in footnote url links 2014-02-21 12:57 ` Michael Bach @ 2014-02-26 14:11 ` Nicolas Goaziou 2014-03-21 8:39 ` Bastien 2014-04-10 17:25 ` Michael Bach 0 siblings, 2 replies; 6+ messages in thread From: Nicolas Goaziou @ 2014-02-26 14:11 UTC (permalink / raw) To: Michael Bach; +Cc: Vladimir Lomov, emacs-orgmode Hello, Michael Bach <phaebz@gmail.com> writes: > 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. > From a typographic point of view, I figured url links in footnotes are > not that unusual. 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? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: LaTeX export: Handle hash symbol in footnote url links 2014-02-26 14:11 ` Nicolas Goaziou @ 2014-03-21 8:39 ` Bastien 2014-04-10 17:25 ` Michael Bach 1 sibling, 0 replies; 6+ messages in thread From: Bastien @ 2014-03-21 8:39 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Vladimir Lomov, Michael Bach, emacs-orgmode Hi Nicolas, Nicolas Goaziou <n.goaziou@gmail.com> writes: > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: LaTeX export: Handle hash symbol in footnote url links 2014-02-26 14:11 ` Nicolas Goaziou 2014-03-21 8:39 ` Bastien @ 2014-04-10 17:25 ` Michael Bach 1 sibling, 0 replies; 6+ messages in thread From: Michael Bach @ 2014-04-10 17:25 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Vladimir Lomov, emacs-orgmode On 2/26/14 3:11 PM, Nicolas Goaziou wrote: > Hello, > > Michael Bach <phaebz@gmail.com> writes: > >> 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. >> From a typographic point of view, I figured url links in footnotes are >> not that unusual. > > 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? > Ok, using org-element, we could escape special symbols - for now, only '#', '%' and '&' come to mind - in http links iff they are inside a footnote and exporter backend is latex. As I said, if this is too special a case to be supported, I was playing around with regexps and `org-export-filter-final-output-functions' as seen e.g. in [1]. On other occasions that involved in-buffer replacements, I had success using group matching with the `re-search-forward', `replace-match' and `match-string' functions (see also [2]). But IIUC, since the export filter function gets passed a string with the .tex export results, I need a function that operates on a string such as `replace-regexp-in-string' as seen in [1]. Now I assume for in-string regexp replacement and the use case at hand I would need a (missing) lookbehind feature [3], don't I? Please let me know whether you think this is feasible. Best Regards, Michael [1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00146.html [2] http://stackoverflow.com/questions/6395898/emacs-how-do-i-replace-regexp-with-a-lisp-function-in-a-defun [3] http://comments.gmane.org/gmane.emacs.devel/147844 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-10 17:25 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-02-21 10:52 LaTeX export: Handle hash symbol in footnote url links Michael Bach 2014-02-21 11:14 ` Vladimir Lomov 2014-02-21 12:57 ` Michael Bach 2014-02-26 14:11 ` Nicolas Goaziou 2014-03-21 8:39 ` Bastien 2014-04-10 17:25 ` Michael Bach
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).