Open andrewheiss opened 7 months ago
Thanks for the report! Before I dig in: can you make sure your screenshots match your markdown? I'm seeing some repeated 1234
s in the markdown but not in the image.
Yep, just fixed it—copied/pasted the wrong thing 😬
lmao this is "fun".
So here's how this feature works. We detect the presence of \QuartoMarkdown64{...}
inside a latex rawblock, and then create placeholder markdown blocks outside of the rawblock. We do this because that markdown content needs to be visible to our filters to do things like crossref processing (which works!) Then, right before we send the final document to Pandoc for writing, we call pandoc.write(block, "latex")
on the individual blocks, and inject them back into the latex RawBlock in the correct places.
Unfortunately, citations are not processed by Quarto in Lua filters; they're processed by Pandoc's citeproc functionality. That means that if we call pandoc.write(block, "latex")
in the markdown block, that will happen before citeproc.
At the same time, we can't call citeproc more than once, because citation numbering needs to be consistent (and potentially consistently ordered in the document 😬).
This is going to be a bit of a nightmare to fix, I'm sorry to say. I'm going to have to let this simmer in my head for a bit before coming up with a plan.
Bug description
This is related to https://github.com/quarto-dev/quarto-cli/issues/3340 and including citation keys in tables (manual ones and ones made with things like {gt})
{gt} recently added
fmt_markdown()
, which injects<span data-qmd="blah"></span>
stuff around citations and cross references in HTML output, so that Quarto correctly processes the citations and cross references.In https://github.com/quarto-dev/quarto-cli/pull/7451, Quarto added a similar feature for LaTeX output, adding a
\QuartoMarkdownBase64{}
command for processing/protecting citations and cross references.\QuartoMarkdownBase64{}
works for cross references, but not for citations.Steps to reproduce
With this document:
…and this PDF:
The
@Lovelace1842
citation key is unprocessed, while the@eq-math
cross reference is converted to the correct LaTeX.Expected behavior
I was hoping that the
@Lovelace1842
citation key in the table would get converted to a bibliographic reference and be processed by citeproc, but it looks like citation processing is happening at a different stage in the Quarto pipeline?Actual behavior
The
@Lovelace1842
citation key is unprocessed, while the@eq-math
cross reference is converted to the correct LaTeX.Your environment
Quarto check output