我想amsthm
稍微定制一下命令,但是在(未记录的?).sty 中找不到相关的行。
我怎样才能把颜色框放在姓名环境
\newtheoremstyle{Coloredtheo}% {3pt} %Space above {3pt} %Space below {} %Body font {} %Indent amount {\bf \colorbox{blue}} %Theorem head font {} %Punctuation after theorem head {0.25em} %Space after theorem head {} %Theorem head spec
其中蓝色框应与定理头的大小相同。
如何删除可选参数的括号
\begin{theorem}[Schwarz inequality]...
不应该是(Schwarz 不等式)而是 Schwarz 不等式。
答案1
\makeatletter
\newtheoremstyle{Coloredtheo}%
{3pt} %Space above
{3pt} %Space below
{} %Body font
{} %Indent amount
{\bfseries} %Theorem head font
{} %Punctuation after theorem head
{0.25em} %Space after theorem head
{\colorbox{\thmbgcolor}{\color{\thmheadcolor}\thmname{#1}%
\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}}%
\thmnote{ {--- \the\thm@notefont#3.}}%
} %Theorem head spec
\makeatother
\theoremstyle{Coloredtheo}
\newtheorem{genericcolorthm}{\generichead}
\newenvironment{colorthm}
{\def\generichead{Theorem}%
\def\thmbgcolor{blue}%
\def\thmheadcolor{red}%
\begin{genericcolorthm}}
{\end{genericcolorthm}}
\newenvironment{colorlemma}
{\def\generichead{Lemma}%
\def\thmbgcolor{green}%
\def\thmheadcolor{black}%
\begin{genericcolorthm}}
{\end{genericcolorthm}}
通过定理样式定义中的两个命令,您可以自由地赋予它们在环境中局部的含义。
答案2
1 - 如何在环境名称下放置一个颜色框...其中蓝色框应与定理头的大小相同。
看看thmtools
包。它提供了一个很好的 key-val 接口来声明各种漂亮的类定理环境。
答案3
2 - 如何删除可选参数的括号
\begin{theorem}[Schwarz inequality]...
不应该是(Schwarz 不等式)而是 Schwarz 不等式。
将其放入序言中:
\newtheorem*{schwarz}{Schwarz Inequality}
然后在文档中:
\begin{schwarz}
% ``I see your Schwarz is as big as mine.'' --- Dark Helmet, Spaceballs
\end{schwarz}
编辑我想我现在明白你想要什么了。如果你不想要一次性的环境,你可以改变定理的头部规范,只排版定理注释(可选参数),而不使用分隔符,如下所示:
\documentclass{minimal}
\usepackage{amsthm}
\makeatletter
\newtheoremstyle{namedtheorem}%
{3pt} %Space above
{3pt} %Space below
{} %Body font
{} %Indent amount
{\bfseries} %Theorem head font
{.} %Punctuation after theorem head
{0.25em} %Space after theorem head
{\thmname{\@ifempty{#3}{#1}\@ifnotempty{#3}{#3}}}
\makeatother
\theoremstyle{namedtheorem}
% first argument here is the environment to be defined
% second argument is the default name of the theorem.
\newtheorem*{namedtheorem}{Theorem}
\begin{document}
\begin{namedtheorem}
One is the loneliest number.
\end{namedtheorem}
\begin{namedtheorem}[Schwarz Inequality]
For $x$ and $y$ in a Hilbert space $H$,
\[
|(x,y) | \leq \Vert x \Vert \cdot \Vert y \Vert
\]
\end{namedtheorem}
\end{document}