如何为图形添加标题或说明

如何为图形添加标题或说明

我正在为我的其中一门课程写一篇论文,论文要求我添加一些图表。我能够毫不费力地添加所需的图表,并且能够毫不费力地将它们居中并按我想要的方式调整大小。我无法弄清楚的部分是如何为每个图添加描述,最好是在每个图的底部。我意识到代码可能总体上很乱,可能有更简单的方法可以做到这一点,但我对 Latex 还很陌生,我基本上必须查找如何执行每个步骤。如果有人能告诉我如何在每个图形的底部添加标题以及我需要使用哪个或哪些包来执行此操作,我将不胜感激。图形的代码包含在下面。

\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}

答案1

如果figure使用 代替center,那么只需使用\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}

或者caption包和\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}

每张图片都有自己的标题:

\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}

相关内容