Is it possible to make square brackets in the body of a theorem appear upright — when using the declaration bodyfont=\mdseries\itshape in the definition of a theoremstyle with thmtools?
The method of using the package embrac(Copy theoremfont option from newtxtext) does not work, because as the embrac documentation says, it affects only \emph, \textit, and textsl but not \itshape or \slshape.
In particular: is there a way to avoid using \itshape (or \slshape) yet still obtain italic (or slant, respectively) in the body of a theorem when the theoremstyle is defined using thmtools? (except for the desired upright brackets, of course).
Example:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{embrac}
\usepackage{thmtools}
\makeatletter
\declaretheoremstyle[
headfont= \sffamily\bfseries,
headpunct={\sffamily\bfseries.},
postheadspace=0.5em,
notefont=\sffamily\bfseries,
headformat=\NAME\NUMBER\let\thmt@space@empty\NOTE,
bodyfont=\mdseries\itshape,
spaceabove=12pt,spacebelow=12pt,
]{thmstyle}
\makeatother
\theoremstyle{thmstyle}% default
\declaretheorem[name=Theorem,numberwithin=section]{theorem}
\begin{document}
\section{A section}
\begin{theorem}
Let $A$ and $B$ be subsets [see section 2] of a set $X$.Then
[
X \setminus (A \cup B) = (X \setminus A) \cap (X \setminus B).
]
\end{theorem}
\end{document}
I am aware of the answer to How to get upright parentheses in the whole document?, which, as it says, will break things.



\textup[or\textup]. Braces around the square brackets aren't necessary, since\textupoperates on only the next token, and a single character here is the token. (A long time ago, there was a discussion about creating a "theorem font", italic with upright punctuation. But it never happened, as the complications weren't easy to work around.) – barbara beeton Dec 03 '19 at 04:44\textup, but I was hoping for something more high-level -- a way to do what thetheoremfontoption ofnewtxtextdoes automatically. – murray Dec 03 '19 at 15:31\itshapeorslshapeas value for optionbodyfontin\declaretheoremstylefromthmtools(i.e., somehow use\textitor\textslthere), so thatembracwould work. – murray Dec 03 '19 at 18:16scholaxpackage includes a style optiontheoremfontthat does make text parentheses, brackets, and braces upright. The method seems to be simply:\DeclareRobustCommand\thfamily {\not@math@alphabet\thfamily\relax \fontfamily\thdefault\selectfont} \AtEndPreamble{\patchcmd{\th@plain}{\itshape}{\thfamily}{}{}} % \newcommand*{\thdefault}{\rmdefault}– murray Feb 06 '20 at 18:19scholaxdoes not seem to work if I usethmtoolsand declare the theorem style body font to be\slshape. – murray Feb 09 '20 at 17:43\itshapeinstead of\textitor\emphinamsthmis that\itshapecontinues through paragraph breaks and math displays, while the commands taking arguments do not. It might be possible to define something like\aside{1}{\textup[#1\/\textup]}to handle such insertions. Not tested. – barbara beeton Nov 13 '23 at 01:35