Open jtchittenden opened 1 year ago
I did not notice Quarto is not producing the same reference than R Markdown and bookdown.
Cross-references are in the format "Table XX" with Quarto; with R Markdown they are in the format "XX".
I can generate "Table 1" as you are asking using bkm_all = TRUE
, but quarto will still add "Table " before. 'flextable' is not generating the prefix "Table"; it is generated by Quarto.
Hello @cscheid. Is it something that can be changed/defined/set for Quarto? I understood that there would be soon evolutions on this subject (captions+cross-references in the context of raw xml injection) but I don't know which line to follow. Do you have any advice or indications?
For example, Quarto inject/replace tables' captions when format are HTML and PDF, do you plan to do the same for Word format?
We are actively working on a way for libraries to communicate metadata (such as rich captions) directly to quarto, so that we can resolve crossrefs, etc, as well as make sure that the output is formatted properly. The plan is to make it so that (eg) flextable can detect it's running "in a quarto environment", in which case it doesn't need to know about the crossref style (which can be configured by quarto itself). Then, flextable wouldn't need produce a "decorated" caption with Table $ref: <caption>
. That decoration can be determined by quarto, and all that flextable would need is to communicate is the content of the caption (ideally directly in Markdown), and quarto would resolve that into the right place.
We hope to have a concrete implementation and preliminary documentation to share in about 3-4 weeks. Send me an email at carlos.scheidegger@posit.co? I'd love to meet with you directly to explain and make myself available to help you get a solid implementation going. We are optimistic about the simplicity of the resulting implementation based on our early experiments.
It really seems to fit what we need. Thank you very much for your answer, I will email you tomorrow, I'd love to chat and do a solid implementation!
@davidgohel any progress on this one?
@BMC1986 When there's progress, we will update the issue.
I'm trying to get around the quarto features for referencing Tables and Figures for docx outputs. When using flextables we have a custom function to apply formatting. In there we use set_caption and run_autonum to configure the desired bookmark. We're primarily targeting two main outcomes:
There's a Lua filter that runs before the quarto filter to intercept intext references and convert them to inline openxml references, which works fine.
The problem we noticed was that the flexible object was creating a bookmark on just the field code, not the pre-label, even though running to_wml.autonum showed otherwise. The issue was traced to caption_default_docx_openxml where this code ignores any existing autonum in the caption:
We were able to fix the function in the namespace (kluge for now) by checking for existing autonum:
We also noted that get_word_autonum always sets bkm_all to FALSE.
The above fix works for us, but a more user/quarto friendly option could be to allow tab.lp and tab.bmk_all to pass through to get_word_autonum.
PS: Thanks for this fantastic package!