每次我都必须手动调整子图文本宽度(此处.95\textwidth
)的代码,但我想自动完成;您可以使用任何足够大的输入图像
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{.95\textwidth}
\adjustbox{trim=0 .45\height{} 0 0, clip, width=1\textwidth}
{\includegraphics[page=1]{{P100C1}.pdf}}
\caption{P100 C1.}
\end{subfigure}
\begin{subfigure}{.95\textwidth}
\adjustbox{trim=0 .45\height{} 0 0, clip, width=1\textwidth}
{\includegraphics[page=1]{{P100C1}.pdf}}
\caption{P100 C2.}
\end{subfigure}
\caption{Descriptive statistics of two lorem ipsun on long recordings lorem ipsun dataabess lorem ipsun lorem ipsun.}
\end{figure}
\end{document}
输入图像可以从 Google Drive Share 下载这里或其他托管服务这里由 NCSS 统计部门制作。
输出
LaTeX Warning: Float too large for page by 11.50876pt on input line 1950.
测试 David 和 Arash 的提议
\begin{figure}
\centering
\begin{subfigure}[a]{.85\textwidth}
\includegraphics[page=2,width=\linewidth,keepaspectratio]{P100C1.pdf}
\caption{P100 C1.}
\end{subfigure}
\begin{subfigure}[b]{.85\textwidth}
\includegraphics[page=2,width=\linewidth,keepaspectratio]{P100C2.pdf}
\caption{P100 C2.}
\end{subfigure}
\caption{Descriptive statistics of lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem.}
\end{figure}
输出:无警告
自动化方法就很好了。
TeXLive:2016年
操作系统:Debian 8.5
答案1
你修改后的文章表明你真正需要做的是限制高度图表。假设您的标题不是太长,设置该选项height=0.4\textheight
可能对您有用。
\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{\textwidth}
\centering
\includegraphics[page=2,width=0.85\textwidth,
height=0.4\textheight,
keepaspectratio]{P100C1.pdf}
\caption{P100 C1.}
\end{subfigure}
\bigskip
\begin{subfigure}{\textwidth}
\centering
\includegraphics[page=2,width=0.85\textwidth,
height=0.4\textheight,
keepaspectratio]{P100C2.pdf}
\caption{P100 C2.}
\end{subfigure}
\caption{Descriptive statistics of lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem.}
\end{figure}
\end{document}