0

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.

1 Answers1

2

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}

With newtx

newtx

With newpx

newpx

I do not recommend this

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}

cm

mbert
  • 4,171