我有一个图形很宽(横向)。它太宽了,无法在原始方向上正常显示。因此,我使用环境sidewaysfigure
中的rotating
包。但是,当我这样做时,它会将我的图放在与我的子部分标题不同的页面上。
我怎样才能将一个侧面的图形及其相关的侧面标题放在同一页面作为正常导向的小节标题?
以下是 MWE:
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
final
]{microtype}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\section{My section}
\clearpage
\subsection{My subsection}
\begin{sidewaysfigure}[!h]
\centering
\makebox[0.5\textwidth][c]{\includegraphics[width=0.5\textwidth]{example-image}}
\caption{This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, long caption.}
\end{sidewaysfigure}
\end{document}
答案1
解决方案sidewaysfigure
用sideways
环境替换,\ffigbox
命令来自floatrow
:
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage[expansion=false, tracking=smallcaps, letterspace=40, final]{microtype}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{floatrow}
\begin{document}
\section{My section}
\clearpage
\subsection{My subsection}
\hfill\begin{sideways}
\ffigbox[1.5\FBwidth]{\includegraphics[width=0.5\textwidth]{example-image}}
{\caption{This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, long caption.}}
\end{sideways}\hfill\null
Some text. Some more text. Some more text.Some more text. Some more text. Some more text. Some more text.Some more text. Some more text.
\end{document}
答案2
该解决方案使用保存框来测量子部分的高度,并使用剩余空间作为宽度(高度)创建一个(旋转的)小页面。 \rotatebox
随 graphicx 包一起提供。
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
final
]{microtype}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{showframe}% alignment tool
\begin{document}
\section{My section}
\clearpage% optional
\begin{figure}[p]
\setbox0=\vbox{\subsection{My subsection}}% measure height
\usebox0\par
\vskip\textfloatsep\centering
\rotatebox{90}{\begin{minipage}{\dimexpr \textheight-\ht0-\textfloatsep}
\centering
\includegraphics[width=0.5\textwidth]{example-image}% measure width
\caption{This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, long caption.}
\end{minipage}}
\end{figure}
\clearpage
\end{document}
此版本将两者重叠。
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
final
]{microtype}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{showframe}% alignment tool
\begin{document}
\section{My section}
\clearpage
\begin{figure}[p]
\setbox0=\vbox{\subsection{My subsection}}% measure height
\usebox0\par\vskip-\ht0\vskip-\dp0% overlap
\centering
\rotatebox{90}{\begin{minipage}{\textheight}
\centering
\includegraphics[width=0.5\textwidth]{example-image}% measure width
\caption{This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, long caption.}
\end{minipage}}
\end{figure}
\clearpage
\end{document}