You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pandoc 3.1.6.2 fails conversion to Beamer if URLs contain '#' #9014
$ pandoc -v
pandoc 3.1.6.2
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /usr/local/share/pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ pdflatex -version
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)
kpathsea version 6.3.4/dev
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03
* LaTeX writer:
+ Improve escaping of URIs in href, url (#8992).
+ Improve internal links and targets (#8744). We no longer
wrap section headings in a `\hypertarget`. This is unnecessary
(hyperref creates an anchor based on the label) and it interferes with
tagging. In addition, we now use `\hyperref` rather than `\hyperlink`
for internal links. Currently `\hypertarget` is still being used for
link anchors not on headings. Thanks to @u-fischer.
Apparently, in general # does not need to be backslash-escaped in a URL in \href, but something special is going on when it's in a frame environment, so this breaks with beamer. I think the simplest fix is to restore backslash-escaping of # in a URL, which seems harmless. Maybe @u-fischer has further insight.
frame is a rather special environment that works like a command with argument. That means it can't contain verbatim or verbatim-like material. Either escape problematic chars in the url (# and %, the rest should normally not be a problem) or use the fragile keyword:
What I get from this is that fragile might interact badly with noframebreaks, and that it might increase compile time, but otherwise it's fairly harmless.
FWIW Just sharing as I found this issue with 3.1.6.2 too, using a link inside a caption.
With hyperref package, there is special because \href is used inside \caption in that case.
About \href[options]{URL}{text} in the hyperref manual:
The text is made a hyperlink to the URL; this must be a full URL (relative to the base URL, if that is defined). The special characters # and % do not need to be escaped in any way (unless the command is used in the argument of another command). The optional argument options recognizes the hyperref
So # and % still needs to be escaped under some conditions.
Example
---title: "Example"---
See [Quarto guide](https://quarto.org/docs/authoring/markdown-basics.html#text-formatting)](https://quarto.org/quarto.png)
Rendering to PDF will fail with 3.1.6.2
First link will be ok, even with # not escaped
Second link is making build fail - # needs to be escaped because inside caption
To be clear, using latest nighlty, it works. Just sharing related to d21a9cd message. It is not just a matter of adding fragile to slide on beamer as it happens also with non-beamer.
Activity
jgm commentedon Aug 23, 2023
This must have to do with one of these changes:
jgm commentedon Aug 23, 2023
OK, the difference is that in 3.1.6.1 we got
while in 3.1.6.2 we get
The
#is no longer backslash-escaped.This is due to commit cbb33fe
jgm commentedon Aug 23, 2023
Apparently, in general
#does not need to be backslash-escaped in a URL in\href, but something special is going on when it's in aframeenvironment, so this breaks with beamer. I think the simplest fix is to restore backslash-escaping of#in a URL, which seems harmless. Maybe @u-fischer has further insight.u-fischer commentedon Aug 23, 2023
frame is a rather special environment that works like a command with argument. That means it can't contain verbatim or verbatim-like material. Either escape problematic chars in the url (
#and%, the rest should normally not be a problem) or use thefragilekeyword:jgm commentedon Aug 23, 2023
Adding
fragileseems like a nicer solution.Currently we add
fragilein the following cases:fragileWould there be any drawback to adding it always to slide environments?
jgm commentedon Aug 23, 2023
Discussion of drawbacks here: https://tex.stackexchange.com/questions/136240/drawbacks-of-using-fragile-frames-in-beamer
What I get from this is that fragile might interact badly with noframebreaks, and that it might increase compile time, but otherwise it's fairly harmless.
jgm commentedon Aug 24, 2023
Closoed for now by d21a9cd
cagix commentedon Aug 24, 2023
thx 👍
Pandoc: downgrading to 3.1.6.1 due to issues in URL handling in 3.1.6.2
Pandoc: downgrading to 3.1.6.1 due to issues in URL handling in 3.1.6…
cderv commentedon Aug 28, 2023
FWIW Just sharing as I found this issue with 3.1.6.2 too, using a link inside a caption.
With hyperref package, there is special because
\hrefis used inside\captionin that case.About
\href[options]{URL}{text}in the hyperref manual:So
#and%still needs to be escaped under some conditions.Example
Rendering to PDF will fail with 3.1.6.2
#not escaped#needs to be escaped because insidecaptionTo be clear, using latest nighlty, it works. Just sharing related to d21a9cd message. It is not just a matter of adding
fragileto slide on beamer as it happens also with non-beamer.LaTeX writer: backslash-escape # in URLs. Closes jgm#9014.