标题未填满整个列

标题未填满整个列

我正在使用 ReVTeX 4.1 模板(用于 AIP 期刊),当我尝试添加图形时,我注意到标题没有填满整个列。

有没有办法让标题填满行(以及列),就像摘要或正文中的任何其他文本一样?

更新:

我发现了问题:由于某种原因,加载子标题包破坏了图形标题的格式,导致它们变得不合理并且无法填满整行。

例子: 在此处输入图片描述

\documentclass[aip,reprint]{revtex4-1}

\draft 

\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{subcaption}

\captionsetup{labelsep = period}

\usepackage{lipsum}

\begin{document}

\title{Draft}

\author{LaTeX User}

\date{\today}

\begin{abstract}
\lipsum[1]
\end{abstract}

\maketitle 

 \begin{figure}[h!]
    \centering
    \begin{subfigure}[b]{0.55\textwidth}
        \includegraphics[width=0.5\linewidth]{example-image-a}
        \caption{}\vspace{0.3cm}
        \label{fig:1a} 
    \end{subfigure}
    \begin{subfigure}[b]{0.55\textwidth}
        \includegraphics[width=0.5\linewidth]{example-image-b}
        \caption{}
        \label{fig:1b}
    \end{subfigure} 
    \captionsetup{justification   = justified,
        singlelinecheck = false}    
    \caption[]{\lipsum[1]}  
    \label{fig:1}
\end{figure}

\end{document}

答案1

由于某些未知的原因,该图形被格式化为单列模式。

顺便说一句,你可能不应该这样做。Revtex4-1 这样做\unhbox是有原因的(比如故意撤消字幕包格式)。

\documentclass[aip,reprint]{revtex4-1}

\draft 

\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{caption,subcaption}
\captionsetup{labelsep = period}

\makeatletter
\long\def\@makecaption#1#2{%
  \par
  \vskip\abovecaptionskip
  \begingroup
   \small\rmfamily
   \sbox\@tempboxa{%
    \let\\\heading@cr
    \@make@capt@title{#1}{#2}%
   }%
   \@ifdim{\wd\@tempboxa >\hsize}{%
    \begingroup
     \samepage
     \flushing
     \let\footnote\@footnotemark@gobble
     \@make@capt@title{#1}{#2}\par
    \endgroup
   }{%
     \global \@minipagefalse
     \hb@xt@\hsize{\hfil\unvbox\@tempboxa\hfil}% replaced \unhbox with \unvbox
   }%
  \endgroup
  \vskip\belowcaptionskip
}%
\makeatother
\usepackage{lipsum}

\begin{document}

\title{Draft}

\author{LaTeX User}

\date{\today}

\begin{abstract}
\lipsum[1]
\end{abstract}

\maketitle 
 \begin{figure}[h!]
    \centering
    \begin{subfigure}[b]{0.55\textwidth}
        \includegraphics[width=0.5\linewidth]{example-image-a}
        \caption{}\vspace{0.3cm}
        \label{fig:1a} 
    \end{subfigure}
    \begin{subfigure}[b]{0.55\textwidth}
        \includegraphics[width=0.5\linewidth]{example-image-b}
        \caption{}
        \label{fig:1b}
    \end{subfigure} 
    \caption[]{\lipsum[1]}
    \label{fig:1}
\end{figure}

\end{document}

这显示了如何将图像和标题并排放置。我将图形转换为小页面并将其移动到摘要内。这比使用浮动包的 [H] 图形更具适应性。

\documentclass[aip,reprint]{revtex4-1}

\draft 

\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{subcaption}
\captionsetup{labelsep = period}

\makeatletter
\newcommand{\setcaptype}[1]{\edef\@captype{#1}}

\long\def\@makecaption#1#2{%
  \par
  \vskip\abovecaptionskip
  \begingroup
   \small\rmfamily
   \sbox\@tempboxa{%
    \let\\\heading@cr
    \@make@capt@title{#1}{#2}%
   }%
   \@ifdim{\wd\@tempboxa >\hsize}{%
    \begingroup
     \samepage
     \flushing
     \let\footnote\@footnotemark@gobble
     \@make@capt@title{#1}{#2}\par
    \endgroup
   }{%
     \global \@minipagefalse
     \hb@xt@\hsize{\hfil\unvbox\@tempboxa\hfil}% replaced \unhbox with \unvbox
   }%
  \endgroup
  \vskip\belowcaptionskip
}%
\makeatother
\usepackage{lipsum}

\begin{document}

\title{Draft}

\author{LaTeX User}

\date{\today}

\begin{abstract}
\lipsum[1]

\noindent\begin{minipage}{\dimexpr \textwidth-\leftskip-\rightskip}
  \hrule% DEBUG - show widfth of minipage
  \setcaptype{figure}%
  \vspace*{\intextsep}%
  \begin{minipage}[b]{0.55\textwidth}
    \begin{subfigure}[b]{\textwidth}
        \centering
        \includegraphics[width=0.5\textwidth]{example-image-a}
        \caption{}\vspace{0.3cm}
        \label{fig:1a} 
    \end{subfigure}
    \begin{subfigure}[b]{\textwidth}
        \centering
        \includegraphics[width=0.5\textwidth]{example-image-b}
        \caption{}
        \label{fig:1b}
    \end{subfigure} 
  \end{minipage}\hfill\begin{minipage}[b]{0.4\textwidth}
    \caption[]{\lipsum[1]}
    \label{fig:1}
  \end{minipage}
  \vspace*{\intextsep}
\end{minipage}
\end{abstract}

\maketitle

\lipsum[1]

\end{document}

相关内容