\DeclareCaptionFormat を終了し、デフォルトのキャプション設定に戻します。

\DeclareCaptionFormat を終了し、デフォルトのキャプション設定に戻します。

私はアルゴリズムフロート用に独自のキャプション形式を定義しましたが、これは非常にうまく機能しています。

\DeclareCaptionFormat{algor}{%
  \hrulefill\par\offinterlineskip\vskip1pt%
  \textbf{#1#2}#3\offinterlineskip\hrulefill}
\DeclareCaptionStyle{algori}{singlelinecheck=off,format=algor,labelsep=space}
\captionsetup[algorithm]{style=algori}

ただし、ドキュメント内の図にはデフォルトのキャプション設定を適用したいのですが、それを実現する方法を教えてください。

答え1

独自のキャプション スタイルを次のように定義できることがわかりました。

\DeclareCaptionFormat{<formatname>}{<code for format>}

そして、この形式を特定の float 環境に次のように使用します。

\captionsetup[<float_environment>]{singlelinecheck=off, labelsep=colon,format=<formatname>}

ここで labelsep は「コロン」に設定されていますが、「スペース」などに変更することもできます。

このキャプションの書式設定は、与えられた問題に対して次のように使用できます。

\DeclareCaptionFormat{algor}{%
  \hrulefill\par\offinterlineskip\vskip1pt%
  \textbf{#1#2}#3\offinterlineskip\hrulefill}
\DeclareCaptionStyle{algori}{singlelinecheck=off,format=algor,labelsep=space}
\captionsetup[algorithm]{style=algori}

\DeclareCaptionFormat{figur}{%
  \begin{center}
  \textbf{#1#2}#3
  \end{center}}
\captionsetup[figure]{singlelinecheck=off,format=figur,labelsep=colon}

関連情報