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}
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:
I am aware of two workarounds:
- load package embrac and then use
\embbracket{...}for the bracketed text; or - 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?
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}




\slshapeand\textslwere abused to produce the “theorem font”, but now there's\thfamilyto that effect. Nowhere it is said that a slanted font with upright punctuation and figures is available. – egreg Jan 07 '22 at 00:00theoremfontis included) with amsthm theorems, I was hoping there was some way it could be done with thmtools theorems. – murray Jan 09 '22 at 20:50theoremfontoption to newtx, I do get upright brackets, parentheses, numerals in the otherwise slanted theorem body text. See the "Added: comparison..." in my question. – murray Jan 09 '22 at 21:45thmslshapeallowing optionbodyfont=\thfamilyfor 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 '22 at 23:15thmslshapeoption fornewtxwithbodyfont=\thfamilyfor\declaretheoremstyle: parentheses and brackets disappear from the body of theorems! I'm afraid I'm not understanding the interaction amontnewtxoptionstheoremfont,trueslantedandthmslshape. – murray Nov 14 '23 at 02:39thmslshapeproduces a bunch of "glyph undefined" warnings. – mbert Nov 14 '23 at 17:02