サブ図のキャプションのフォントを図と同じに設定する

サブ図のキャプションのフォントを図と同じに設定する

私はIEEEtranTIEテンプレート(提供元:IEEE 産業用エレクトロニクスに関するトランザクション)。

彼らは IEEEtran テンプレートをわずかに変更し、編集内容の 1 つはキャプションのフォントの変更です。

フォントに関する情報を取得するために、次のマクロを使用しました。

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother

IEEEtranで示されているように、サブキャプションパッケージを使用してサブ図を追加する\caption{\showfont}と、Encoding: T1, Family: phv, Series: m, Shape: n, Size: 8.

\makeatletter
\let\MYcaption\@makecaption
\makeatother
\usepackage[labelformat=simple,font=footnotesize]{subcaption}
\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

サブ図にキャプションを書くと、異なるファミリが取得されます。 が \subcaption{\showfont}表示されますEncoding: T1, Family: ptm, Series: m, Shape: n, Size: 8.。一貫したルックアンドフィールを実現するために、同じフォントファミリ ( phv) を少し小さく (7) 設定したいと思います。これはどのように取得できますか?

余談ですが、ある環境のフォントを取得して別の環境に割り当てることは可能でしょうか?

次のようなものです (疑似コード):

\edef\subcaptionfont\captionfont

または(正直に言うと、私はまだ をいつ使用すべきか理解するのに苦労しています\the):

\edef\subcaptionfont{\the\captionfont}

サイズやフォント ファミリなどの一部のフィールドを変更する機能も備わっている可能性があります。

MWE (IEEEtranTIE クラスは上記のリンクからダウンロードできます):

\documentclass[journal]{IEEEtranTIE}
\usepackage[pdftex,demo]{graphicx}
\usepackage{lipsum}

\makeatletter
\let\MYcaption\@makecaption
\makeatother

\usepackage[labelformat=simple,font=footnotesize]{subcaption}

\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[h]
\begin{subfigure}{\columnwidth}
    \includegraphics[width=\textwidth]{dummy}
    \subcaption{\showfont}
    \label{fig1}
\end{subfigure}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

- 編集 - とともに@TeXnicianの助け望み通りの結果を得ることができました。結果は、サブキャプションがロードされる部分を変更することで得られます。

\usepackage[labelformat=simple,font=footnotesize]{subcaption}

\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\fontfamily{phv}\scriptsize\sele‌​ctfont}
\captionsetup[sub]{font=myfont}

質問の最後の部分は依然として有効であり、次のように言い換えることができます。

次のようなものを使用して、サブキャプションのフォントをキャプションと同じフォントに継承するように設定することは可能ですか (ただし、\thecaptionfont有効なコマンドではないため、実際の例ではありません)。

\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\thecaptionfont\scriptsize\selec‌​tfont}
\captionsetup[sub]{font=myfont}

?

答え1

私の意見では、そのクラスでcaptionは または を使用すべきではありません。subcaption

とにかく、キャプションに使用されているフォントは なので\footnotesize\sffamily

\documentclass[journal]{IEEEtranTIE}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\makeatletter
\let\MYcaption\@makecaption
\makeatother

\usepackage[labelformat=simple,font={footnotesize,sf}]{subcaption}

\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[h]
\begin{subfigure}{\columnwidth}
    \includegraphics[width=\textwidth]{dummy}
    \subcaption{\showfont}
    \label{fig1}
\end{subfigure}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

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

subfig以下は、 クラスと互換性のある を使用したセットアップです。

\documentclass[journal]{IEEEtranTIE}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\usepackage[caption=false]{subfig}

\captionsetup[subfloat]{font={footnotesize,sf}}

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[htp]
\subfloat[\showfont\label{fig1}]{%
  \includegraphics[width=\columnwidth]{dummy}%
}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

出力は同じです。

答え2

両方のキャプションのフォントを に設定した動作バージョンを以下に示しますptm。別のフォントに変更してもかまいません (変更する場合は、キャプションのフォントも変更する必要があります)。

写真

\documentclass[journal]{IEEEtran}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\makeatletter
\let\MYcaption\@makecaption
\makeatother

\usepackage[compatibility=false]{caption}
\DeclareCaptionFont{quackfont}{\fontfamily{ptm}\fontsize{7pt}{9pt}\selectfont}
\usepackage[labelformat=simple,font=quackfont]{subcaption}

\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[h]
\begin{subfigure}{\columnwidth}
    \includegraphics[width=\textwidth]{dummy}
    \subcaption{\showfont}
    \label{fig1}
\end{subfigure}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

関連情報