0

I want the body of theorems to be in a true slanted font (\slshape) rather than in italic, yet have brackets within a theorem body to be upright.

The newtx package (version 1.7) option theoremfont (and the same option to the newtxtext package) makes text in the body of an amsthm theorem body slanted yet keep brackets there upright.

Is it possible somehow to cause that same option to have the same effect when declaring theorem styles via the thmtools package?

If, as in the following source, I use newtx option theoremfont and define the theorem style via thmtools, then the entire theorem body font is upright, including brackets there.

\documentclass{memoir}

\usepackage[amsthm,theoremfont]{newtx} % loads fontspec & amsthm, too

\usepackage{thmtools}
\swapnumbers
\declaretheoremstyle[
  headfont=\sffamily\bfseries, headpunct={\sffamily\bfseries.},
  % bodyfont=\mdseries\slshape,
]{thmstyle}
\declaretheorem[style=thmstyle,name=Theorem]{theorem}

\begin{document}
\chapter{The Chapter}
\section{Here is a section}

\begin{theorem}[Pythagorean theorem]

In a right triangle [that is, with one angle a right angle],
the square of the length of the hypotenuse equals
the sum of the squares of the lengths of the other two sides.

\end{theorem}

\end{document}

newtx with theoremfont option and thmtools - no bodyfont declared

If, however, I add to the theorem style definition the option

  bodyfont=\mdseries\slshape,

then the entire theorem body is slanted, including, unfortunatetly, brackets, as shown here:

newtx with theoremfont option and thmtools with slshape bodyfont declared

I am aware of two workarounds:

  1. load package embrac and then use \embbracket{...} for the bracketed text; or
  2. use \textup{[} and `\textup{]}1 to delimit the bracketed text.

But both methods are "manual," whereas I am looking for an automatic method.

Related:

Upright brackets in theorem body with bodyfont=\mdseries\itshape?

Embrac package and enumerate

Upright parentheses in italic text

Copy theoremfont option from newtxtext

Added: comparison with newtx and amsthm

By contrast, the following source produces a theorem body with slanted text, except that brackets, parentheses, numerals, and punctuation are set upright:

\documentclass{article}

\usepackage[amsthm,theoremfont]{newtx}

\theoremstyle{plain}
\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}

In a right triangle [that is, a triangle with one right angle]: the square of (the length of) the hypotenuse equals the some of the squares of the other 2 sides.

\end{thm}

\end{document}

upright brackets, etc. - newtx, theoremfont opt, amsthm

13
  • You might reach out to the package author (Michael Sharpe) directly.
    – John
    Jan 6, 2022 at 23:59
  • 1
    I'm not sure you're reading the documentation correctly. Up to version 1.65, \slshape and \textsl were abused to produce the “theorem font”, but now there's \thfamily to that effect. Nowhere it is said that a slanted font with upright punctuation and figures is available.
    – egreg
    Jan 7, 2022 at 0:00
  • @egreg: I only want to be able to use a slanted font with upright brackets in the body of theorems created using thmtools. I do not need any more general such slanted font.
    – murray
    Jan 8, 2022 at 1:59
  • @murray I know of no font that provides that.
    – egreg
    Jan 8, 2022 at 9:23
  • 1
    The newtx package author Michael Sharpe posted a new version, dated January 9, 2022, that includes a new option thmslshape allowing option bodyfont=\thfamily for the thmtools command \declaretheoremstyle. This makes the body text of theorems to be slanted (not italic) while keeping punctuation and numerals upright.
    – murray
    Jan 11, 2022 at 23:15

1 Answer 1

1

At least with newtx version 1.732, we get slanted text for the body of theorems (but upright parentheses and brackets there) by using option thmslshape (without option theoremfont) together with keyword value bodyfont=\thfamily in a thmtools theorem-style declaraion.

This works with both pdflatex and xelatex.

For example:

  \documentclass{article}
  \usepackage[amsthm,thmslshape]{newtx} % loads fontspec & amsthm, too
  
  \usepackage{thmtools}
  \swapnumbers
  \declaretheoremstyle[
    headfont=\sffamily\bfseries, headpunct={\sffamily\bfseries.},
    bodyfont=\thfamily,
  ]{thmstyle}
  \declaretheorem[style=thmstyle,name=Theorem]{theorem}
  
  \begin{document}
  
  \section{Here is a section}
  
  \begin{theorem}[Pythagorean theorem]
  
  In a right triangle [that is, with one angle a right angle],
  the square of the length of the hypotenuse (the slanted side if the legs are parallel to the axes!) equals
  the sum of the squares of the lengths of the other two sides.
  
  \end{theorem}
  
  In normal text that is \emph{emphasized (that is, by default italicized),} we do not get slanted.
  
  \end{document}

slanted theorem body font with newtx

2
  • With v1.734 the options thmslshape,theoremfont seem to work together fine
    – mbert
    Nov 19, 2023 at 4:47
  • @mbert: I believe you're correct that theoremfont here, when using thmtools, will do no harm. But it won't do any good, either, because, according to the docs, it merely affects the plain theormstyle when using amsthm without thmtools.
    – murray
    Nov 19, 2023 at 22:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .