如何设置我通常看到的字幕两端之间的对齐方式?

如何设置我通常看到的字幕两端之间的对齐方式?

我使用以下

\documentclass[aps,pra,twocolumn]{revtex4-2}
%
\usepackage{amssymb,amsmath,amsthm}
\usepackage{caption}
\captionsetup{singlelinecheck = false}
\usepackage{graphicx}
%\usepackage{subfig}
\usepackage{overpic}
\usepackage{subcaption}
\captionsetup{compatibility=false}
\begin{document}

\begin{figure*}
    %\centering
\caption{(a) The type of circuit described in Ref. [37] that allows the 
recovery of 2n eigenvalues of the averaged noise channel of the
device. The random Pauli gates (blue) are used to twirl the channel and by averaging over a number of random choices of Pauli gates,
the noise channel in the device is transformed into a Pauli channel. In a similar way to randomized benchmarking, by repeating the}
    \label{fig1}
    \end{figure*}

\end{document} 

并得到在此处输入图片描述

我想让标题文字在两端(左和右)对齐,如下所示: 在此处输入图片描述

答案1

正如 David 在评论中所说,包caption(因此也是subcaption) 和类revtex4-2实际上并不兼容。通常caption会警告:

Package caption Warning: Unknown document class (or package),
(caption)                standard defaults will be used.
See the caption package documentation for explanation.

因为这。

尽管如此,为了获得想要的结果,您可以加载包ragged2e,然后使用caption选项justification=Justified(注意大写J!):

\documentclass[aps,pra,twocolumn]{revtex4-2}
%
\usepackage{amssymb,amsmath,amsthm}
\usepackage[compatibility=false]{caption}
\usepackage{graphicx}
%\usepackage{subfig}
\usepackage{overpic}
\usepackage{subcaption}
\usepackage{ragged2e}% Needed for justification=Justified (uppercase J!)
\captionsetup{singlelinecheck = false,justification=Justified}
\begin{document}

\begin{figure*}
  %\centering
\caption{(a) The type of circuit described in Ref. [37] that allows the 
recovery of 2n eigenvalues of the averaged noise channel of the
device. The random Pauli gates (blue) are used to twirl the channel and by averaging over a number of random choices of Pauli gates,
the noise channel in the device is transformed into a Pauli channel. In a similar way to randomized benchmarking, by repeating the}
    \label{fig1}
    \end{figure*}

\end{document} 

在此处输入图片描述

但是,不要指望这将解决和组合的所有caption问题revtex4-2

相关内容