2
\documentclass[amssymb,aps,twocolumn,pra,nobibnotes,secnumarabic,prc]{revtex4-2}
\usepackage{tabularx}
\usepackage[labelformat=simple,caption=false]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\usepackage{graphicx
\usepackage{lineno}
\usepackage{dcolumn}   % needed for some tables
\usepackage{bm}
\usepackage{amsmath}   % for math
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{csquotes}
\usepackage{commath}
\begin{document}
\begin{figure}[htb]
    \captionsetup[subfigure]{singlelinecheck=off}
    \begin{tabularx}{\linewidth}{*{3}{X}}
        \begin{subfigure}[b]{\linewidth}
            \label{subfig:a}
            \includegraphics[width=\linewidth]{figures/hydro2}
            \caption{}
        \end{subfigure}
        &
        \begin{subfigure}[b]{\linewidth}
            \caption{}\label{subfig:b}
            \includegraphics[width=\linewidth]{figures/hydro1}
        \end{subfigure}       
    \end{tabularx}
    \caption{jdjdkkd}
    \label{fig:a}
\end{figure}
\end{document}

And i get errors like: Package caption Error: caption undefined. \end{tabularx} Improper \prevdepth. \caption{jdjdkkd}

1
  • caption and subcaption should not be used with revtex4-2. For subfloats, use the older subfig, calling it with \usepackage[caption=false]{subfig}; check its manual for the syntax. – egreg Sep 25 '19 at 13:50
2

The caption package, hence subcaption as well, is not compatible with revtex4-2. You get

Package caption Warning: Unsupported document class (or package) detected,
(caption)                usage of the caption package is not recommended.
See the caption package documentation for explanation.

The error you get is due to caption=false, anyhow.

You can use subfig instead.

\documentclass[amssymb,aps,twocolumn,pra,nobibnotes,secnumarabic,prc]{revtex4-2}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
%\usepackage{commath} % Oh, no!

\usepackage{lipsum} % for context

\begin{document}

\lipsum[1]

\begin{figure}[htb]

\subfloat[\label{subfig:a}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}\hfill
\subfloat[\label{subfig:b}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}\hfill
\subfloat[\label{subfig:c}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}

\subfloat[\label{subfig:d}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}\hfill
\subfloat[\label{subfig:e}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}\hfill
\subfloat[\label{subfig:f}]{%
  \includegraphics[width=0.3\columnwidth]{example-image}%
}

\caption{jdjdkkd}\label{fig:a}

\end{figure}

\lipsum

\end{document}

There's no need for tabularx, just use a bit less than 1/3 of the line width (which is better called \columnwidth) and filler glue between images.

enter image description here

I'd recommend against using commath. See https://tex.stackexchange.com/a/123408/4427, https://tex.stackexchange.com/a/135985/4427 and https://tex.stackexchange.com/search?q=commath+user%3A4427

2
  • hey, thankyou for the answer. i did as u said but now the error goes like "Improper \prevdepth. }", "You can't use `\prevdepth' in restricted horizontal mode. }" – marooz Sep 26 '19 at 5:59
  • @marooz I get no such error. – egreg Sep 26 '19 at 8:13

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.