하위 그림의 캡션 글꼴을 그림과 동일하게 설정합니다.

하위 그림의 캡션 글꼴을 그림과 동일하게 설정합니다.

저는 IEEEtranTIE 템플릿(제공:산업용 전자제품에 대한 IEEE 거래).

그들은 IEEEtran 템플릿을 약간 수정했으며 편집 내용 중 하나는 캡션 글꼴이 변경된 것입니다.

글꼴에 대한 정보를 얻으려면 다음 매크로를 사용했습니다.

\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제 생각에는 or 을 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}

관련 정보