定理正文中的直括號與 bodyfont=\mdseries\itshape?

定理正文中的直括號與 bodyfont=\mdseries\itshape?

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}

特姆

相關內容