此命令是否可以为表格单元格中的 3 幅图像设置标题?对于一幅图像怎么办?
\documentclass[11pt,fleqn]{book}
%\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{capt-of}
\usepackage{caption}
\graphicspath{{./Pictures/}}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
pic1&pic2&pic3\\
\hline
\includegraphics[scale=.2]{first.pdf}
%\captionof{figure}{ 1}
&\includegraphics[scale=.2]{second.pdf}
%\captionof{figure}{ 2}
&\includegraphics[scale=.2]{third.pdf}\\
\hline
%\captionof{figure}{ 3}
\end{tabular}
\end{document}
答案1
好吧,让我们尝试使用 MWE 代码执行相同的操作:
\documentclass[11pt,fleqn]{book}
%\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{capt-of}
\usepackage{caption}
\graphicspath{{./Pictures/}}
\begin{document}
\begin{figure}[htb]
\centering % A TeX command that is equivalent to the center environment but needs less memory. Ideal when you need to insert a lot of figures in a document.
\subfloat{
\includegraphics[scale=.2]{first.pdf}
}
\subfloat{
\includegraphics[scale=.2]{second.pdf}
}
\subfloat{
\includegraphics[scale=.2]{third.pdf}
}
\caption{General caption of the figure}
\label{fig:examples}
\end{figure}
\end{document}
我使用subfigure
下面的包加拿大运输安全局被认为已经过时了。但是使用该包可以很容易地完成您想要的操作:
\documentclass[11pt,fleqn]{book}
%\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{capt-of}
\usepackage{caption}
\graphicspath{{./Pictures/}}
\begin{document}
\begin{figure}[htb]
\centering % A TeX command that is equivalent to the center environment but needs less memory. Ideal when you need to insert a lot of figures in a document.
\subfigure[caption 1]{\includegraphics[scale=.2]{first.pdf}}
\subfigure[caption 2]{\includegraphics[scale=.2]{second.pdf}}
\subfigure[caption 2]{\includegraphics[scale=.2]{third.pdf}}
\caption{General caption of the figure}
\label{fig:examples}
\end{figure}
\end{document}
检查这两个选项,并请阅读这些包的文档。我希望这会很有用。