← 全部资源LaTeX 模板

MI Book / Lecture Note

面向中文数学书与长篇讲义,在页眉、章节、定理与封面之间建立一致的阅读系统。

BookXeLaTeXCTeX

设计思路

这套模板面向 书、讲义和专著 这类较长的材料。目标是结构稳定、视觉统一:

  • 保留书籍层级:使用 book 类的 part / chapter / section,适合讲义、系列笔记和预印本。
  • 统一的视觉系统:封面、彩带、页眉页脚、定理环境和提示盒子共用一套配色。
  • 稳定的依赖:优先使用系统字体,找不到时回退到 TeX Gyre / Fandol,换一台机器也能编译。
  • 可读的定理环境:definition / theorem / lemma / corollary / remark 统一套上边栏盒子。
  • 可覆写的页脚:书名和页脚文字由 \BookShortTitle 和 \BookFooterLabel 两个宏控制。

环境要求

  • 编译器:XeLaTeX 或 LuaLaTeX
  • 宏包:ctex, fontspec, tcolorbox, titlesec, fancyhdr, tikz, mathtools, amsthm
  • 推荐字体:
    • 英文衬线:Times New Roman,回退到 TeX Gyre Termes
    • 中文衬线:Noto Serif CJK SC,回退到 Fandol
    • 等宽:JetBrains Mono,回退到 Menlo / Courier New

源文件

第一步:样式文件(miextras.sty)

样式文件负责字体、页眉页脚、配色和所有盒子环境。KeyBox / SideBar / Example / Takeaway 以及定理环境都由 tcolorbox 统一处理。

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{miextras}[2026/03/13 MIStatlE book and lecture note style]

\RequirePackage{iftex}
\ifPDFTeX
  \PackageError{miextras}{Please compile with XeLaTeX or LuaLaTeX}{This package relies on fontspec and CJK font support.}
\fi

\RequirePackage[fontset=fandol]{ctex}
\RequirePackage{fontspec}
\RequirePackage{geometry}
\RequirePackage{xcolor}
\RequirePackage{hyperref}
\RequirePackage{titlesec}
\RequirePackage{fancyhdr}
\RequirePackage{tikz}
\RequirePackage{eso-pic}
\usetikzlibrary{calc,positioning}
\RequirePackage[most]{tcolorbox}
\RequirePackage{enumitem}
\RequirePackage{mathtools}
\RequirePackage{amsmath,amssymb,bm,amsthm}

\geometry{
  paperwidth=6in,
  paperheight=9in,
  inner=0.92in,
  outer=0.78in,
  top=0.92in,
  bottom=0.95in,
  headsep=0.24in,
  footskip=0.42in,
  bindingoffset=0.08in
}

\IfFontExistsTF{Times New Roman}{\setmainfont{Times New Roman}}{\setmainfont{TeX Gyre Termes}}
\IfFontExistsTF{Helvetica Neue}{\setsansfont{Helvetica Neue}}{\setsansfont{TeX Gyre Heros}}
\IfFontExistsTF{JetBrains Mono}{\setmonofont{JetBrains Mono}}{\IfFontExistsTF{Menlo}{\setmonofont{Menlo}}{\setmonofont{Courier New}}}
\IfFontExistsTF{Noto Serif CJK SC}{\setCJKmainfont{Noto Serif CJK SC}}{}
\IfFontExistsTF{Noto Sans CJK SC}{\setCJKsansfont{Noto Sans CJK SC}}{}

\linespread{1.24}
\setlength{\parindent}{1.6em}
\pagecolor{white}
\color{black}

\definecolor{brand}{HTML}{1A9D8F}
\definecolor{brandD}{HTML}{2A7F6F}
\definecolor{keybg}{HTML}{E8F4F1}
\definecolor{keydark}{HTML}{2F5E58}
\definecolor{secblue}{HTML}{2B44C6}
\definecolor{accent}{HTML}{F97352}
\definecolor{accentD}{HTML}{C44536}
\definecolor{plum}{HTML}{6C5CE7}
\definecolor{plumBg}{HTML}{F2EEFF}
\definecolor{soft}{HTML}{F6FBFA}
\definecolor{ink}{HTML}{1A1A1A}

\hypersetup{
  colorlinks=true,
  linkcolor=brandD,
  citecolor=brandD,
  urlcolor=secblue
}

