Replies: 4 comments 5 replies
-
You need to tell that the cell is a markdown cell ( This is documented in: |
Beta Was this translation helpful? Give feedback.
-
@mnneely Would you be willing to provide us with the source code for your chapter? It would make it easier for us to understand your workflow. You can also reach out to me in private if you would prefer that. |
Beta Was this translation helpful? Give feedback.
-
I think this could be useful so sharing here. I have just added recently (so available in current dev version) some functions in quarto R 📦 to help use Markdown content in raw HTML produced by tools like See vignette with some documentation: https://quarto-dev.github.io/quarto-r/articles/markdown-html-tables.html
In the vignette, I also show the package support for Quarto HTML table processing. Some tools, like gt or **tiny table **, support using citations in Markdown directly in the table. Please do give a read to the vignette, and share feedback at https://github.com/quarto-dev/quarto-r for anything that should be clarified. Quarto has support for Markdown in HTML table, but it requires some specific handling. The R function See example in the vignette. Release of the R package is soon to be, so giving it a try now insure I did not miss anything, and should cover your use case. Example---
title: "Citations in tables"
format: html
keep-md: true
references:
- type: article-journal
id: Lovelace1842
author:
- family: Lovelace
given: Augusta Ada
issued:
date-parts:
- - 1842
title: >-
Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea,
officer of the military engineers, with notes upon the memoir by the translator
title-short: Molecular structure of nucleic acids
container-title: Taylor’s Scientific Memoirs
volume: 3
page: 666-731
language: en-GB
---
## Table with Citation
```{r}
tibble::tribble(
~Thing, ~Citation,
1234, quarto::tbl_qmd_span("@Lovelace1842")
) |>
knitr::kable(format = "html", escape = FALSE)
``` |
Beta Was this translation helpful? Give feedback.
-
Thanks, I think this might do the trick. I realized after I posted that changing However, if I understand, the new version would require all the citations in the source (in my case Excel table) to be embedded in tbl_qmd_span(). While feasible, it is an extra step, and how would it handle [@ref1; @ref2] for example tbl_qmd_span("[@ref1; @ref2]")? I think it would be easier if Quarto could recognize and process citations in html. My work flow for this chapter was: --- title: "Chapter" format: docx bibliography: my.bib csl: my.csl --- ```{r} df <- read_excel ("data.xlsx") kable(df) ``` Inside the data.xlsx file, I had a cell with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I just converted a large book chapter formerly in Word to Quarto because the publisher keeps destroying my Zotero citations with each revision, and I’m weary of re-doing almost 500 citations each time. It was a learning curve to say the least, but I did it.
One of my main problems is that I have dozens of tables in the chapter, most with citations in table cells of the form [@…], which are linked to a .bib file. These tables are in Excel, and I include them in the .qmd with R code to read from the Excel file, and generate a table with
kable
. Defining them directly in markdown is out of the question due to the number and size of them.I can read them and Quarto will render the citations with
kable
, but because of the citations, I cannot process the table in any way withkableExtra
,gt
,flextable
, or any other such tool. I learned thatkable
outputs markdown text which the Quarto engine can render to include the citations properly. However piping the output ofkable
to any of the other functions generates HTML output which will not render the citations. This leaves me with only the most basic formatted tables.Can there be a solution to this? Can
kable
have an option to render the citations if a .bib is supplied so the output text can be parsed into formatted HTML in the usual fashion? This would be a pre-processing step prior to the full rendering of the document.By the way, I tried the Word custom-reference-doc.docx option, and it didn’t work;
kable
outputs all tables in compact style, so there is no way I could find to style table rows (e.g. headers) differently than table body cells. Modifying the sample table in the reference doc to have a different header style was ignored.Beta Was this translation helpful? Give feedback.
All reactions