LaTeX Figures¶
Quick Links
Referencing Figures¶
The example below highlights how the \label
command is used to define a unique label to this specific figure and how it can be referenced within the text of the document using the \ref
command.
\begin{figure}[H]
\centering
\includegraphics[height=1in]{NASA_Logo}
\caption{Figure with Caption}
\label{fig:nasa-logo}
\end{figure}
The NASA logo can be seen in \ref{fig:nasa-logo}.
Also note how the "Figure" prefix is automatically added within the document text whenever the reference is called.
Referencing Sub-Figures¶
The example below highlights how the \ref
command operates exactly the same on subfigure
as it does on figure
environment.
\begin{figure}[H]
\begin{subfigure}[b]{0.5\textwidth}
\centering
\includegraphics[height=1in]{NASA_Logo}
\caption{NASA Logo}
\label{fig:nasa-logo}
\end{subfigure}%
\begin{subfigure}[b]{0.5\textwidth}
\centering
\includegraphics[height=1in]{Artemis_Logo}
\caption{Artemis Logo}
\label{fig:artemis-logo}
\end{subfigure}%
\caption{Sub-Figures with Sub-Captions}
\label{fig:nasa-and-artemis-logos}
\end{figure}
The logos used in this document can be found in \ref{fig:nasa-and-artemis-logos}.
\ref{fig:nasa-logo} displays the NASA logo and \ref{fig:artemis-logo} displays the Artemis logo.
Referencing Range of Figures¶
The example below highlights how the \refrange
command can be used to reference a range of figures.
\begin{minipage}[c]{0.33\textwidth}
\begin{figure}[H]
\centering
\includegraphics[height=1in]{NASA_Logo}
\caption{NASA Logo}
\label{fig:nasa-logo}
\end{figure}
\end{minipage}%
\begin{minipage}[c]{0.33\textwidth}
\begin{figure}[H]
\centering
\includegraphics[height=1in]{Artemis_Logo}
\caption{Artemis Logo}
\label{fig:artemis-logo}
\end{figure}
\end{minipage}
\begin{minipage}[c]{0.33\textwidth}
\begin{figure}[H]
\centering
\includegraphics[height=1in]{Orion_Logo}
\caption{Orion Logo}
\label{fig:orion-logo}
\end{figure}
\end{minipage}
\vspace{\baselineskip}
We can reference a range of figures as seen here: \refrange{fig:nasa-logo}{fig:orion-logo}.
Also note how the "Figures" prefix is automatically added within the document text whenever the range reference is called.