fredguth / tufte-quarto

Tufte book layout for Quarto
https://fredguth.github.io/tufte-quarto/
38 stars 6 forks source link

Cross referencing for figures fails - wrongly labelled in HTML, rendering failure for PDF #3

Open steven-wooding opened 1 year ago

steven-wooding commented 1 year ago

I think this is a great template, really impressive. Unfortunately when I put figures in and attempt to reference them in the text it doesn't render right. If I put the following code into 'customising.qmd':

Some test type @fig-airquality

```{r}
#| label: fig-airquality
#| fig-cap: Air Quality first diagram

plot(c(1, 2, 3), c(1, 2, 1))

In the HTML file the figure has the caption "Some test type Figure fig-airquality" ie it isn't numbered; although the figure caption is correctly rendered as "Figure 3.1: Air Quality first diagram".

The PDF render fails with:

compilation failed- error
Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup 
                                                  \color@endbox 
l.514 \end{figure}

The index.log file contains this which might be relevant:

LaTeX Warning: Reference `fig-airquality' on page 7 undefined on input line 498.

File: 02-Main/customizing_files/figure-pdf/fig-airquality-1.pdf Graphic file (type pdf)
<use 02-Main/customizing_files/figure-pdf/fig-airquality-1.pdf>
! Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup 
                                                  \color@endbox 
l.514 \end{figure}

If you have any suggestions on what I'm doing wrong I'd be very grateful to hear them.

With thanks,

Steve

steven-wooding commented 1 year ago

Having investigated further by looking at the .tex file produced I think this is the first of the 'Known issues' you mention: "1. Tufte-book can't handle label inside caption." as the Latex produced that the renderer complains about is:

\caption{\label{fig-airquality}Air Quality first diagram}

I think this means this book template can't be used with auto numbering captions that come from the Quarto code.

fredguth commented 1 year ago

Thanks for figuring this out. I haven't been able to look this repo lately.

MitchellAcoustics commented 1 year ago

I've had a similar issue. It seems related to this thread on the StackExchange: https://tex.stackexchange.com/questions/87364/problem-with-tufte-book-and-subfigure

fredguth commented 3 months ago

This LaTeX class is beautiful but very difficult to understand. I have been using Typst lately. I hope I can provide a better experience there.