jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

{cite} in captions of markdown-figures

Open a7p opened this issue 3 years ago • 2 comments

Describe the bug

context When I cite something in a caption, e.g.

:::{figure-md} bla
<img src="./logo.png">

{cite}`holdgraf_evidence_2014`
:::

and try to build a pdf (--builder=pdflatex, xelatex flavored)

expectation I expected a rendered citation to occur.

bug But instead compilation stops. Here's an error message I ran into:

$ jb build --builder pdflatex  ./tmp/
...
! Undefined control sequence.
\hyper@@link ->\let \Hy@reserved@a
                                   \relax \@ifnextchar [{\hyper@link@ }{\hyp...
l.127 ...hyperlink{cite.markdown:id3}{HdHPK14}{]}}
                                                  \label{\detokenize{intro:b...

manually editing the latex-file and adding \protect before the \hyperlink statement as suggested in https://github.com/executablebooks/jupyter-book/issues/1584#issuecomment-1006752501 solves the issue.

Reproduce the bug

add

:::{figure-md} bla
<img src="./logo.png">

{cite}`holdgraf_evidence_2014`
:::

to the example-files and run

jb build --builder pdflatex  ./

List your environment

$ jb --version
Jupyter Book      : 0.12.1
External ToC      : 0.2.3
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.1
Sphinx Book Theme : 0.1.10
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.10

a7p avatar Jan 31 '22 11:01 a7p

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jan 31 '22 11:01 welcome[bot]

probably can be closed as a duplicate #1584 (and #1710)... work-around in https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/276 :)

casperdcl avatar Oct 07 '23 21:10 casperdcl