![我如何在 LaTeX 中制作这个框?](https://linux22.com/image/471019/%E6%88%91%E5%A6%82%E4%BD%95%E5%9C%A8%20LaTeX%20%E4%B8%AD%E5%88%B6%E4%BD%9C%E8%BF%99%E4%B8%AA%E6%A1%86%EF%BC%9F.png)
正如标题所示,我不知道如何制作这样的框,我需要一个确切的框来记录我的化学笔记。任何帮助都将不胜感激,因为我是 LaTeX 新手。
背景:这张图片来自一位讲师的一份文件
他也链接了他的 GitHub 代码,但那里\begin{eq}
并没有解释他是如何使他的盒子看起来像这样的。
答案1
正如大家在评论中所说,代码是在preamble.tex
github 上的文件中定义的。我不确定在这里展示一些代码是否有助于您学习。但是,我决定这样做。这是一个示例,使用来自 github 的完全相同的定义(仅包含示例、证明和定义)。
\documentclass{report}
\usepackage[dvipsnames]{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\mdfsetup{skipabove=1em,skipbelow=0em}
\declaretheoremstyle[
headfont=\bfseries\sffamily\color{ForestGreen!70!black}, bodyfont=\normalfont,
mdframed={
linewidth=2pt,
rightline=false, topline=false, bottomline=false,
linecolor=ForestGreen, backgroundcolor=ForestGreen!5,
}
]{thmgreenbox}
\declaretheoremstyle[
headfont=\bfseries\sffamily\color{NavyBlue!70!black}, bodyfont=\normalfont,
mdframed={
linewidth=2pt,
rightline=false, topline=false, bottomline=false,
linecolor=NavyBlue, backgroundcolor=NavyBlue!5,
}
]{thmbluebox}
\declaretheoremstyle[
headfont=\bfseries\sffamily\color{NavyBlue!70!black}, bodyfont=\normalfont,
numbered=no,
mdframed={
linewidth=2pt,
rightline=false, topline=false, bottomline=false,
linecolor=NavyBlue, backgroundcolor=NavyBlue!1,
},
]{thmexplanationbox}
\declaretheorem[style=thmgreenbox, name=Definition]{definition}
\declaretheorem[style=thmbluebox, numbered=no, name=Example]{eg}
\declaretheorem[style=thmexplanationbox, name=Proof]{tmpexplanation}
\newenvironment{explanation}[1][]{\vspace{-10pt}\begin{tmpexplanation}}{\end{tmpexplanation}}
\begin{document}
\begin{eg}
Suppose we have a functor.
If $G_X \not\cong G_Y$, then $X$ and $Y$ are not homeomorphic.
If `shadows' are different, then objects themselves are different too.
\end{eg}
\begin{explanation}
Suppose $X$ and $Y$ are homeomorphic.
Then $\exists f: X \to Y$ and $g: Y \to X$, maps (maps are always continuous in this course), such that $g \circ f = 1_X$ and $f \circ g = 1_Y$.
Then $f_*: G_X \to G_Y$ and $g_*: G_Y \to G_X$ such that $(g \circ f)_* = (1_X)_*$ and $(f \circ g)_* = (1_Y)_*$. Using the rules discussed previously, we get
\[
g_* \circ f_* = 1_{G_X} \quad f_* \circ g_* = 1_{G_Y}
,\]
which means that $f_* : G_X \to G_Y$ is an isomorphism.
\end{explanation}
\begin{definition}[Homotopy]
Let $f,g:X\to Y$ be maps (so continuous). Then a homotopy between $f$ and $g$ is a continuous map $H: X\times I \to Y$ such that
\begin{itemize}
\item $H(x, 0) = f(x)$, $H(x, 1) = g(x)$
\item For all $t \in I$, define $f_t: X \to Y: x \mapsto H(x, t)$
\end{itemize}
We say that $f$ is homotopic with $g$, we write $f \simeq g$.
If $g$ is a constant map, we say that $f$ is null homotopic.
\end{definition}
\end{document}