![在定理风格中,如何使点字体依赖于名称字体?](https://linux22.com/image/314865/%E5%9C%A8%E5%AE%9A%E7%90%86%E9%A3%8E%E6%A0%BC%E4%B8%AD%EF%BC%8C%E5%A6%82%E4%BD%95%E4%BD%BF%E7%82%B9%E5%AD%97%E4%BD%93%E4%BE%9D%E8%B5%96%E4%BA%8E%E5%90%8D%E7%A7%B0%E5%AD%97%E4%BD%93%EF%BC%9F.png)
我必须使用该thmtools
包来设计我的定理、引理、注释等。
不幸的是,我注意到,当我为注释提供一个可选名称时,例如,该名称采用正常字体,但其后的点采用粗体,并且非常突出,在我看来不太好看!
当没有可选名称时,我希望以粗体字体显示名称备注和点;当有一个可选名称时,我希望以普通字体显示点。我该怎么做?
这是我的 MWE:
\documentclass{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{thmtools}
\declaretheoremstyle[spaceabove=6pt plus 0pt minus 2pt, spacebelow=0pt plus 0pt minus 2pt, headfont=\bfseries, bodyfont=\normalfont, postheadspace=5pt plus 1pt minus 1pt]{myremstyle}
\declaretheorem[style=myremstyle,name=Remarque,numbered=no]{rem}
\begin{document}
\begin{rem}[not quite nice effect]
\end{rem}
\end{document}
答案1
由于我不明白的原因,注释被排版成组。无论如何,解决方法并不好,因为您需要headformat
在定义的所有样式中指定。
\documentclass{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{thmtools}
\usepackage{etoolbox}
\makeatletter
% don't typeset the note in a group, so the punctuation inherits
% the font specification of the note
\patchcmd{\thmt@setheadstyle}
{\bgroup\thmt@space}
{\thmt@space}
{}{}
\patchcmd{\thmt@setheadstyle}
{\egroup\fi}
{\fi}
{}{}
\makeatother
\declaretheoremstyle[
spaceabove=6pt plus 0pt minus 2pt,
spacebelow=0pt plus 0pt minus 2pt,
headfont=\bfseries,
bodyfont=\normalfont,
postheadspace=5pt plus 1pt minus 1pt,
headformat=\NAME\NOTE,
]{myremstyle}
\declaretheoremstyle[
spaceabove=6pt plus 0pt minus 2pt,
spacebelow=0pt plus 0pt minus 2pt,
headfont=\bfseries,
bodyfont=\normalfont,
postheadspace=5pt plus 1pt minus 1pt,
headformat=\NAME\ \NUMBER\NOTE,
]{myfoostyle}
\declaretheorem[
style=myremstyle,
name=Remarque,
numbered=no
]{rem}
\declaretheorem[
style=myfoostyle,
name=Foo,
]{foo}
\begin{document}
\begin{rem}[nice effect]
Some remark
\end{rem}
\begin{rem}
Some remark
\end{rem}
\begin{foo}[nice effect]
Some foo
\end{foo}
\begin{foo}
Some foo
\end{foo}
\end{document}
答案2
如果有注释,则可以使用headformat
with \NAME
、\NUMBER
、\NOTE
和 apply :\normalfont
\documentclass{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{thmtools}
\declaretheoremstyle[
spaceabove=6pt plus 0pt minus 2pt,
spacebelow=0pt plus 0pt minus 2pt,
headfont=\bfseries,
bodyfont=\normalfont,
postheadspace=5pt plus 1pt minus 1pt,
headformat={\NAME~\NUMBER\NOTE\if\empty\relax\else\normalfont\fi}
]{myremstyle}
\declaretheorem[style=myremstyle,name=Remarque,numbered=no]{rem}
\begin{document}
\begin{rem}[quite nice effect]
test text.
\end{rem}
\begin{rem}
test text.
\end{rem}
\end{document}
结果: