0

I'm writing a paper with REVTeX 4.2 using Overleaf and want the captions of my figures to be fully justified, but they are automatically centering. I've read this question about the same problem in RevTex 4.1, but I'm wondering if there's a way to full justify my captions with the regular figure and table environments without using \subfloat. The figure and table environments are automatically numbered, so I won't need to renumber everything if I want to add a figure to the beginning of the document.

I've also tried \usepackage{caption} with \captionsetup{justification=justified, singlelinecheck=false}, but that didn't work.

The header and an example figure for my document are below:

\documentclass[reprint,amsmath,amssymb,aps,floatfix]{revtex4-2}

\usepackage[margin=1.5cm]{geometry}
\usepackage{tabularray}
\usepackage{caption}
\captionsetup{justification=justified, singlelinecheck=false}
\usepackage{graphicx}
\usepackage[tiny, center, uppercase]{titlesec}

\titlespacing\section{0pt}{12pt plus 0pt minus 0pt}{3pt plus 0pt minus 0pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}

...
...

\begin{figure}[t!]
    \includegraphics[width=.5\textwidth]{experimental_diagram.jpg}
    \caption{Experimental setup. This diagram shows...}
    \label{fig:experiment_setup}
\end{figure}

\end{document}
1
  • 1
    Note the warning printed Package caption Warning: Unknown document class (or package), (caption) standard defaults will be used. so the caption package will do nothing here Nov 13, 2021 at 20:52

1 Answer 1

2

You can't use caption package but you could disable the centre-single line check in other ways.

enter image description here

\documentclass[reprint,amsmath,amssymb,aps,floatfix]{revtex4-2}

\usepackage[margin=1.5cm]{geometry}
\usepackage{tabularray}

\usepackage{graphicx}
\usepackage[tiny, center, uppercase]{titlesec}

\titlespacing\section{0pt}{12pt plus 0pt minus 0pt}{3pt plus 0pt minus 0pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}

...
...

\begin{figure}[t!]
    \includegraphics[width=\columnwidth]{example-image}
    \makeatletter\long\def\@ifdim#1#2#3{#2}\makeatother
    \caption{Experimental setup. This diagram shows... }
    \label{fig:experiment_setup}
\end{figure}

\end{document}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .