I am writing a paper using the IEEEtranTIE template (provided by IEEE Transaction on Industrial Electronics).
They slightly modified the IEEEtran template and one of the edits is a change in the caption font.
To obtain the information about the fonts I used the following macro:
\makeatletter
\newcommand{\showfont}{
Encoding: \f@encoding{},
Family: \f@family{},
Series: \f@series{},
Shape: \f@shape{},
Size: \f@size{}.
}
\makeatother
Using \caption{\showfont} I get Encoding: T1, Family: phv, Series: m, Shape: n, Size: 8.
When I add a subfigure using the subcaption package as indicate by IEEEtran
\makeatletter
\let\MYcaption\@makecaption
\makeatother
\usepackage[labelformat=simple,font=footnotesize]{subcaption}
\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother
and I write a caption in a sub figure I get a different family.
\subcaption{\showfont} gives Encoding: T1, Family: ptm, Series: m, Shape: n, Size: 8..
In order to have a consistent look&feel I would like to set the same font family (phv) but slightly smaller (7).
How can be this obtained?
As a side question, is it possible to obtain a font of a certain environment and to assign it to an another environment?
Something like (pseudo-code):
\edef\subcaptionfont\captionfont
or (to be honest I still struggle to understand when to use \the):
\edef\subcaptionfont{\the\captionfont}
Possibly with also the ability to change some fields, like size or font family.
A MWE (the IEEEtranTIE class can be downloaded from the link above):
\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}
--EDIT-- With the help of @TeXnician I was able to get the desired result. The result is obtained by changing the part where subcaption is loaded, namely
\usepackage[labelformat=simple,font=footnotesize]{subcaption}
with
\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\fontfamily{phv}\scriptsize\selectfont}
\captionsetup[sub]{font=myfont}
The last part of the question is still valid and can be rephrased as follows.
Is it possible to set the subcaption font to inherit the same of the caption using something similar to (but not a working example since \thecaptionfont is not a valid command):
\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\thecaptionfont\scriptsize\selectfont}
\captionsetup[sub]{font=myfont}
?


\DeclareCaptionFont{name}{\myfont\selectfont}(documentation ofcaption) which you can use as parameter forsubcaptioninstead offootnotesize. Then select font family and size with usual macros. – TeXnician Apr 20 '17 at 09:36\selectfont? – Alex Pacini Apr 20 '17 at 09:53\selectfontis a macro defined by LaTeX which changes the font (only using\fontsizeor similar is not enough). – TeXnician Apr 20 '17 at 09:54\the(which is usually used for counters). – TeXnician Apr 20 '17 at 10:03\DeclareCaptionFont{myfont}{\fontfamily{phv}\fontsize{7}{\baselineskip}\selectfont}. – Alex Pacini Apr 20 '17 at 10:06