在 Legrand Orange Book 模板中,我想将示例框的开始和结束颜色从黑色更改为赭色:
以下是示例环境所在的 structure.tex 文件中的代码:
\definecolor{ocre}{RGB}{243,102,25}
% Creates an environment for each type of theorem and assigns it a theorem text style from the "Theorem Styles" section above and a colored box from above
\newenvironment{theorem}{\begin{tBox}\begin{theoremeT}}{\end{theoremeT}\end{tBox}}
\newenvironment{exercise}{\begin{eBox}\begin{exerciseT}}{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciseT}\end{eBox}}
\newenvironment{definition}{\begin{dBox}\begin{definitionT}}{\end{definitionT}\end{dBox}}
\newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}}
\newenvironment{corollary}{\begin{cBox}\begin{corollaryT}}{\end{corollaryT}\end{cBox}}
你能告诉我如何进行更改吗?
答案1
环境example
使用exampleT
定义为定理结构的环境,blacknumex
其样式在开头添加了小方块。您可以定义类似的样式,blacknumexocresq
使用 ocre 颜色的方块和exampleM
使用此样式的结构。重新定义example
以exampleM
代替exampleT
(或使用 定义另一个环境exampleM
):
\documentclass{book}
\input{structure}
\makeatletter
\newtheoremstyle{blacknumexocresq}% Theorem style name
{5pt}% Space above
{5pt}% Space below
{\normalfont}% Body font
{} % Indent amount
{\small\bf\sffamily}% Theorem head font
{\;}% Punctuation after theorem head
{0.25em}% Space after theorem head
{\small\sffamily{\textcolor{ocre}{\tiny\ensuremath{\blacksquare}}}\nobreakspace\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1)
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}% Optional theorem note
\makeatother
\theoremstyle{blacknumexocresq}
\newtheorem{exampleM}{Example}[chapter]
\renewenvironment{example}{\begin{exampleM}}{\hfill{\textcolor{ocre}{\tiny\ensuremath{\blacksquare}}}\end{exampleM}}
\begin{document}
\begin{example}{My text}
Some test text goes here to illustrate the use of the box defined for text to illustrate the use of the box defined for text to illustrate the use of the box defined for text.
\end{example}
\end{document}