5

I'm using thmtools to define a custom example environment. I'm styling the head as italic, but the number is not being styled correctly: it appears in normal mode instead of italic (the dot after the number is being styled correctly). If I style the head as bold, then the number is styled correctly. Am I missing something or is it a bug?

Minimal working example:

\documentclass[11pt,twoside]{article}

\usepackage{amsthm,thmtools}

\declaretheoremstyle[
   name=Example,
   spaceabove=\topsep, spacebelow=\topsep,
   headindent=0pt, postheadspace=1ex,
   headfont=\normalfont\itshape, headpunct=.,
   bodyfont=\normalfont,
   qed=$\diamond$
]{example}
\declaretheorem[style=example]{example}

\begin{document}
\begin{example}
test
\end{example}
\end{document}

1 Answer 1

4

The problem is that thmtools defines

\def\NUMBER{\bgroup\@upn{##2}\egroup}

and

\let\@upn=\textup

so the change to italics won't have any effect on the number that will always be typeset in up-right font; one way to override this setting (and I am not sure if this is a good typographical practice) is to use preheadhook to redefine \@upn:

\documentclass[11pt,twoside]{article}

\usepackage{amsthm,thmtools}
\makeatletter
\declaretheoremstyle[
   preheadhook=\renewcommand\@upn{},
   name=Example,
   spaceabove=\topsep, spacebelow=\topsep,
   headindent=0pt, postheadspace=1ex,
   headfont=\itshape,notefont=\itshape, headpunct=.,
   bodyfont=\normalfont,
   qed=$\diamond$
]{example}
\declaretheorem[style=example]{example}
\makeatother

\begin{document}
\begin{example}
test
\end{example}
\end{document}

enter image description here

1
  • \let\@upn\@firstofone will also remove a pair of braces; just nitpicking. :) I would prefer an upright number too.
    – egreg
    Jan 12, 2013 at 20:22

You must log in to answer this question.