LaTeX Figures

Overview

Useful reference: Wiki Link.

Figure with Caption

\begin{figure}[H]
   \centering
   \includegraphics[height=1in]{UWL_Logo}
   \caption{Figure with Caption} 
   \label{fig:uwl-logo}
\end{figure}
../_images/one_figure_one_caption.png

Two Figures with Two Captions

Hint

Note that the actual figure environment logic in this example is no different than the simple single example shown above. We are simply utilizing the minipage environment in order to create temporary sections within our document to place images. In the example below, we create two minipage environments each occupying half the page as denoted by 0.5\textwidth. This same logic can be extended to any layout the user wants!

\begin{minipage}[c]{0.5\textwidth}
   \begin{figure}[H]
      \centering
      \includegraphics[height=1in]{UWL_Logo}
      \caption{UWL Logo} 
      \label{fig:uwl-logo}
   \end{figure}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
   \begin{figure}[H]
      \centering
      \includegraphics[height=1in]{Artemis_Logo}
      \caption{Artemis Logo} 
      \label{fig:artemis-logo}
   \end{figure}
\end{minipage}
../_images/two_figures_two_captions.png

Two Figures with One Caption

\begin{figure}[H]
   \centering
   \includegraphics[height=1in]{UWL_Logo}%
   \hspace{1in}% add some horizontal spacing
   \includegraphics[height=1in]{Artemis_Logo}%
   \caption{Two Figures with One Caption} 
   \label{fig:uwl-and-artemis-logo}
\end{figure}
../_images/two_figures_one_captions.png

Sub-Figures with Sub-Captions

\begin{figure}[H]
\begin{subfigure}[b]{0.5\textwidth}
   \centering 
   \includegraphics[height=1in]{UWL_Logo}
   \caption{UWL Logo} 
   \label{fig:uwl-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:uwl-and-artemis-logos}
\end{figure}
../_images/sub_figures_sub_captions.png

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]{UWL_Logo}
   \caption{Figure with Caption} 
   \label{fig:uwl-logo}
\end{figure}

The UWL logo can be seen in \ref{fig:uwl-logo}.
Also note how the "Figure" prefix is automatically added within the document text whenever the reference is called.
../_images/reference_figure.png

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]{UWL_Logo}
   \caption{UWL Logo} 
   \label{fig:uwl-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:uwl-and-artemis-logos}
\end{figure}

The logos used in this document can be found in \ref{fig:uwl-and-artemis-logos}. 
\ref{fig:uwl-logo} displays the UWL logo and \ref{fig:artemis-logo} displays the Artemis logo.
../_images/reference_subfigures.png

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]{UWL_Logo}
      \caption{UWL Logo} 
      \label{fig:uwl-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:uwl-logo}{fig:orion-logo}.
Also note how the "Figures" prefix is automatically added within the document text whenever the range reference is called.
../_images/reference_range_figures.png