是否可以最大化整个浮动(包括标题)的尺寸?我希望浮动能够适应页面允许的最大尺寸(宽度和高度)(即装订)。我提供了一个示例,它使图形对于页面来说太大并且切断了标题。我还使用我大学的一个包来设置边距大小等。
\documentclass{report}
\usepackage{mwe}
\usepackage{rotating}
\begin{document}
\begin{sidewaysfigure}[p]
\includegraphics[height=1\textheight,width=1\textwidth]{example-image-a}
\caption{long figure caption...long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
END OF CAPTION}
\label{fig:example}
\end{sidewaysfigure}
\end{document}
答案1
一个简单的解决方案,但是需要手动调整:
\documentclass{report}
\usepackage[showframe, % only for show page layout
margin=25mm]{geometry}
\usepackage{mwe}
\usepackage{rotating}
\newlength{\imageheight}% added
\setlength\imageheight{\dimexpr\textwidth-\abovecaptionskip}% added
\begin{document}
\begin{sidewaysfigure}
\includegraphics[width=\textheight,% changed
height=\dimexpr\imageheight-2\baselineskip\relax% changed, number of \baselineskip adjust manulaly :-(
]{example-image-a}
\caption{long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
END OF CAPTION}
\label{fig:example}
\end{sidewaysfigure}
\end{document}
注意:\textwidth
无法按预期工作。因此,在前导中定义新的长度并设置为。字幕所需的空间在选项中通过手动设置字幕行数计算textwidth-\abovecaptionskip
来确定。graphics
附录:
如果图像是纵向格式,代码会更简单。您不需要 sidewaystable,因此可以在includegraphics
选项字段中计算图像的高度:
\documentclass{report}
\usepackage[showframe, % only for show page layout
margin=25mm]{geometry}
\usepackage{mwe}
\usepackage{rotating}
\begin{document}
\begin{figure}[p]
\includegraphics[height=\dimexpr\textheight-3\baselineskip-\abovecaptionskip\relax,
width=\textwidth%
]{example-image-a}
\caption{long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
long figure caption... long figure caption... long figure caption...
END OF CAPTION}
\label{fig:example}
\end{figure}
\end{document}