I am trying to cross-ref figures in text with code like "Figure \ref{Fig. 1.1}
". At the end of my document, I have the following:
\section{Figures}
\begin{figure}[!ht]
\centering
\includegraphics[scale=.6]{figures/Miech2021.png}
\textbf{\caption{Prevalence of nicotine vaping among US $10\textsuperscript{th}$- and $12\textsuperscript{th}$-grade students, by year in grades 10, and 12 from 2017-2020 (from Miech et al., 2021)}}
\label{Fig. 1.1}
\end{figure}
\begin{figure}[!ht]
\centering
\includegraphics[scale=.5]{figures/Miech2019cannabis.png}
\textbf{\caption{Trends in 30-day cannabis use prevalence in grades 8, 10, and 12 from 2015-2019 (from Miech et al., 2019: based on Table 5-5c)}}
\label{Fig. 1.2}
\end{figure}
\begin{figure}[!ht]
\centering
\includegraphics[scale=.7]{figures/Miech2019cigarettes.png}
\textbf{\caption{Trends in 30-day prevalence in grades 8, 10, and 12 from 1975-2019 (from Miech et al., 2019: Figure 5-4q CIGARETTES)}}
\label{Fig. 1.3}
\end{figure}
The in-text cross-ref reads "Figure 1.3". Any idea why when I reference Fig 1.1, the in text says "Figure 1.3"?
Best Answer
As David Carlisle indicated in the comments, you shouldn't include
\caption
inside\textbf{…}
(in this case, it is likely that you get your reference to the section 1.3, and not to the figure, because\caption
inside a group fails to define the reference for a\label
outside of that group).I suggest using
\bfseries
instead: