キャプションのカスタムフォントサイズ

キャプションのカスタムフォントサイズ

このコードは問題ありません:

\usepackage{caption}
\captionsetup{
  font=small,
  labelfont=bf,
  justification=justified,
  format=plain}

しかし、私は次のようにフォントをカスタマイズしたいのです:

\usepackage{caption}
\captionsetup{
  font={\fontsize{10pt}{11pt}\selectfont},
  labelfont=bf,
  justification=justified,
  format=plain}

後者のコードはコンパイル エラーになります。助けてください。

動作しないコードを含む最小限の例を次に示します。

\documentclass{article}

\usepackage{caption}
\captionsetup{
  font={\fontsize{10pt}{11pt}\selectfont},
  labelfont=bf,
  justification=justified,
  format=plain}

\begin{document}

\begin{figure}
  \caption{A figure caption}
\end{figure}

\end{document}

答え1

必要がある定義する新しいフォントスタイルは、captionキー値入力の一部としてこれが必要です:

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{caption}

\DeclareCaptionFont{myfont}{\fontsize{10pt}{11pt}\selectfont}

\captionsetup{
  font=myfont,
  labelfont=bf,
  justification=justified,
  format=plain
}

\begin{document}

\begin{figure}
  \caption{This is a caption}
\end{figure}

\end{document}

関連情報