我需要将子图标签放置在其各自图形的左上角。对于普通报告,我可以很好地做到这一点,但是如果我更改为双面报告,偶数页上的标签就会不正确。在偶数页上,标签不会移到正确的位置,并且子图会偏移(前提是它们的大小不同)。我不确定从这里开始该怎么做才能解决这个问题。
这是 MWE,任何帮助或见解都将非常有用:
\documentclass[12pt, twoside]{report}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\captionsetup[subfigure]{
singlelinecheck = false,
justification = raggedright,
margin = {-3ex, 0ex},
}
\begin{document}
%
\begin{figure}[tbp]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels in correct position.}
\end{figure}
%
\lipsum[1-3]
%
\begin{figure}[tbp]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels in incorrect position, and figures offset.}
\end{figure}
%
\lipsum[4-5]
%
\begin{figure}[tbp]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels back in correct position.}
\end{figure}
%
\end{document}
答案1
根据caption
包裹文件 Page.11
, '在双面文档中,偶数页的左右边距会交换。为了防止这种情况,您可以另外指定选项 oneside,例如 \captionsetup{margin= {0pt,10pt},oneside}'。因此,正确的示例是:
\documentclass[12pt, twoside]{report}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\captionsetup[subfigure]{
singlelinecheck = false,
justification = raggedright,
margin = {-3ex, 0ex},
oneside
}
\usepackage[showframe]{geometry}
\begin{document}
%
\begin{figure}[t]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels in correct position.}
\end{figure}
%
\lipsum[1-3]
%
\begin{figure}[t]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels in incorrect position, and figures offset.}
\end{figure}
%
\lipsum[4-5]
%
\begin{figure}[t]
\centering
\begin{subfigure}[t]{0.4\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}
\hspace{3ex}
\begin{subfigure}[t]{0.28\linewidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}
\caption{Labels back in correct position.}
\end{figure}
%
\end{document}