I have the following table in my quarto document and I would like to reference it automatically in my text.
Quarto understands that this is my second table and is able to name it Table 2 in the caption but I can't find a way to reference this table automatically in my text.
I have this line in my YAML to make the table work.
---
format: pdf
header-includes:
- \usepackage{multirow}
---
```{=latex}
\begin{table}[]
\caption{Summary of the different variabilities when comparing marks from same or different tools and zones}
\label{Variabilities}
\begin{center}
\begin{tabular}{ll|cc|}
\cline{3-4}
& & \multicolumn{2}{c|}{\textbf{Tool}} \\ \cline{3-4}
& & \multicolumn{1}{l|}{\textit{Same}} & \multicolumn{1}{l|}{\textit{Different}} \\ \hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Zone}}} & \textit{Same} & \multicolumn{1}{c|}{W} & B \\ \cline{2-4}
\multicolumn{1}{|c|}{} & \textit{Different} & \multicolumn{1}{c|}{B} & B \\ \hline
\end{tabular}
\end{center}
\end{table}
```
If anyone knows how to give this table a label that I can call in the text for referencing.
HERE IS THE ANSWER TO THIS
Two more lines have to be introduced to the YAML in order to use the package cleveref
---
format: pdf
header-includes:
- \usepackage{multirow}
- \usepackage{hyperref}
- \usepackage[capitalise,noabbrev]{cleveref}
---
The way the table is written does not change. To reference the table in the text as "Table X", you have to write
\ref{Variabilities}
(because I have \label{Variabilities}
in my table).
Thanks @samcarter_is_at_topanswers.xyz for your help