我遇到了一个问题:我想在子图上添加侧边标题。这是我的实际代码(不执行侧边标题):
\begin{figure}[H]
\begin{center}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}\\
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}\\
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}\\
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}\\
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}
\subfigure[\footnotesize{...}]{
\label{...}
\includegraphics[width=0.25\textwidth]{...}
}\\
\end{center}
\caption{"I would like that this text is put on the side of the image"}
\label{...}
\end{figure}
我输入“...”的地方是我删除的文本。我尝试使用包并使用而不是来sidecap
编辑环境,但这给我带来了很多错误。SCfigure
figure
答案1
请注意subfigure
已过时。请使用subfig
(而\subfloat
不是\subfigure
) 或更新且维护良好的subcaption
软件包。
我猜测您希望将标题放在图像集旁边,因为标题文本很长。否则,放在底部会更好。
只需使用tabular
对齐图像并使用小页面来设置标题。
\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{lipsum} % for mock caption text
\begin{document}
\begin{figure}
\begin{tabular}{@{}cc@{}}
\subfloat[subfigure]{%
\label{a}%
\includegraphics[width=0.25\textwidth]{example-image}%
}&
\subfloat[subfigure]{%
\label{b}%
\includegraphics[width=0.25\textwidth]{example-image}%
}\\
\subfloat[subfigure]{%
\label{c}%
\includegraphics[width=0.25\textwidth]{example-image}%
}&
\subfloat[subfigure]{%
\label{d}%
\includegraphics[width=0.25\textwidth]{example-image}%
}\\
\subfloat[subfigure]{%
\label{e}%
\includegraphics[width=0.25\textwidth]{example-image}%
}&
\subfloat[subfigure]{%
\label{f}%
\includegraphics[width=0.25\textwidth]{example-image}%
}\\
\subfloat[subfigure]{%
\label{g}%
\includegraphics[width=0.25\textwidth]{example-image}%
}&
\subfloat[subfigure]{%
\label{h}%
\includegraphics[width=0.25\textwidth]{example-image}%
}\\
\subfloat[subfigure]{%
\label{i}%
\includegraphics[width=0.25\textwidth]{example-image}%
}&
\subfloat[subfigure]{%
\label{j}%
\includegraphics[width=0.25\textwidth]{example-image}%
}\\
\end{tabular}\hfill
\begin{minipage}{0.4\textwidth}
\caption{\lipsum[2]}
\label{x}
\end{minipage}
\end{figure}
\end{document}
用作[H]
位置说明符通常是错误的;在浮点数相当大的情况下更是如此。
利用一些技巧,您可以获得顶部对齐。
变成
\begin{tabular}{@{}cc@{}}
\begin{tabular}[t]{@{}cc@{}} \\[-\dp\strutbox]
变成
\begin{minipage}[t]{0.4\textwidth}
\begin{minipage}[t]{0.4\textwidth}
其余保持不变。
答案2
这与 sidecap 不同,因为它计算标题可用的宽度并使用 对齐顶部\raisebox
。
标题\label
应与标题一起放在小页面内。
\documentclass{article}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{varwidth}
\begin{document}
\begin{figure}[htp]
\sbox0{\begin{varwidth}{\textwidth}% get width of combined subfigures
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}\\
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}\\
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}\\
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}\\
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}
\subfigure[\footnotesize{...}]{
\includegraphics[width=0.25\textwidth]{example-image}
}\\
\end{varwidth}}%
\raisebox{-\height}{\usebox0}% left
\hspace{\columnsep}% gap
\raisebox{-\height}{\begin{minipage}{\dimexpr \textwidth-\wd0-\columnsep}
\abovecaptionskip=0pt
\caption{"I would like that this text is put on the side of the image"}
\end{minipage}}
\end{figure}
\end{document}