bodyfont=\mdseries\itshape
當在定理樣式定義中使用宣告時,是否可以使定理主體中的方括號直立顯示thmtools
?
包的使用方法embrac
(從 newtxtext 複製 theoremfont 選項) 不起作用,因為正如embrac
文件所述,它僅影響\emph
, \textit
, 和 ,textsl
但不影響\itshape
或\slshape
。
尤其:有沒有辦法避免使用\itshape
(或\slshape
) 但仍在定理主體中獲得斜體(或分別傾斜)thmtools
使用?定義定理樣式時(當然,所需的直立支架除外)。
例子:
\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}
我知道答案如何在整個文件中獲得正括號?,正如它所說,這會破壞事物。
答案1
從版本 0.8 (2019/10/01) 開始,embrac
提供了\embparen
和\embbracket
對於這樣的情況:
\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 \embbracket{see section 2} of a set $X$.Then
\[ X \setminus (A \cup B) = (X \setminus A) \cap (X \setminus B). \]
\end{theorem}
\end{document}
答案2
如果您願意放棄定理中的逐字材料,則可以使用embrac
的\embrac_replace_brackets:N
命令處理定理的主體。
\documentclass{article}
\usepackage{embrac}
\usepackage{amsthm,thmtools}
\ExplSyntaxOn
\cs_new_protected:Npn \murray_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 }
{
\IfNoValueTF{##1}
{\begin{origenv_#1}}
{\begin{origenv_#1}[##1]}
\murray_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]
\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}
\embracifytheorem{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}