如果我使用的代码这线程它将看起来像图片中那样。我拥有的用户包是 \usepackage{subcaption} \usepackage{subfig} \usepackage{subfigure}
答案1
subcaption
此示例使用了两个并排上图的包。
要使用图片进行测试,请将它们放在与文档相同的目录中.tex
。稍后您可以通过添加路径将它们移动到另一个目录。
\documentclass[12pt,a4paper]{article}
\usepackage{subcaption} % added <<<<<<<<<<<<<<<<
\usepackage{graphicx}
\begin{document}
\begin{figure}[ht!] % with two subfigures included
\begin{subfigure}[t]{.40\textwidth}
\centering
% first image
\includegraphics[width=\textwidth, keepaspectratio]{example-image-a} % <<< image name 1
\caption{Lorem ipsum}
\label{fig:Lorem}
\end{subfigure}\hfill
\begin{subfigure}[t]{.40\textwidth}
\centering
% second image
\includegraphics[width=\textwidth, keepaspectratio]{example-image-b} % <<< image name 2
\caption{Lorem ipsum, Lorem ipsum, Lorem ipsum, Lorem ipsum, Lorem ipsum}
\label{fig:ipsum}
\end{subfigure}
\caption{Caption place holder}
\end{figure}
\begin{figure}[ht!] % a single figure
\centering
\includegraphics[width=0.5\textwidth, keepaspectratio]{example-grid-100x100pt} %
\caption{Single figure named example-grid-100x100pt}
\label{fig:gris}
\end{figure}
\end{document}