侧边图形的水平定位

侧边图形的水平定位

我正在使用提供的代码的一个小变体贡萨洛·梅迪纳

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[rightcaption]{sidecap}
\usepackage{lipsum}

\sidecaptionvpos{figure}{t}
\begin{document}

\begin{SCfigure}
  \centering
  \begin{minipage}{5.5cm}
  \subcaptionbox{figure 1 \label{fig:sub1}}{\includegraphics{name1}}
  \end{minipage}
  \caption{\protect\lipsum[2]}
\end{SCfigure}

\begin{SCfigure}
  \centering
  \begin{minipage}{5.5cm}
  \subcaptionbox{figure 2 \label{fig:sub1}}{\includegraphics{name2}}
  \end{minipage}
  \caption{\protect\lipsum[2]}
\end{SCfigure}

\end{document}

生成这些数字:

在此处输入图片描述

可以将这两个图形并排放置吗?

答案1

这是一个可能的解决方案,使用hvfloatsubcaption包装;保留了双重标签(如问题评论中所要求的);根据实际图像,可能需要调整某些设置:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{hvfloat}
\usepackage{lipsum}

\captionsetup[subfigure]{labelformat=parens,labelsep=space}

\begin{document}

\noindent\begin{minipage}[t]{.5\textwidth}
\savebox\hvOBox{\parbox{3cm}{\centering\includegraphics[width=3cm]{example-image-a}\par\captionof{subfigure}{Figure 1}}}
\hvFloat[%
nonFloat=true,%
capWidth=0.45,%
capPos=r,%
capVPos=t,%
useOBox=true
]{figure}{}%
{An example of a caption vertically top aligned beside the image; two simple test images on a row}{fig:testa}
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
\savebox\hvOBox{\parbox{3cm}{\centering\includegraphics[width=3cm]{example-image-b}\par\captionof{subfigure}{Figure 2}}}
\hvFloat[%
nonFloat=true,%
capWidth=0.45,%
capPos=r,%
capVPos=t,%
useOBox=true
]{figure}{}%
{An example of a caption vertically top aligned beside the image; two simple test images on a row}{fig:testb}
\end{minipage}

\end{document}

在此处输入图片描述

一个更简单的选项,包含四个minipages 和caption/subcaption组合:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{lipsum}

\captionsetup[subfigure]{labelformat=parens,labelsep=space}

\begin{document}

\noindent\begin{minipage}[t]{.23\textwidth}
  \vspace*{0pt}\centering
  \includegraphics[width=\linewidth]{example-image-a}\par
  \captionof{subfigure}{Figure 1}
\end{minipage}\hfill
\begin{minipage}[t]{.23\textwidth}
  \vspace*{0pt}
  \captionsetup[figure]{belowskip=0pt}
  \captionof{figure}{An example of a caption vertically top aligned beside the image; two simple test images on a row}
  \label{fig:testa}
\end{minipage}\hfill
\begin{minipage}[t]{.23\textwidth}
  \vspace*{0pt}\centering
  \includegraphics[width=\linewidth]{example-image-a}\par
  \captionof{subfigure}{Figure 2}
\end{minipage}\hfill
\begin{minipage}[t]{.23\textwidth}
  \vspace*{0pt}
  \captionsetup[figure]{belowskip=0pt}
  \captionof{figure}{An example of a caption vertically top aligned beside the image; two simple test images on a row}
  \label{fig:testb}
\end{minipage}%

\end{document}

在此处输入图片描述

相关内容