\newcommand{\seriesnum}{I}
\newcommand{\BookShortTitle}{Lecture Notes}
\newcommand{\BookFooterLabel}{@MIStatlE}
\newcommand{\E}{\mathbb{E}}
\DeclareMathOperator{\Var}{Var}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\tcbset{
  mi-elegant/.style={
    enhanced, breakable,
    colback=white, colframe=#1,
    boxrule=0.6pt, arc=3pt,
    left=10pt,right=10pt,top=12pt,bottom=10pt,
    before skip=10pt,after skip=10pt,
    borderline west={3pt}{0pt}{#1}
  },
  mi-notion/.style={
    enhanced, breakable, frame hidden,
    colback=#1!7, borderline west={3pt}{0pt}{#1},
    left=9pt,right=9pt,top=8pt,bottom=8pt,
    before skip=8pt,after skip=8pt, arc=2pt
  }
}

\newtcolorbox{KeyBox}{
  mi-elegant=brandD,
  title=\textbf{\color{white}Key Idea},
  colbacktitle=brandD,
  coltitle=white
}

\newtcolorbox{Takeaway}{
  mi-notion=accentD,
  title=\textbf{Takeaway},
  coltitle=accentD
}

\newtcolorbox{SideBar}{
  mi-notion=brand,
  title=\textbf{Sidebar},
  coltitle=brandD
}

\theoremstyle{plain}
\newtheorem{theorem}{定理}[chapter]
\newtheorem{lemma}[theorem]{引理}
\newtheorem{corollary}[theorem]{推论}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{定义}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{注}

\tcolorboxenvironment{theorem}{mi-elegant=secblue}
\tcolorboxenvironment{lemma}{mi-elegant=secblue}
\tcolorboxenvironment{corollary}{mi-elegant=secblue}
\tcolorboxenvironment{definition}{mi-notion=brandD}
\tcolorboxenvironment{remark}{mi-notion=accentD}

第二步:主文件(main.tex)

main.tex 只负责组织一本书的结构。样式都留在 .sty 里,正文专注于 part / chapter / theorem / example / references。

\documentclass[10pt,openany]{book}
\usepackage{miextras}

\renewcommand{\seriesnum}{I}
\renewcommand{\BookShortTitle}{集中不等式}
\renewcommand{\BookFooterLabel}{@MIStatlE}

\begin{document}

\MakeBookCoverUltraSimple
  {集中不等式}
  {高维概率与机器学习理论中的浓缩现象}
  {上册 · 预印本}

\frontmatter
\setcounter{tocdepth}{2}
\TOCwithoutHeadFoot

\mainmatter
\part{预备知识与工具}
\chapter{次高斯变量与 Orlicz 范数}

\begin{SideBar}
\textbf{阅读建议}:这一章建立后文不断复用的语言系统。
\end{SideBar}

\section{核心定义}
\begin{definition}[Orlicz 范数]
随机变量 $Z$ 的 $\psi_2$ 范数定义为
\[
\norm{Z}_{\psi_2} := \inf\left\{ s>0 : \E \exp\left(\frac{Z^2}{s^2}\right) \le 2 \right\}.
\]
\end{definition}

\begin{lemma}[次高斯平方的次指数性]
若 $X$ 是中心化次高斯随机变量,则 $X^2-\E X^2$ 是次指数随机变量。
\end{lemma}

\begin{KeyBox}
\textbf{要点}:$\psi_2$ 控制尾部衰减,平方中心化后自然转向 $\psi_1$。
\end{KeyBox}

\part{主结果}
\chapter{Hanson--Wright 不等式}
\begin{theorem}[Hanson--Wright]
设 $X$ 的坐标独立、中心化且次高斯,则二次型 $X^\top A X$ 满足双尺度指数尾界。
\end{theorem}

\begin{Takeaway}
把二次型看成“线性浓缩 + 交叉项控制”的升级版,比死记公式更有价值。
\end{Takeaway}

\appendix
\part{附录}
\chapter{记号表}
\begin{itemize}
  \item $\E$:数学期望。
  \item $\Var$:方差算子。
\end{itemize}

\end{document}

适用场景

适合:

  • 一本中文数学讲义
  • 系列 lecture notes 或专著
  • 长于 10 页、需要目录和章节层级的预印本
  • 之后可能扩写成课程讲义的长文底稿

不太适合:

  • 单页卡片
  • 几屏就读完的短知识点
  • 需要强烈视觉风格的海报式排版

扩展建议

要继续扩展这套模板,优先改下面三处,而不是添加新环境,这样整体风格不会散:

  1. \BookShortTitle 和 \BookFooterLabel
  2. 颜色系统 brand / brandD / secblue / accentD
  3. mi-elegant 和 mi-notion 两个盒子基类