pbs-assess / csasdown

:book: An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Other
47 stars 17 forks source link

Cross-references in caption for landscape table #235

Open SOLV-Code opened 1 year ago

SOLV-Code commented 1 year ago

I was able to convert a regular table to a landscape table following the steps from your wiki page. However, that broke cross-references like Table \@ref(tab:TableAltApproaches) that I had in the caption, in two ways:

Adding a second \ fixed the cross-reference, but the line break is still there. Adding a third \ crashes the knit.

This may be the same underlying problem encountered in #225 where I was trying to put cross-references inside a csas_table()

I can generate a minimum working example, if needed

SOLV-Code commented 1 year ago

Never mind. The trick is to put the caption specification before starting the landscapepage environment. Leaving this up in case it warrants putting a note on the wiki page before closing the issue.

This works:


\clearpage

(ref:TableSummary) Caption with some cross-references 
like  Table \@ref(tab:TableAltApproaches))  and Appendix \@ref(AggregationAppendix).

\begin{landscapepage}

```{r TableSummary, echo = FALSE, results = "asis"}

TABLE CODE HERE