2

I know that the documentclass revtex4-1 is incompatible with the caption (and subcaption) package and thus when using the subfig package I need to add the option [caption=false] as elaborated by karlkoeller and egreg.

However, even with the option [caption=false] I still get subcaptions that are not justified. The main caption is nicely justified, but long subcaptions are not. On the other hand, changing the justification to [justification=raggedright] works as expected. Also with \documentclass{article} things are fine.

Any way of making long _sub_captions justified in revtex4-1?

Minimum example:

\documentclass[reprint,amsmath,amssymb,aps,prd]{revtex4-1}
% \documentclass{article}  % works with docclass article but not with revtex
\usepackage{graphicx}
\usepackage[caption=false,justification=justified]{subfig}  
% raggedright works, justified does not
\usepackage{todonotes}

\begin{document}

\begin{figure*}[htb]
    \centering
    \subfloat[Long text here. Long text here. Long irregular text here. 
    More irregular text here. Long text here. Broken up with some other words. 
    Trying to show the ragged effect left and right. 
    Addsomeveryextremelylongwords tomakethingsworse andthus moreclear.]
    {\missingfigure[figwidth=5cm]{}}
    \hspace{1cm}
    \subfloat[Long text here. Long text here. Long irregular text here. 
    More irregular text here. Long text here. Broken up with some other words. 
    Trying to show the ragged effect left and right. 
    Addsomeveryextremelylongwords tomakethingsworse andthus moreclear.]
    {\missingfigure[figwidth=5cm]{}}
    \caption{Large caption spanning both subfigures. 
    This caption actually is justified as it is supposed to be. 
    Unfortunately the same does not go for the subcaptions above 
    which are not justified. Using ``raggedright'' in the captionsetup 
    actually works also on the subcaptions. ``justified'' however does not.}
\end{figure*}

\end{document}
  • 1
    Are you sure they are supposed to be justified? – cfr Aug 1 '18 at 3:03
  • On page 16 of the REVTeX 4.1 Author's Guide it only says very generally: "Captions less than one line long are centered under the figure, otherwise they span the width of the figure." It says nothing about subcaptions explicitly, so I'd have thought subcaptions should be justified as well. – Zaus Aug 1 '18 at 11:05
0

For whom might end up here looking for an answer

Note that revtex provides the commads \onecolumngrid and \twocolumngrid. From my experience they help dealing with floats that require two columns.

Here is possible solution that at least takes it close to the justified option:

\documentclass[reprint,amsmath,amssymb,aps,prd]{revtex4-1}
% \documentclass{article}  % works with docclass article but not with revtex
\usepackage{graphicx}
\usepackage[caption=false, justification=centerlast]{subfig}
% raggedright works, justified does not
\usepackage{todonotes}

\begin{document}
\onecolumngrid% Mind one empty line below

\begin{figure}[htb]
    % \centering
    \subfloat[Long text here. Long text here. Long irregular text here.
    More irregular text here. Long text here. Broken up with some other words.
    Trying to show the ragged effect left and right.
    Addsomeveryextremelylongwords tomakethingsworse andthus moreclear.]
    {\missingfigure[figwidth=5cm]{}}
    \hspace{1cm}
    \subfloat[Long text here. Long text here. Long irregular text here.
    More irregular text here. Long text here. Broken up with some other words.
    Trying to show the ragged effect left and right.
    Addsomeveryextremelylongwords tomakethingsworse andthus moreclear.]
    {\missingfigure[figwidth=5cm]{}}
    \caption{Large caption spanning both subfigures.
    This caption actually is justified as it is supposed to be.
    Unfortunately the same does not go for the subcaptions above
    which are not justified. Using ``raggedright'' in the captionsetup
    actually works also on the subcaptions. ``justified'' however does not.}
\end{figure}
\twocolumngrid

\end{document}

Result: two subfigures side by side with justified captions below them

If you are trying to use subfloat or phantomcaption in revtex, this answer might help you.

| improve this answer | |

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.