← 全部资源LaTeX 模板

Short Note

为短篇推导与公开笔记准备的极简模板,强调结构、公式与留白。

CheatsheetTColorBox

设计思路

这套模板为 短篇推导和知识卡片 设计。标准的 LaTeX article 边距很大,不适合在手机或平板上阅读短内容,这里做了三点调整:

  • 紧凑版面:7.5 × 10 英寸页面,窄边距,单页信息密度高。
  • 两种盒子:
    • Elegant Card:用于 Key Idea 和 Theorem,带柔和阴影的卡片。
    • Notion Style:用于 Definition 和 Takeaway,只有左侧色条。
  • 样式与内容分离:样式放在单独的 .tex 文件里,正文文件只写内容。

环境要求

  • 编译器:XeLaTeX(必需,用于 ctex 中文和 fontspec 字体)
  • 宏包:tcolorbox(4.50 以上)、tikz、geometry

第一步:创建样式文件

在项目根目录新建 short-template.tex。这是样式表,使用时不需要改动。

% ===========================================
%  File: short-template.tex
%  Description: Style definitions for Short Note
% ===========================================

% --- 1. Packages ---
\usepackage{ifxetex}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage[fontset=fandol]{ctex}
\usepackage{tikz,eso-pic}
\usetikzlibrary{positioning,calc,shadows,shapes.misc}
\usepackage{fancyhdr}
\usepackage[most]{tcolorbox} 
\usepackage{amsmath,amssymb,bm,amsthm}
\usepackage{enumitem}
\usepackage{fontspec}

% --- 2. Layout (7.5x10 inch Compact) ---
\geometry{
  paperwidth=7.5in, paperheight=10in,
  left=0.5in, right=0.5in,
  top=0.55in, bottom=0.65in,
  footskip=0.45in
}

% --- 3. Fonts & Colors ---
\setmainfont{Times New Roman}
\linespread{1.3}
\pagecolor{white}

\definecolor{brand}{HTML}{1A9D8F}       % Teal
\definecolor{brandD}{HTML}{2A7F6F}      % Dark Teal
\definecolor{keybg}{HTML}{E8F4F1}       % Light BG
\definecolor{keydark}{HTML}{2F5E58}     % Dark Text
\definecolor{secblue}{HTML}{2B44C6}     % Academic Blue
\definecolor{accentD}{HTML}{D94F4F}     % Alert Red
\definecolor{termblue}{HTML}{1A4C9A}    % Term Blue
\definecolor{ink}{HTML}{1A1A1A}         % Black

% --- 4. Title Styles ---
\titleformat{\section}[block]{\centering\Large\bfseries\color{keydark}}{}{0em}{}[\vspace{0.2em}\titlerule]
\titlespacing*{\section}{0pt}{1.0em}{0.6em} 
\titleformat{\subsection}{\large\bfseries\color{brand}}{}{0em}{$\bullet$\ \ }
\titlespacing*{\subsection}{0pt}{0.8em}{0.3em}

% --- 5. Box Styles ---
% [Elegant Style]
\tcbset{
    elegant_style/.style={
        enhanced, breakable, colback=white, colframe=#1,
        fonttitle=\bfseries, coltitle=white,
        attach boxed title to top left={xshift=12pt, yshift*=-10pt},
        boxed title style={colback=#1, frame hidden, arc=3pt, boxrule=0pt, drop shadow={opacity=0.3, shadow xshift=1pt, shadow yshift=-1pt}},
        boxrule=0.5pt, arc=3pt,
        left=10pt, right=10pt, top=14pt, bottom=10pt,
        drop shadow={opacity=0.06, shadow xshift=2pt, shadow yshift=-2pt},
        before skip=10pt, after skip=10pt
    }
}
% [Notion Style]
\tcbset{
    notion_style/.style={
        enhanced, breakable, frame hidden, 
        borderline west={3pt}{0pt}{#1}, 
        colback=#1!7, coltitle=#1, fonttitle=\bfseries\small,
        attach title to upper={\ \ }, after title={\par\vspace{0.2em}},
        left=8pt, right=8pt, top=6pt, bottom=6pt, arc=2pt,
        before skip=6pt, after skip=6pt
    }
}

% --- 6. Environments ---
\newtcolorbox{KeyBox}{elegant_style=brand, title=Key Idea}
\newtcolorbox{Theorem}[1][]{elegant_style=secblue, title=\if\relax\detokenize{#1}\relax Theorem \else Theorem: #1 \fi}
\newtcolorbox{Definition}[1][]{notion_style=brandD, title=\if\relax\detokenize{#1}\relax Def. \else Def (#1). \fi}
\newtcolorbox{Takeaway}{notion_style=accentD, title=Takeaway}

% --- 7. Header Component ---
\newcommand{\padzero}[1]{\ifnum#1<10 0\fi\number#1}
\tcbset{tag_style/.style={on line, boxsep=1pt, left=3pt, right=3pt, top=1pt, bottom=1pt, colback=brand, colframe=brand, fontupper=\bfseries\scriptsize\color{white}, arc=2pt, boxrule=0pt, valign=center, before upper=\strut}}

\newcommand{\MakeShortHeader}[3]{
    \noindent
    \begin{tikzpicture}
        \node[fill=keybg!60, rounded corners=6pt, inner sep=12pt, minimum width=\linewidth, text width=\dimexpr\linewidth-30pt\relax, align=left] (box) {
            {\footnotesize \color{keydark!60} \the\year·\padzero{\the\month}·\padzero{\the\day} \hfill @MIStatlE} \\
            \vspace{0.2em}
            {\fontsize{20pt}{24pt}\selectfont\bfseries\color{keydark} #1} \\[0.2em]
            {\normalsize\color{ink!80} #2}
            \vspace{0.5em} 
            \foreach \T in {#3} { \tcbox[tag_style]{\T}\hspace{0.2em} }
        };
        \draw[brandD, line width=3pt] (box.north west) -- (box.south west);
    \end{tikzpicture}
    \vspace{1.0em}
}

% --- 8. Macros ---
\newcommand{\Term}[1]{\textcolor{termblue}{\textbf{#1}}}
\fancyhf{} \renewcommand{\headrulewidth}{0pt} \fancyfoot[C]{\footnotesize\color{brand!50} · \thepage \ ·} \pagestyle{fancy}

第二步:编写内容

新建 main.tex,用 \input 导入样式,然后专注于写作。

\documentclass[12pt]{article}

% 1. Import the style template
\input{short-template.tex}

\begin{document}

% 2. Generate Header (Title, Subtitle, Tags)
\MakeShortHeader
  {Fisher Information}
  {Regularity, Asymptotic Normality \& Geometry}
  {Statistics, Geometry, MLE}

% 3. Use Pre-defined Environments
\begin{KeyBox}
    Fisher Information is not just the variance bound; it is the intrinsic \Term{Riemannian Metric} of the parameter space.
\end{KeyBox}

\section{Core Concepts}

\begin{Definition}[Score Function]
    The gradient of the log-likelihood: $\mathbf{s}(\theta) = \nabla_\theta \log p(x;\theta)$.
    It has the property $\mathbb{E}[\mathbf{s}(\theta)] = 0$.
\end{Definition}

\begin{Theorem}[Cramér-Rao Lower Bound]
    For any unbiased estimator $\hat{\theta}$:
    \[ \text{Var}(\hat{\theta}) \ge \mathcal{I}(\theta)^{-1} \]
\end{Theorem}

\begin{Takeaway}
    In high-dimensional spaces, the curvature of the log-likelihood (Fisher Info) determines the convergence speed of SGD.
\end{Takeaway}

\end{document}