如何更改定理环境中使用的字体

如何更改定理环境中使用的字体

我知道我可以更改定理环境的属性(使用\newtheoremstyle,如下所示),但如何将字体类型从 Computer Modern 更改为 Times New Roman?该更改应该是局部的:Times 只能在定理环境中使用。

注意:我用 编译我的文档pdflatex

\newtheoremstyle{mytheoremstyle} % name
        {\topsep}                    % Space above
        {\topsep}                    % Space below
        {\itshape}                   % Body font
        {}                           % Indent amount
        {\scshape\color{blue}}                   % Theorem head font
        {:}                          % Punctuation after theorem head
        {.5em}                       % Space after theorem head
        {}  % Theorem head spec (can be left empty, meaning ‘normal’)

答案1

与 Jubobs 评论中的链接问题相关如何在文档中的一小部分文本中使用特定字体?, 您可以使用:

\newtheoremstyle{mytheoremstyle} % name
        {\topsep}                    % Space above
        {\topsep}                    % Space below
        {\itshape\fontfamily{ptm}\selectfont}                   % Body font
        {}                           % Indent amount
        {\fontfamily{ptm}\selectfont\scshape\color{blue}}                   % Theorem head font
        {:}                          % Punctuation after theorem head
        {.5em}                       % Space after theorem head
        {}  % Theorem head spec (can be left empty, meaning ‘normal’)

以下是完整的 MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsthm}
\usepackage{xcolor}

\newtheoremstyle{mytheoremstyle} % name
        {\topsep}                    % Space above
        {\topsep}                    % Space below
        {\itshape\fontfamily{ptm}\selectfont}                   % Body font
        {}                           % Indent amount
        {\fontfamily{ptm}\selectfont\scshape\color{blue}}                   % Theorem head font
        {:}                          % Punctuation after theorem head
        {.5em}                       % Space after theorem head
        {}  % Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{mytheoremstyle}
\newtheorem{lemma}{Lemma}

\usepackage{lipsum}

\begin{document}
\lipsum[3]
\begin{lemma}[foo bar]
\lipsum[3]
\end{lemma}
\lipsum[3]

\end{document}

相关内容