1

I am using the ReVTeX 4.1 template (for AIP journals), and while I was trying to add figures I noticed that the caption does not fill the whole column.

Is there a way to make caption fill the lines (and hence the column) as in the abstract or any other text in the body?

UPDATE:

I found out the problem: For some reason, loading the the subcaption package ruins the formatting of the figures captions in that they become unjustified & do not fill the whole line.

Example: enter image description here

\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}
  • If the reprint document class option is set, revtex4-1 typesets the document in two-column mode by default. Are you trying to use the full width of the textblock, i.e., both columns, for the figures and their caption(s)? If so, you should be using a figure* environment. Please clarify your typesetting needs. – Mico Jul 18 '18 at 6:50
2

For some unknown reason, the figure is formatted in onecolumn mode.

BTW, you probably shouldn't do this. Revtex4-1 uses \unhbox for a reason (like deliberately undoing the caption package formatting).

\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}

This shows how to put the images and caption side-by-side. I converted the figure into a minipage and moved it inside the abstract. This is slightly more adaptable than an [H] figure using the float package.

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.