0

I'm writing a paper for one of my classes that requires me to include some graphs. I've been able to include the desired graphs without too much trouble, and I've been able to center them and size them the way I want without too much trouble either. The part that I can't figure out is how to add a description to each figure, preferably at the bottom of each one. I realize that the code is probably a mess overall and that there are probably much easier ways to do it, but I'm still very new at Latex and I basically have to look up how to do each step. If anyone could let me know how to add a caption to the bottom of each graphic and what package or packages I need to use to do that, it would be much appreciated. The code for the graphics is included below.

\begin{center}
\includegraphics[scale=.17]{First5CatalanNumbers.png}
\hspace{1.3cm}
\includegraphics[scale=.17]{First10CatalanNumbers.png}
\end{center}

\vspace{1cm}

\begin{center}
\includegraphics[scale=.17]{First15CatalanNumbers.png}
\hspace{1.3cm}
\includegraphics[scale=.17]{First20CatalanNumbers.png}
\end{center}

\vspace{1cm}

\begin{center}
\includegraphics[scale=.17]{First25CatalanNumbers.png}
\hspace{1.3cm}
\includegraphics[scale=.17]{First30CatalanNumbers.png}
\end{center}
2

If figure is used instead of center, then one simply can use \caption:

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\caption{heading}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\caption{heading}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\caption{heading}
\end{figure}


\end{document}

Alternatively the caption package and \captionof{}{}:

\documentclass{article}

\usepackage{caption}
\usepackage{graphicx}

\begin{document}

\begin{center}
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{center}

\vspace{1cm}

\begin{center}
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{center}

\vspace{1cm}

\begin{center}
\includegraphics[scale=.17]{example-image}
\hspace{1.3cm}
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{center}


\end{document}

Each image with its own caption:

\documentclass{article}

\usepackage{caption}
\usepackage{graphicx}

\begin{document}

\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}
\hfill
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}

\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}
\hfill
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}

\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}
\hfill
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[scale=.17]{example-image}
\captionof{figure}{heading}
\end{minipage}

\end{document}
  • This will let me do one caption for each set of two images that I have. Worst case scenario I can make this work. But how do I add a caption for each image, for 6 total, but still keep the layout of the images the same. In other words, I like the way that the graphs are spaced and set up, I just want to add a caption to each one individually. Thanks. – Alex Adinolfi Apr 11 at 20:38
  • @AlexAdinolfi Only seconds ago I wrote an answer how to place two things besides each other: tex.stackexchange.com/a/484408/185617 If you place each image in a separate minipage you can have a \captionof for each of them – user185617 Apr 11 at 20:40
  • @AlexAdinolfi See edited answer – user185617 Apr 11 at 20:44
  • Fantastic! Thank you very much, this solves the problem! – Alex Adinolfi Apr 11 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.