pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
600 stars 165 forks source link

Unable to crossref when using short-captions filter #265

Closed Minh-AnhHuynh closed 1 year ago

Minh-AnhHuynh commented 1 year ago

Hello,

Using quarto, I am unable to crossref using regular citation syntax, with short-captions.lua pandoc filter. Figures without the short caption filter can be crossreferenced but not with that filter. I am forced to use the latex alternative which is less practical for another reason.

I am not sure if the problem comes from quarto or this filter.

![**Bold caption** [@Armas.2004]](figure.jpeg){#fig-cap short-caption="**short-cap**"}

@fig-cap

This returns ?@fig-cap

Anything that is not @fig- breaks as quarto expects a bibliography citation instead. See (fig:test<empty citation>).

\ref{fig-cap} works.

tarleb commented 1 year ago

Just to confirm: did I understand correctly that this works without the short-captions filter, but fails if the filter is invoked? Also, could you post a minimal qmd file? That'd make it easier for us to investigate the issue.

Minh-AnhHuynh commented 1 year ago

short-captions-test.zip

Yes that is right, when the filter is used, the crossref attached to the filter fails. Here is a minimal reproductible example, using RStudio to render the quarto file to a pdf format.

tarleb commented 1 year ago

Thank you for the excellent example. It seems that Quarto and this filter are just incompatible. As far as I can see this cannot be fixed here.

I suggest to raise this with the Quarto team at https://github.com/quarto-dev/quarto-cli. It will be much easier to support this when Quarto switches from pandoc 2.19 to pandoc 3.x.

cscheid commented 1 year ago

For other quarto folks looking at this. In quarto, you don't need to use short-captions.lua. Instead, you use the fig-scap attribute directly in the figure:

![This is the long R logo caption.](R_logo.png){#fig-R-short-cap fig-scap="R logo"}