-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Float objects not rendered in PDF after a longtable object #8711
Comments
This is even stranger. The mere declaration of the custom crossref format is enough to break longtables. |
There appears to be some deep incompatibility between the I am fairly convinced that this is a bug in |
Thanks for taking a look @cscheid. I guess I'll have to find a workaround to not use |
Specifically, this is the definition in our custom float declaration that causes
This line defines the custom float counter to be top-level if no chapter counter exists, or defines the custom float counter to be a subcounter of Here's a minimal, pure-latex example:
This is, to be clear, a huge bummer. We'll work around it on our side to never emit longtables in the presence of custom crossref environments (kable emits markdown tables which we can process differently). |
Hi @cscheid, thank you and I see the fix in #8714. However, it seems that ---
title: "Untitled"
format:
pdf:
keep-tex: true
crossref:
custom:
- kind: float
key: out
latex-env: output
reference-prefix: Output
caption-location: top
---
```{r}
#| label: tbl-1
#| tbl-cap: Table caption
knitr::kable(mtcars)
```
See @tbl-1.
::: {#out-2}
```{r}
#| echo: false
## Example from stats::aov()
aov(yield ~ block + N * P + K, npk)
```
Sample ANOVA output
:::
See @out-2 Would it be possible to use |
That should already be happening (so if it isn't, it's a bug on us). |
I can't get your document to render because kable seemingly fails for me with a knitr error message:
I don't know when kable decides to emit html tables vs markdown, but it seems that you're running a different version than I am (I'm on knitr 1.45). @cderv will know more, but he's not available in the next few days. |
That's odd. I'm also on
Render is fine without
|
This comment has been minimized.
This comment has been minimized.
I don't understand why knitr does that, tbqh. But I can repro your issue by switching to our div syntax. |
Thanks for making another fix @cscheid, and I feel bad for making another report on the same issue . . . but here it is, for regular markdown tables: ---
title: "Untitled"
format:
pdf:
keep-tex: true
crossref:
custom:
- kind: float
key: out
latex-env: output
reference-prefix: Output
---
| Default | Left | Right | Center |
|---------|:-----|------:|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
: Demonstration of pipe table syntax
::: {#out-2}
```{r}
#| echo: false
## Example from stats::aov()
aov(yield ~ block + N * P + K, npk)
```
Sample ANOVA output
:::
See @out-2
The tex file now has the caption outside of the |
Thank you for the continued reports! We're the one to be apologizing. We'll look at this right away. |
So this is tricky. What's happening here is that we can't emit When the So now we have to decide what to do when we see a Table outside of a float with a caption, which needs to be rendered with One solution is to wrap the code in a Another solution is for us to create a "hidden" float environment for these unlabeled tables, and configure its captions to not show any counter information. That is closer to what Quarto does in HTML, but will probably confuse users expecting the old behavior. |
Hi @cscheid, I just found out that if I don't call the new latex environment as ---
title: "Untitled"
format:
pdf:
keep-tex: true
crossref:
custom:
- kind: float
key: out
latex-env: abc
reference-prefix: Output
---
```{r}
#| label: tbl-1
#| tbl-cap: Table caption
knitr::kable(mtcars)
```
See @tbl-1.
::: {#out-2}
```{r}
#| echo: false
## Example from stats::aov()
aov(yield ~ block + N * P + K, npk)
```
Sample ANOVA output
:::
See @out-2 So maybe it's just because of the name I chose? |
The example you shared also works with "output" (it was fixed, for instance your original example works on the latest version of Quarto), but #8711 (comment) won't work whatever the name of The issue is not as simple as a name thing. |
Sorry I should have clarified: the original example works with the current release of quarto 1.4 or 1.5, before fixing the longtable issue in #8714, once I changed \documentclass{article}
\usepackage{float}
\newfloat{abc}{h}{loout} % <--- use a different name than "output"
\usepackage{longtable,booktabs,array}
\usepackage{calc}
\begin{document}
\begin{longtable}[]{@{}l@{}}
\toprule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
foo \\
\end{longtable}
\end{document} |
I'll daringly call this fixed now, but please let us know if it rears its head again! |
Bug description
When making a table with
knitr::kable()
in R, which gives a longtable object with PDF output, a custom float object in the same document does not work. This has been tested with quarto 1.4.549 and 1.5.10. The custom float object is rendered properly without the longtable object. This may be related to #7604Steps to reproduce
Expected behavior
The custom float object should be shown.
Actual behavior
I got the error
Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: