Skip to content
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

Quarto Table Reference Workaround Not Working in Quarto 1.5 #254

Closed
reuning opened this issue Jun 18, 2024 · 8 comments
Closed

Quarto Table Reference Workaround Not Working in Quarto 1.5 #254

reuning opened this issue Jun 18, 2024 · 8 comments

Comments

@reuning
Copy link
Contributor

reuning commented Jun 18, 2024

Describe the bug

The workaround to referencing tables in Quarto does not seem to work with Quarto 1.5 (the current release candidate). It appears that Quarto just swallows the \label() in its entirety. I installed Quarto 1.4 and the workaround still works in that case. I wasn't sure if I should post this as a reply to #224 or not so hopefully this is alright.

I tried a few different combinations to get it to work including adding \\label{} into the set_caption() but nothing seemed to get it to work. I'll just switch back to Quarto 1.4 for now.

Minimal Reproducible Example

---
title: Test
format: 
    pdf:
        keep-tex: true
---

A reference to Table \ref{tab:jams}.

```{r}
library(huxtable)
label(jams) <- "tab:jams"
caption(jams) <- "Some jams"
jams
```

The relevant tex file generated from Quarto 1.5.41:

\begin{table}[ht]
\begin{centerbox}
\begin{threeparttable}
\captionsetup{justification=centering,singlelinecheck=off}
\caption{Some jams}
 
\setlength{\tabcolsep}{0pt}
\begin{tabular}{l l}

The relevant tex file generated from Quarto 1.4.555:

\begin{table}[ht]
\begin{centerbox}
\begin{threeparttable}
\captionsetup{justification=centering,singlelinecheck=off}
\caption{Some jams}
 \label{tab:jams}
\setlength{\tabcolsep}{0pt}
\begin{tabular}{l l}

System details

> R.version
               _                           
platform       aarch64-apple-darwin20      
arch           aarch64                     
os             darwin20                    
system         aarch64, darwin20           
status                                     
major          4                           
minor          3.2                         
year           2023                        
month          10                          
day            31                          
svn rev        85441                       
language       R                           
version.string R version 4.3.2 (2023-10-31)
nickname       Eye Holes                   
> packageVersion("huxtable")
[1] ‘5.5.6’
@hughjonesd
Copy link
Owner

hughjonesd commented Jun 18, 2024

Thanks for the report.

@hughjonesd
Copy link
Owner

See also quarto-dev/quarto-cli#8564 (comment). This is probably a bug in quarto-cli, I think their goal is not to eat labels unless they contain a hyphen. So it may get fixed. If not, there may indeed be no way to use labels with TeX tables in quarto.

@reuning
Copy link
Contributor Author

reuning commented Jun 18, 2024

Thanks for the quick response. Hopefully they are able to fix this in the Quarto CLI.

@hughjonesd
Copy link
Owner

could you try github master and see if it indeed fixes this problem?

@reuning
Copy link
Contributor Author

reuning commented Jun 25, 2024

Sorry for the slow reply here, I wanted to get back to my Mac in my office to try and was away from the office for a few days.

It does work now, though with the caveat that I had to install the quarto R package. Based on your comment you already knew this was a risk. I use VS Code and installed quarto directly. It might be worth noting this somewhere in the FAQ.

@reuning
Copy link
Contributor Author

reuning commented Jun 25, 2024

One other thing, I'm not sure if it is on purpose or not but currently you do not have quietly=TRUE in the check for the quarto package:

if (! requireNamespace("quarto")) return(FALSE)

This was helpful for me as it flagged that I didn't have the quarto package installed and I installed it. For those not using Quarto it might be annoying. I'm not sure when this gets called though but wanted to flag it for you.

@hughjonesd
Copy link
Owner

Thanks for this point. Fixed in master.

@reuning
Copy link
Contributor Author

reuning commented Jun 25, 2024

FYI your "try harder to find quarto" worked for me without the Quarto R package installed. Thanks for making and maintaining huxtable and for being so quick at it all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants