Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 全面迁移到 tcolorbox #62

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 75 additions & 83 deletions LALUbook.cls
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
\DeclareBoolOption[false]{draft} % 是否打上未定稿标记
\DeclareBoolOption[true]{colors} % 是否让链接带颜色
\DeclareBoolOption[false]{CJKthechapter} % 是否让天眉的各章编号使用中文数字
\DeclareStringOption[]{coverpage} % 封面档档名, 默认为空
\DeclareStringOption{coverpage} % 封面档档名, 默认为空
\DeclareStringOption{fontsetup} % 字体设定档档名
\DeclareStringOption{titlesetup} % 章节标题设定档档名
\DeclareStringOption[16k]{geometry} % 版面(默认 16k)
Expand All @@ -42,7 +42,7 @@
\RequirePackage{bm}
\RequirePackage{mathrsfs}
\RequirePackage{amssymb}
\RequirePackage[intlimits]{mathtools}
\RequirePackage{mathtools}

% 加入字串处理功能
\RequirePackage{xstring}
Expand All @@ -65,7 +65,6 @@
\RequirePackage{tikz}

\RequirePackage[many]{tcolorbox}
\RequirePackage{mdframed}

% Package settings
% ----------------
Expand Down Expand Up @@ -121,71 +120,60 @@

\DeclareMathOperator{\diag}{diag}

\newenvironment{proof}{\fangsong}{\hspace*{\fill}$\square$\par}
\newenvironment{solution}{\fangsong}{\par}

\mdfdefinestyle{framestyle}{
ntheorem=true,
% roundcorner=10pt,
innertopmargin=\topskip,
theoremseparator={},
theoremspace=\quad,
frametitlerulewidth=.5pt,
frametitlerule=true,
linewidth=.5pt,
leftline=false,
rightline=false,
topline=true,
bottomline=true,
frametitlealignment=\raggedright\noindent,
\tcbset{commonstyle/.style={
breakable,
colframe=#1!50!black,
coltitle=black,
colbacktitle=#1!5,
colback=white,
fonttitle=\bfseries,
leftrule=0pt,
rightrule=0pt,
enhanced jigsaw,
sharp corners,
toptitle=1mm,
bottomtitle=1mm,
separator sign={\quad},
toprule=1pt,
titlerule=1pt,
bottomrule=1pt,
overlay first={
\draw[thick,#1!50!black,dashed]
(frame.south west) -- (frame.south east);
},
overlay middle={
\path[font=\small\heiti] (frame.north) node (cont) {续};
\draw[thick,#1!50!black,dashed]
(frame.north west) -- (cont.west)
(frame.north east) -- (cont.east)
(frame.south west) -- (frame.south east);
},
overlay last={
\path[font=\small\heiti] (frame.north) node (cont) {续};
\draw[thick,#1!50!black,dashed]
(frame.north west) -- (cont.west)
(frame.north east) -- (cont.east);
},
}
}

\NewTColorBox{tcblaluthmbox}{mmm}{
commonstyle={teal},
colframe=teal!80!black,
title=#1\IfBlankF{#2}{\quad#2},
#3,
}

\mdtheorem[
style=framestyle,
linecolor=red!50!black,
frametitlebackgroundcolor=red!5,
]{definition}{定义}[chapter]
\mdtheorem[
style=framestyle,
linecolor=blue!50!black,
frametitlebackgroundcolor=blue!5,
]{example}{例}[chapter]
\mdtheorem[
style=framestyle,
linecolor=orange!50!black,
frametitlebackgroundcolor=orange!5,
]{lemma}{引理}[chapter]
\mdtheorem[
style=framestyle,
linecolor=violet!50!black,
frametitlebackgroundcolor=violet!5,
]{theorem}{定理}[chapter]
\mdtheorem[
style=framestyle,
linecolor=green!50!black,
frametitlebackgroundcolor=green!5,
]{corollary}{推论}[chapter]
\mdtheorem[
style=framestyle,
linecolor=olive!50!black,
frametitlebackgroundcolor=olive!5,
]{axiom}{公理}[chapter]
\surroundwithmdframed[
style=framestyle,
linecolor=teal!80!black,
frametitlebackgroundcolor=teal!5,
frametitle={\noindent\bfseries\heiti 证明},
% frametitleaboveskip=\topskip,
% frametitlebelowskip=\topskip,
]{proof}
\surroundwithmdframed[
style=framestyle,
linecolor=teal!80!black,
frametitlebackgroundcolor=teal!5,
frametitle={\noindent\bfseries\heiti 解},
% frametitleaboveskip=\topskip,
% frametitlebelowskip=\topskip,
]{solution}
\NewDocumentEnvironment{proof}{O{}O{}}{\begin{tcblaluthmbox}{{\heiti 证明}}{#1}{#2}\fangsong}{\hspace*{\fill}$\square$\end{tcblaluthmbox}}
\NewDocumentEnvironment{solution}{O{}O{}}{\begin{tcblaluthmbox}{{\heiti 解}}{#1}{#2}\fangsong}{\end{tcblaluthmbox}}

\newcommand{\Ob}{\mathop\mathrm{Ob}}
\newcommand{\cC}{\mathcal{C}}
\newcommand{\cD}{\mathcal{D}}
\newcommand{\Hom}{\mathop\mathrm{Hom}}
\newcommand{\FVect}{\mathsf{FVect}}
\newcommand{\Set}{\mathsf{Set}}
\newcommand{\FSet}{\mathsf{FSet}}

\AtEndPreamble{
\RequirePackage[Bjornstrup]{fncychap} % found on Internet
Expand All @@ -195,19 +183,26 @@
\RequirePackage{bookmark}
\RequirePackage{cleveref}

\newtcbtheorem[number within=chapter]{definition}{定义}{commonstyle={red}}{def}
\newtcbtheorem[number within=chapter]{example}{例}{commonstyle={blue}}{ex}
\newtcbtheorem[number within=chapter]{lemma}{引理}{commonstyle={orange}}{lem}
\newtcbtheorem[number within=chapter]{theorem}{定理}{commonstyle={violet}}{thm}
\newtcbtheorem[number within=chapter]{corollary}{推论}{commonstyle={green}}{cor}
\newtcbtheorem[number within=chapter]{axiom}{公理}{commonstyle={olive}}{axm}

\hypersetup{
unicode,
bookmarksnumbered,
pdfborder = {0 0 0},
pdfborder={0 0 0},
}

% 按 colors 的 Bool 值设置链接色彩.
\if@LALU@colors
\hypersetup{
colorlinks,
% linkcolor = blue,
% citecolor = red,
% urlcolor = teal
% linkcolor=blue,
% citecolor=red,
% urlcolor=teal
}
\else
\hypersetup{hidelinks}
Expand All @@ -216,20 +211,17 @@
\renewcommand{\figureautorefname}{图}
\renewcommand{\tableautorefname}{表}
\renewcommand{\equationautorefname}{式}
\renewcommand{\theoremautorefname}{定理}
\renewcommand{\chapterautorefname}{章}
\renewcommand{\sectionautorefname}{节}
\newcommand{\lemmaautorefname}{引理}
\newcommand{\corollaryautorefname}{推论}
\newcommand{\exampleautorefname}{例}
\newcommand{\definitionautorefname}{定义}
\newcommand{\axiomautorefname}{公理}
\newcommand{\Ob}{\mathop\mathrm{Ob}}
\newcommand{\cC}{\mathcal{C}}
\newcommand{\cD}{\mathcal{D}}
\newcommand{\Hom}{\mathop\mathrm{Hom}}
\newcommand{\FVect}{\mathsf{FVect}}
\newcommand{\Set}{\mathsf{Set}}
\newcommand{\FSet}{\mathsf{FSet}}
\makeatletter
\newcommand{\tcb@cnt@theoremautorefname}{定理}
\newcommand{\tcb@cnt@lemmaautorefname}{引理}
\newcommand{\tcb@cnt@corollaryautorefname}{推论}
\newcommand{\tcb@cnt@exampleautorefname}{例}
\newcommand{\tcb@cnt@definitionautorefname}{定义}
\newcommand{\tcb@cnt@axiomautorefname}{公理}
\makeatother

\crefrangeformat{equation}{式~#3#1#4--#5#2#6}
\crefrangeformat{example}{例~#3#1#4--#5#2#6}
}
5 changes: 4 additions & 1 deletion latexmk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ gh-cp: all
cp -p $(FILENAME).pdf ../$(GH_ACTIONS_DIR)/$(CPNAME).pdf

clean:
@rm -f *.aux *.log *.idx *.ind *.ilg *.thm *.toc *.blg *.bbl *.bcf *.out *.fls *.fdb_latexmk *.run.xml *.synctex.gz *.xdv *~ *.lof *.lot
rm -f *.aux *.log *.idx *.ind *.ilg *.thm *.toc *.blg *.bbl *.bcf *.out *.fls *.fdb_latexmk *.run.xml *.synctex.gz *.xdv *~ *.lof *.lot
ifdef CPNAME
rm -f $(CPNAME).pdf $(CPNAME).tex
endif
Empty file removed 习题参考答案/README.md
Empty file.
26 changes: 13 additions & 13 deletions 习题参考答案/专题/10 矩阵运算进阶(I).tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ \section*{10 矩阵运算进阶(I)}

\item $Q = (\alpha_1+\alpha_2,\alpha_2,\alpha_3)=(\alpha_1,\alpha_2,\alpha_3)\begin{pmatrix}1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 1\end{pmatrix}=P\begin{pmatrix}1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 1\end{pmatrix}$.

记 $E_{12}(1)=\begin{pmatrix}1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 1\end{pmatrix}$,有 $Q^{-1}AQ=E_{12}(1)^{-1}P^{-1}APE_{12}(1)=\begin{pmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 2\end{pmatrix}$.
记 $E_{12}(1)=\begin{pmatrix}1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 1\end{pmatrix}$,有 $Q^{-1}AQ=E_{12}(1)^{-1}P^{-1}APE_{12}(1)=\begin{pmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 2\end{pmatrix}$.

\item 我们只求解第一个矩阵的逆,第二个方法类似. 事实上正文例题中也有类似的,本题甚至更简单,因为左下角已经是零矩阵,所以不再需要``打这个洞''. 设$A$和$D$分别是$m$、$n$阶矩阵,我们首先将第二个分块行左乘$-BD^{-1}$加到第一个分块行,目的很明确,就是把右上角的洞打出来:
\[\left(\begin{array}{cc:cc}
A & B & E_m & O \\ O & D & O & E_n
\end{array}\right)\rightarrow\left(\begin{array}{cc:cc}
A & O & E_m & -BD^{-1} \\ O & D & O & E_n
\end{array}\right),\]
接下来再用$A^{-1}$和$D^{-1}$分别左乘第一分块行和第二分块行,得到
\[\left(\begin{array}{cc:cc}
E_m & O & A^{-1} & -A^{-1}BD^{-1} \\ O & E_n & O & D^{-1}
\end{array}\right),\]
由此可得原矩阵的逆就是上述虚线右侧的$\begin{pmatrix}
A^{-1} & -A^{-1}BD^{-1} \\ O & D^{-1}
\end{pmatrix}$.
\[\left(\begin{array}{cc:cc}
A & B & E_m & O \\ O & D & O & E_n
\end{array}\right)\rightarrow\left(\begin{array}{cc:cc}
A & O & E_m & -BD^{-1} \\ O & D & O & E_n
\end{array}\right),\]
接下来再用$A^{-1}$和$D^{-1}$分别左乘第一分块行和第二分块行,得到
\[\left(\begin{array}{cc:cc}
E_m & O & A^{-1} & -A^{-1}BD^{-1} \\ O & E_n & O & D^{-1}
\end{array}\right),\]
由此可得原矩阵的逆就是上述虚线右侧的$\begin{pmatrix}
A^{-1} & -A^{-1}BD^{-1} \\ O & D^{-1}
\end{pmatrix}$.
\end{enumerate}

\centerline{\heiti B组}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ \section*{12 矩阵运算进阶(II)}
2 & 4 & 2 \\
0 & 0 & 2
\end{pmatrix} \begin{pmatrix} a_{n - 1} \\ b_{n - 1} \\ 2^{n - 1} \end{pmatrix} \\
& = \cdots \\
& = \cdots \\
& = \begin{pmatrix}
3 & 1 & 1 \\
2 & 4 & 2 \\
Expand Down
22 changes: 11 additions & 11 deletions 习题参考答案/专题/13 行列式.tex
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ \section*{13 行列式}
1 & 0 & 0 & 0 \\
0 & -7 & 8 & 3 \\
5 & -2 & -7 & -3
\end{vmatrix} \\
\end{vmatrix} \\
& = (-1)^{2+1} \begin{vmatrix}
-3 & 1 & -1 \\
-7 & 8 & 3 \\
Expand All @@ -161,7 +161,7 @@ \section*{13 行列式}
2 & 1 & 1 & 4 \\
1 & 0 & 1 & 0 \\
5 & 1 & -2 & 2
\end{vmatrix} \\
\end{vmatrix} \\
& = 3 \begin{vmatrix}
3 & 0 & 1 & 1 \\
2 & 1 & -1 & 4 \\
Expand All @@ -172,7 +172,7 @@ \section*{13 行列式}
0 & 1 & 1 \\
1 & -1 & 4 \\
3 & -7 & 2
\end{vmatrix} \\
\end{vmatrix} \\
& = -12
\end{align*}

Expand All @@ -184,7 +184,7 @@ \section*{13 行列式}
2 & 3 & 1 & 4 \\
0 & -7 & 8 & 3 \\
-1 & 1 & -1 & 1
\end{vmatrix} \\
\end{vmatrix} \\
& = \begin{vmatrix}
3 & 3 & 1 & 4 \\
2 & 5 & -1 & 6 \\
Expand Down Expand Up @@ -325,7 +325,7 @@ \section*{13 行列式}
(A^*)^2 & = \begin{pmatrix}a_1 \\ a_2 \\ \vdots \\ a_n \end{pmatrix}
(\lambda_1, \lambda_2, \ldots, \lambda_n)
\begin{pmatrix} a_1 \\ a_2 \\ \vdots \\ a_n \end{pmatrix}
(\lambda_1, \lambda_2, \ldots, \lambda_n) \\
(\lambda_1, \lambda_2, \ldots, \lambda_n) \\
& = \begin{pmatrix} a_1 \\ a_2 \\ \vdots \\ a_n \end{pmatrix} \cdot k
\cdot (\lambda_1, \lambda_2, \ldots, \lambda_n) = k
\begin{pmatrix} a_1 \\ a_2 \\ \vdots \\ a_n \end{pmatrix}
Expand Down Expand Up @@ -611,13 +611,13 @@ \section*{13 行列式}
两侧取伴随有
\begin{align*}
& \left(\begin{pmatrix}
E & O \\
-CA^{-1} & E
\end{pmatrix}
E & O \\
-CA^{-1} & E
\end{pmatrix}
\begin{pmatrix}
A & B \\
C & D
\end{pmatrix}\right)^*
A & B \\
C & D
\end{pmatrix}\right)^*
= \begin{pmatrix}
A & B \\
C & D
Expand Down
Loading