我已经创建了一个 tcolorbox 环境来编写证明。
这是我的代码:
\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox{proof}{
fonttitle=\bfseries,
enhanced,
top=0mm,
boxrule=0pt,frame empty,
borderline west={4pt}{0pt}{blue},
coltitle=blue,
colback=white,
sharp corners,
title=Proof
}
\begin{proof}
Let's show that girls are Evil.
\begin{adjustwidth}{5mm}{0mm}
Girls require time and money
\begin{equation}
girls = time \times money
\end{equation}
Time is money
\begin{equation}
time = money
\end{equation}
So girls are money squared:
\begin{equation}
girls = money^2
\end{equation}
Money is the root of all evil
\begin{equation}
money = \sqrt{evil}
\end{equation}
So, girls are evil:
\begin{equation}
girls = \left(\sqrt{evil}\right)^2 = evil
\end{equation}
\end{adjustwidth}
We have shown that girls are Evil.
\end{proof}
% From https://www.onlinemathlearning.com/funny-math-proofs.html
现在,我希望蓝色的平方会自动添加到证明的末尾(最后一行的最末尾),例如这里。我不知道如何在证明环境定义中指定这一点。
答案1
使用该ntheorem
包,您可以自动将证明结束符号放置在最后一行的末尾,包括最后一行是等式的情况:
\documentclass{article}
\usepackage{fourier}
\usepackage{amsmath, amssymb}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\usepackage{changepage}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\theoremstyle{nonumberbreakn}
\theoremheaderfont{\scshape\color{blue}}
\theoremseparator{:\smallskip}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\color{blue}\blacksquare}}
\newtheorem{proof}{Proof}
\tcolorboxenvironment{proof}{
fonttitle=\bfseries,
enhanced,
top=0mm,
boxrule=0pt,frame empty,
borderline west={4pt}{0pt}{blue},
coltitle=blue,
colback=white,
sharp corners
}
\begin{document}
\begin{proof}
Let's show that girls are Evil.
\begin{adjustwidth}{5mm}{0mm}
Girls require time and money
\begin{equation}
girls = time \times money
\end{equation}
Time is money
\begin{equation}
time = money
\end{equation}
So girls are money squared:
\begin{equation}
girls = money^2
\end{equation}
Money is the root of all evil
\begin{equation}
money = \sqrt{evil}
\end{equation}
So, girls are evil:
\begin{equation*}
girls = \left(\sqrt{evil}\right)^2 = evil
\end{equation*}
\end{adjustwidth}
% We have shown that girls are Evil.
\end{proof}
\end{document}
答案2
添加线条
\usepackage{amssymb}% defines \blacksquare
\AtEndEnvironment{proof}{\null\hfill\textcolor{blue}{$\blacksquare$}}
到你的序言中;如果符号太大,则\blacksquare
用替换。\square
etoolbox
对于2020/10/01之前的 LaTeX 版本,使用之前需要先安装该软件包\AtEndEnvironment
。
\documentclass{article}
\usepackage{amssymb}
\AtEndEnvironment{proof}{\null\hfill\textcolor{blue}{$\blacksquare$}}%
\usepackage{changepage}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox{proof}{
fonttitle=\bfseries,
enhanced,
top=0mm,
boxrule=0pt,frame empty,
borderline west={4pt}{0pt}{blue},
coltitle=blue,
colback=white,
sharp corners,
title=Proof
}
\begin{document}
\begin{proof}
Let's show that girls are Evil.
\begin{adjustwidth}{5mm}{0mm}
So, girls are evil:
\begin{equation}
girls = \left(\sqrt{evil}\right)^2 = evil
\end{equation}
\end{adjustwidth}
We have shown that girls are Evil.
\end{proof}
\end{document}
改编自这个答案