Files
LaTeX/note/note-setup-mdframed.tex
2026-01-14 09:57:04 +08:00

158 lines
5.9 KiB
TeX

%================================
% note-setup-mdframed.tex
% fenglielie@qq.com 2025-10-22
%================================
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{bm}
\usepackage{extarrows}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{anyfontsize}
\usepackage{booktabs,multirow,multicol}
\usepackage[shortlabels,inline]{enumitem}
\usepackage{appendix}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\graphicspath{
{./figure/}{./figures/}{./image/}{./images/}{./graphic/}{./graphics/}{./picture/}{./pictures/}
}
\usepackage{subcaption}
\usepackage[ruled,linesnumbered,noline]{algorithm2e}
\usepackage{listings}
\lstdefinestyle{simpleStyle}{
basicstyle=\ttfamily\small,
breaklines=true,
keywordstyle=\color{blue},
identifierstyle=\color{black},
stringstyle=\color{violet},
commentstyle=\color[RGB]{34,139,34},
showstringspaces=false,
numbers=left,
numbersep=2em,
numberstyle=\footnotesize,
frame=single,
framesep=1em,
}
\lstset{style=simpleStyle}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,linkcolor=,urlcolor=cyan
}
\renewcommand*{\proofname}{\normalfont\bfseries Proof}
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\mdfsetup{skipabove=0.5em,skipbelow=0.5em}
\newcommand{\mydeclaretheoremstyle}[3]{
\declaretheoremstyle[headfont=\bfseries\sffamily#2, bodyfont=\normalfont, mdframed={#3}]{#1}
}
\mydeclaretheoremstyle{purplehalfbox}{\color{RoyalPurple!70!black}}{linewidth=2pt, rightline=false, topline=false, bottomline=false, linecolor=RoyalPurple, backgroundcolor=RoyalPurple!8}
\mydeclaretheoremstyle{bluehalfbox}{\color{SkyBlue!70!black}}{linewidth=2pt, rightline=false, topline=false, bottomline=false, linecolor=NavyBlue, backgroundcolor=SkyBlue!8}
\mydeclaretheoremstyle{greenfullbox}{\color{ForestGreen!40!black}}{linewidth=1pt, linecolor=ForestGreen, backgroundcolor=ForestGreen!5}
\mydeclaretheoremstyle{redfullbox}{\color{RawSienna!70!black}}{linewidth=1pt, linecolor=RawSienna, backgroundcolor=RawSienna!5}
\mydeclaretheoremstyle{pinkemptybox}{\color{WildStrawberry!70!black}}{linewidth=0pt, linecolor=WildStrawberry, backgroundcolor=WildStrawberry!5}
\mydeclaretheoremstyle{brownemptybox}{\color{brown!70!black}}{leftline=false, rightline=false, topline=false, bottomline=false, skipabove=0em, skipbelow=0em}
\mydeclaretheoremstyle{greenemptybox}{\color{ForestGreen!40!black}}{leftline=false, rightline=false, topline=false, bottomline=false, skipabove=0em, skipbelow=0em}
\declaretheorem[style=purplehalfbox, name=Theorem, numbered=yes, numberwithin=section]{theorem}
\declaretheorem[style=purplehalfbox, name=Theorem, numbered=no]{theorem*}
\declaretheorem[style=purplehalfbox, name=Proposition, numbered=yes, sibling=theorem]{proposition}
\declaretheorem[style=purplehalfbox, name=Proposition, numbered=no]{proposition*}
\declaretheorem[style=bluehalfbox, name=Corollary, numbered=yes, sibling=theorem]{corollary}
\declaretheorem[style=bluehalfbox, name=Corollary, numbered=no]{corollary*}
\declaretheorem[style=bluehalfbox, name=Lemma, numbered=yes, sibling=theorem]{lemma}
\declaretheorem[style=bluehalfbox, name=Lemma, numbered=no]{lemma*}
\declaretheorem[style=bluehalfbox, name=Claim, numbered=yes, sibling=theorem]{claim}
\declaretheorem[style=bluehalfbox, name=Claim, numbered=no]{claim*}
\declaretheorem[style=greenfullbox, name=Definition, numbered=yes, numberwithin=section]{definition}
\declaretheorem[style=greenfullbox, name=Definition, numbered=no]{definition*}
\declaretheorem[style=redfullbox, name=Example, numbered=yes, numberwithin=section]{example}
\declaretheorem[style=redfullbox, name=Example, numbered=no]{example*}
\declaretheorem[style=pinkemptybox, name=Problem, numbered=yes, numberwithin=section]{problem}
\declaretheorem[style=pinkemptybox, name=Problem, numbered=no]{problem*}
\declaretheorem[style=brownemptybox, name=Remark, numbered=yes, numberwithin=section]{remark}
\declaretheorem[style=brownemptybox, name=Remark, numbered=no]{remark*}
\declaretheoremstyle[headfont=\color{orange!80}\bfseries, bodyfont=\normalfont, spaceabove=3pt, spacebelow=3pt]{notestyle}
\declaretheorem[style=notestyle, name=Note, numbered=yes, numberwithin=section]{note}
\declaretheorem[style=notestyle, name=Note, numbered=no]{note*}
\declaretheoremstyle[headfont=\bfseries, bodyfont=\normalfont, spaceabove=3pt, spacebelow=3pt, qed=\ensuremath{\square}]{solutionstyle}
\declaretheorem[style=solutionstyle, name=Solution, numbered=yes, numberwithin=section]{solution}
\declaretheorem[style=solutionstyle, name=Solution, numbered=no]{solution*}
%% cbox
\newmdenv[
linecolor=SkyBlue,
backgroundcolor=SkyBlue!8,
leftline=true,
rightline=false,
topline=false,
bottomline=false,
linewidth=2pt,
roundcorner=0pt, % sharp corners
frametitlebackgroundcolor=SkyBlue!20,
]{cbox}
%% cover
\usepackage{titling}
\newcommand{\extrainfo}{}
\renewcommand{\extrainfo}[1]{\renewcommand{\extrainfocontent}{#1}}
\newcommand{\extrainfocontent}{}
\newcommand{\makecover}[1]{%
\begin{titlepage}
\newgeometry{margin=0in}
\parindent=0pt
\includegraphics[width=\linewidth]{#1} % size = 1280*1024
\vfill
\begin{center}
\parbox{0.618\textwidth}{%
\raggedleft{\bfseries \Huge \thetitle} \\[0.6pt]
\rule{0.618\textwidth}{4pt} \\
}
\end{center}
\vfill
\begin{center}
\parbox{0.618\textwidth}{%
\raggedleft\Large
\begin{tabular}{r}
\theauthor \\
\thedate \\
\end{tabular}%
}
\end{center}
\vfill
\begin{center}
\parbox[t]{0.7\textwidth}{\centering \itshape \extrainfocontent}
\end{center}
\vfill
\end{titlepage}
\restoregeometry
\thispagestyle{empty}
}
% USAGE
% \extrainfo{xxx}
% \makecover{/path/to/cover.png}