Defina a fonte da legenda em uma subfigura para a mesma da figura

Defina a fonte da legenda em uma subfigura para a mesma da figura

Estou escrevendo um artigo usando o modelo IEEEtranTIE (fornecido porTransação IEEE em Eletrônica Industrial).

Eles modificaram ligeiramente o modelo IEEEtran e uma das edições é uma mudança na fonte da legenda.

Para obter as informações sobre as fontes utilizei a seguinte macro:

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

Usando \caption{\showfont}I get Encoding: T1, Family: phv, Series: m, Shape: n, Size: 8. Quando adiciono uma subfigura usando o pacote subcaption conforme indicado pelo IEEEtran

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

e escrevo uma legenda em uma subfigura, recebo uma família diferente. \subcaption{\showfont}Encoding: T1, Family: ptm, Series: m, Shape: n, Size: 8.. Para ter uma aparência consistente, gostaria de definir a mesma família de fontes ( phv), mas um pouco menor (7). Como isso pode ser obtido?

Como questão paralela, é possível obter uma fonte de um determinado ambiente e atribuí-la a outro ambiente?

Algo como (pseudocódigo):

\edef\subcaptionfont\captionfont

ou (para ser sincero, ainda tenho dificuldade em entender quando usar \the):

\edef\subcaptionfont{\the\captionfont}

Possivelmente com também a capacidade de alterar alguns campos, como tamanho ou família de fontes.

Um MWE (a classe IEEEtranTIE pode ser baixada no link acima):

\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}

--EDITAR-- Com oajuda de @TeXnicianConsegui obter o resultado desejado. O resultado é obtido alterando a parte onde a sublegenda é carregada, nomeadamente

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

com

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

A última parte da pergunta ainda é válida e pode ser reformulada da seguinte forma.

É possível definir a fonte da sublegenda para herdar a mesma da legenda usando algo semelhante a (mas não é um exemplo funcional, pois \thecaptionfontnão é um comando válido):

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

?

Responder1

Na minha opinião, você não deveria usar captionor subcaptioncom essa classe.

De qualquer forma, como a fonte usada nas legendas é \footnotesize\sffamily, você pode se safar

\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}

insira a descrição da imagem aqui

Aqui está a configuração com subfig, que é compatível com a classe.

\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}

A saída é a mesma.

Responder2

Aqui está uma versão funcional configurando a fonte ptmpara ambas as legendas. Sinta-se à vontade para alterá-la para outra fonte (se desejar, você terá que alterar a fonte da legenda também):

foto

\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}

informação relacionada