4

I'd like to change the theorem environment headfont to match komascript's fonts in chapters and sections. Particularly I'm interested in knowing how to do this using packages like thmtools.

Here's the MWE:

\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\newtheorem{thm}{Theorem}
\begin{document}
\section{Introduction to the theorem}

Introduction of something. Here's the theorem:

\begin{thm}
This is a theorem.
\end{thm}

\end{document}

Here's the output

enter image description here

4 Answers4

3

With amsthm, looking at https://tex.stackexchange.com/a/17555/4427 where the standard values are listed:

\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{komaplain}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\itshape}  % BODYFONT
  {0pt}       % INDENT (empty value is the same as 0pt)
  {\bfseries\sffamily} % HEADFONT
  {.}         % HEADPUNCT
  {5pt plus 1pt minus 1pt} % HEADSPACE
  {}          % CUSTOM-HEAD-SPEC

\theoremstyle{komaplain}
\newtheorem{thm}{Theorem}

\begin{document}

\section{Introduction to the theorem}

Introduction of something. Here's the theorem:

\begin{thm}
This is a theorem.
\end{thm}

\begin{thm}[Note]
This is a theorem.
\end{thm}

\end{document}

enter image description here

egreg
  • 1,121,712
2

Using thmtools you can change the headfont as follows:

enter image description here

\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm}

\usepackage{thmtools}
\declaretheoremstyle[headfont=\sffamily\bfseries]{thm}
\declaretheorem[style=thm]{thm}

\begin{document}
\section{Introduction to the theorem}

Introduction of something. Here's the theorem:

\begin{thm}
This is a theorem.
\end{thm}

\end{document}
leandriis
  • 62,593
2

Here is an example code with amsthm and thmtools. Note that thmtools also cooperates with ntheorem:

\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm, thmtools}
\newtheorem{thm}{Theorem}
\declaretheoremstyle[%
spaceabove=6pt, spacebelow=6pt,%
headfont=\sffamily\bfseries,
notefont=\sffamily\bfseries, notebraces={(}{)},
headpunct =\,—,
bodyfont=\normalfont\itshape]%
{sf}
\declaretheorem[style=sf, within=chapter, name=Theorem]{theo}

\begin{document}

\setcounter{chapter}{3}
\section{Introduction to the theorem}

Introduction of something. Here's the theorem:

\begin{theo}[using a sans font]
This is a well-known theorem.
\end{theo}

\end{document} 

enter image description here

Bernard
  • 271,350
1

To ensure that headfont matches the font settings of chapter and section titles in a KOMA-Script document use

\usekomafont{disposition}

The initial definition for the disposition font element is \normalcolor\sffamily\bfseries. But this can be changed using \setkomafont or \addtokomafont.

\documentclass{scrbook}
\PreventPackageFromLoading{remreset}% comment this line, if you use an older TeX-Distribution
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm}

%\addtokomafont{disposition}{\rmfamily}

\usepackage{thmtools}
\declaretheoremstyle[headfont=\usekomafont{disposition}]{thm}
\declaretheorem[style=thm]{thm}

\begin{document}
\section{Introduction to the theorem}

Introduction of something. Here's the theorem:

\begin{thm}[Note]
This is a theorem.
\end{thm}

\end{document}

Additional remark: thmtools loads package remreset which is obsolete with uptodate TeX distributions. To avoid the resulting warning »The remreset package is obsolete: \@removefromreset is defined.« KOMA-Script command \PreventPackageFromLoading{remreset} is used in the example.

esdd
  • 85,675