Revtex 4.2 字幕错误

Revtex 4.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}

我收到类似以下错误:包标题错误:标题未定义。\end{tabularx} 不正确的 \prevdepth。\caption{jdjdkkd}

答案1

因此,该captionsubcaption也与 不兼容revtex4-2。您将获得

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.

无论如何,您收到的错误是由于 造成的caption=false

您可以改用subfig

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

没有必要tabularx,只需使用略小于 1/3 的线宽(最好称为\columnwidth)和图像之间的填充胶。

在此处输入图片描述

我建议不要使用commath。请参阅https://tex.stackexchange.com/a/123408/4427https://tex.stackexchange.com/a/135985/4427https://tex.stackexchange.com/search?q=commath+user%3A4427

相关内容