Suppose I have a simple code like the following one:
\begin{theorem}
This is (theorem 1).
\end{theorem}
When you compile this code, you find that the two brackets are italized. Is there a way to make them normal ?!.
Thanks in advance.
Suppose I have a simple code like the following one:
\begin{theorem}
This is (theorem 1).
\end{theorem}
When you compile this code, you find that the two brackets are italized. Is there a way to make them normal ?!.
Thanks in advance.
The newtx and newpx font packages have a theoremfont option that produces italic text and upright delimiters in the plain style of amsthm. In other settings, the "theorem" font family can be accessed with \thfamily. Here is a sample taken from newtxdoc.tex:
\documentclass{article}
\usepackage{amsthm}
\usepackage[theoremfont]{newtxtext} % or newpxtext
\usepackage{newtxmath} % or newpxmath
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
This is Theorem Italic: text numbers are upright---12345;
punctuation is in many cases upright (also, parens (), braces
{} and brackets []). What about question marks and
exclamations? Also upright! [These fit better with math
mode punctuation and figures, like: for all $x\in[0,1]$,
let $f(x)\coloneq \exp(\alpha x)$].
\end{theorem}
{\itshape normal italics: ()[]?!123}
{\thfamily theorem italics: ()[]?!123}
\end{document}
If you want to achieve this effect with other fonts such as Computer Modern, you can resort to hacks like the one below. It uses the embrac package and borrows some of its internal code to define the \hussein_embrac_text:n command which makes the delimiters in its argument upright.* The command \embracifytheorem{<theorem>} redefines <theorem> so that it grabs its body and passes it to \hussein_embrac_text:n. This means it cannot contain any verbatim material.
*: We can't pass the body to the usual \textit, \emph, etc. because they are not "long" macros by default, i.e. they cannot contain \par.
\documentclass{article}
\usepackage{embrac}
\usepackage{amsthm}
\usepackage{xcolor}
\ExplSyntaxOn
\cs_new_protected:Npn \hussein_embrac_text:n #1
{
\tl_set:Nn \l__embrac_tmpa_tl {#1}
\embrac_replace_brackets:N \l__embrac_tmpa_tl
\l__embrac_tmpa_tl
}
\NewDocumentCommand { \embracifytheorem } { m }
{
\NewEnvironmentCopy { origenv_#1 } { #1 }
\RenewDocumentEnvironment { #1 } { O{} +b }
{
\begin{origenv_#1}[##1]
\hussein_embrac_text:n { ##2 }
\end{origenv_#1}
}
{}
}
\ExplSyntaxOff
% you can adjust or remove these to your liking
\AddOpEmph{?}[0pt,1pt]
\AddOpEmph{!}[0pt,1pt]
\AddOpEmph{:}[0pt,1pt]
\newtheorem{theorem}{Theorem}
\embracifytheorem{theorem}
\begin{document}
\begin{theorem}
This is \textcolor{red}{hacked} Theorem Italic: text numbers
are \textcolor{red}{not} upright---12345;
punctuation is in many cases upright (also, parens (), braces
{} and brackets []). What about question marks and
exclamations? Also upright! [These fit better with math
mode punctuation and figures, like: for all $x\in[0,1]$,
let $f(x)= \exp(\alpha x)$].
\end{theorem}
\end{document}
\textupor math. – barbara beeton Jan 21 '23 at 17:58theoremfontoption that does what you're looking for – mbert Nov 09 '23 at 01:21