bodyfont=\mdseries\itshape
当在定理样式的定义中使用声明时,是否可以使定理主体中的方括号直立显示thmtools
?
使用该包的方法embrac
(从 newtxttext 复制 theoremfont 选项) 不起作用,因为正如embrac
文档所说,它只影响\emph
、\textit
和 ,textsl
但不影响\itshape
或\slshape
。
尤其:有没有办法避免使用\itshape
(或\slshape
),但仍然在定理主体中获得斜体(或倾斜)当使用 ? 定义 theoremstyle 时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}