Closed leonardblaschek closed 8 months ago
Note: I don't think that this is likely to be manuscript specific.
Note: I don't think that this is likely to be manuscript specific.
I hadn't tried that before, but you're right. Removing the _quarto.yaml
file and specifying format: pdf
in the header yields a rendered pdf with the same bug.
Thanks, I can repro this. I'm unfortunately not quite sure how to solve it.
Immediately, the issue is that inside LaTeX table floats, we need to render the table to LaTeX during the Lua processing in order to be able to control the rendering (such as, for example, adapting the caption location). However, if we do render the table to LaTeX, we don't process citations properly.
In the "This works:" example, the citation is being processed correctly by Pandoc because Quarto doesn't need to render the table in its filter processing (since it's not a float, there's no requirement for caption processing).
Yeah, that sounds unfortunate. I unfortunately don't think I have much to contribute, beyond some more details. I hadn't realised that it was the combination of caption and label that messed things up. Some more examples:
---
title: |
A reprex
author:
- name: Leonard Blaschek
bibliography: references.bib
---
### This works:
Testcitation [@marrero2019]
### This works:
```{r}
library(tidyverse)
library(knitr)
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
No label to reference
#| label: tbl-test
#| tbl-cap: Test
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
Referencing @tbl-test.
#| label: tbl-test-nocap
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
Referencing @tbl-test-nocap.
#| tbl-cap: Test
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
No label to reference
#| tbl-cap: Test\\label{tab:test-kable}
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
Referencing Table \ref{tab:test-kable}.
:::{#refs}
:::
![Screenshot_20240109_221551](https://github.com/quarto-dev/quarto-cli/assets/42772760/ea5c0211-e72c-4e37-b619-8d61d300c188)
I'll let you know if I come up with anything else. Thanks for your reply, and I you find a way to fix this. I'd think this was quite a crucial issue for those of us hoping to write their papers in quarto going forward.
I'd think this was quite a crucial issue for those of us hoping to write their papers in quarto going forward.
To be clear, we 100% will fix this at some point. It's just that there isn't an immediate fix.
Update: there is an immediate fix, it turns out. PR is up. Thanks for the report!
This is fixed on main
. We're building new installers right now.
Thanks for the quick fix! It works, but unfortunately only for tables with one row. At least for me. As far as I can tell, it's only the addition of more rows that causes this, but I might've missed something. I hope this reproduces for you.
---
title: |
A reprex
author:
- name: Leonard Blaschek
bibliography: references.bib
---
```{r}
library(tidyverse)
library(knitr)
#| label: tbl-locations
#| tbl-cap: Functional lignins in plants.
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]"
)
kable(test)
:::{#refs}
:::
![one_row](https://github.com/quarto-dev/quarto-cli/assets/42772760/ed4bd3f3-39f6-4cc4-a6ff-801539803b45)
````qmd
---
title: |
A reprex
author:
- name: Leonard Blaschek
bibliography: references.bib
---
```{r}
library(tidyverse)
library(knitr)
#| label: tbl-locations
#| tbl-cap: Functional lignins in plants.
test <- tribble(
~Text, ~Reference,
"Text", "[@marrero2019]",
"Text", "[@marrero2019]"
)
kable(test)
:::{#refs}
:::
![two_rows](https://github.com/quarto-dev/quarto-cli/assets/42772760/d6d0c55c-7dd3-4f87-a5b8-b5b0d7f30b46)
@leonardblaschek Which version of Quarto are you using exactly?
Because this seems heavily related to:
Ha, great!
I was using 1.5.8, and indeed both my reprex and my real world use-case are fixed in 1.5.9. I had missed that release. Thank you!
Bug description
References in a quarto manuscript don't resolve within in a knitr::kable() in the rendered PDF when there is a
#| tbl-cap
specified. HTML output and latex output without the caption works.I've found a bunch of seemingly related issues with tbl-cap, but most seemed to be resolved. I did not manage to get around this issue with any of the solutions/hacks I could find. Apologies if i missed something obvious.
Steps to reproduce
_quarto.yaml
(except for changingagu-pdf
topdf
, but different templates did not seem to make a difference) andreferences.bib
are from the example repo (https://github.com/quarto-ext/manuscript-template-rstudio)This does not work:
References {.unnumbered}
:::{#refs}
:::
Quarto 1.4.528 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.9: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.528 Path: /home/leonard/Applications/quarto/quarto-1.4.528/bin
[✓] Checking tools....................OK TinyTeX: v2023.12 Chromium: (not installed)
[✓] Checking LaTeX....................OK Using: TinyTex Path: /home/leonard/.TinyTeX/bin/x86_64-linux Version: 2023
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.11.5 (Conda) Path: /home/leonard/Applications/miniconda3/bin/python Jupyter: (None)
[✓] Checking R installation...........OK Version: 4.3.2 Path: /usr/lib64/R LibPaths:
[✓] Checking Knitr engine render......OK