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

murray
  • 7,944
  • You might reach out to the package author (Michael Sharpe) directly. – John Jan 06 '22 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 07 '22 at 00: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 08 '22 at 01:59
  • @murray I know of no font that provides that. – egreg Jan 08 '22 at 09:23
  • @egreg: Since the newtx packages do what I want (when option theoremfont is included) with amsthm theorems, I was hoping there was some way it could be done with thmtools theorems. – murray Jan 09 '22 at 20:50
  • @murray You don't get upright punctuation and numerals, do you? – egreg Jan 09 '22 at 21:16
  • @egreg: Yes, with amsthm (instead of thmtools) and the theoremfont option 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:45
  • @murray I see slanted punctuation in the first image with slanted type, and upright punctuation with italic type in the second image. Nowhere I see upright punctuation and slanted type. – egreg Jan 09 '22 at 22:04
  • @murray To be more precise, in the last image, what you call “slanted” is clearly italic. – egreg Jan 09 '22 at 22:40
  • 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 '22 at 23:15
  • @murray Perhaps you can write this as an answer to your question? – mbert Nov 11 '23 at 21:36
  • @mbert: Something's wrong now when I try using thmslshape option for newtx with bodyfont=\thfamily for \declaretheoremstyle: parentheses and brackets disappear from the body of theorems! I'm afraid I'm not understanding the interaction amont newtx options theoremfont, trueslanted and thmslshape. – murray Nov 14 '23 at 02:39
  • Hmm yes adding thmslshape produces a bunch of "glyph undefined" warnings. – mbert Nov 14 '23 at 17:02

1 Answers1

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

murray
  • 7,944
  • With v1.734 the options thmslshape,theoremfont seem to work together fine – mbert Nov 19 '23 at 04: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 '23 at 22:39