Use when writing math textbook content in XeLaTeX, including definitions, theorems, proofs, and section formatting in English or Chinese.
LaTeX Textbook Writer
Shared narrative rules
Read and follow the shared narrative and evidence rules. Apply the direct, reader-facing style when explaining mathematical content; do not add process-oriented or defensive source disclaimers to the textbook.
Professional assistant for writing mathematical textbooks using XeLaTeX with proper formatting, structure, and narrative style.
Overview
This Skill provides comprehensive guidance for writing mathematics textbooks with:
Professional box styles (definitions, theorems, examples, remarks)
Correct color scheme (definitions in green, theorems in orange, examples in blue)
Academically standard narrative style (explanation before definition, interwoven narrative and boxes)
English and Chinese template support
When to Use
Use this Skill when creating or modifying:
Mathematics textbook chapters
LaTeX formatting for theorems, definitions, proofs
When using ctex package for Chinese support, theorem names and figure captions automatically become Chinese. Always add these overrides for English documents:
\usepackage{ctex}
\usepackage{amsmath,amssymb,amsthm}
\renewcommand{\proofname}{Proof} % Force English "Proof"
\renewcommand{\contentsname}{Contents} % Force English "Contents"
\usepackage{caption}
\captionsetup{figurename=Figure,tablename=Table} % Force English captions
\section{Groups}
Group theory studies groups, the most fundamental algebraic structures. This section introduces the definition and basic properties of groups.
\begin{definition}{Group}{def:group}
A group is a set $G$ with a binary operation satisfying...
\end{definition}
The above definition requires three key conditions...
2. Narrative Should Weave Through Content
The goal is narrative-box-narrative-box-narrative, not narrative-box-box-box-narrative.
After a box, add:
Explanatory text unpacking the result
Connections to previous concepts
Motivation for what comes next
Physical or mathematical interpretation
3. Proofs as Coherent Narratives
Proofs should flow as continuous text, not step-by-step lists.
\begin{proof}
Since $U \in SU(4)$ and the exponential map is surjective, there exists $X \in \mathfrak{su}(4)$ such that $\exp(X) = U$.
Next, we express $X$ as a linear combination of Hamiltonians. By the completeness of the Lie algebra...
Therefore, the theorem is proved. $\square$
\end{proof}
4. No Italics - Use Bold for Emphasis
DO NOT use italics in mathematical textbooks. Use bold for:
Emphasis on important concepts
Proper nouns (names of mathematicians, special terms)
Key terms being introduced
BAD:
Let $V$ be a *vector space*. The \textit{Hahn-Banach theorem} states...
GOOD:
Let $V$ be a vector space. The \textbf{Hahn-Banach theorem} states...
Bold a term to introduce or name it; do not use vague emphasis words such as "核心", "关键", "重要", "主要", "本质", or "显著" as a substitute for saying what a concept is or does. State the definition, hypothesis, or measured effect directly.
5. Bulleted and Numbered Lists
ONLY use bullets (itemize) and numbered lists (enumerate) in:
NEVER use bullets or numbered lists in main narrative text.
Reader-Relevance Filter
Keep only sentences that help the reader understand the mathematics: definitions, assumptions, relations, proofs, examples, consequences, or necessary limitations. Do not include meta-commentary about the author's writing process, intent, fidelity to a source, or why an omission was made. Do not explain that an unsupported point cannot be inferred merely to describe the drafting process; omit it or state the concrete mathematical limitation when it matters.
6. Chinese Quote Marks (CRITICAL for Chinese Documents!)
When writing Chinese text in LaTeX (with ctex package), ALWAYS use proper quote marks:
Chinese Double Quotes:
Left double quote: `` (two backticks)
Right double quote: '' (two single quotes/apostrophes)
Chinese Single Quotes:
Left single quote: ` (one backtick)
Right single quote: ' (one single quote/apostrophe)
How to type:
Press backtick key (`) twice for left double quote: ``
Press apostrophe key (') twice for right double quote: ''
Press backtick key once for left single quote: `
Press apostrophe key once for right single quote: '
Examples:
% CORRECT - Chinese quotes
The concept of ``closeness'' and ``continuity''...
This is a ``simple'' definition.
% INCORRECT - ASCII straight quotes (ugly in PDF)
The concept of "closeness" and "continuity"...
IMPORTANT: Always use and '' for quotes in Chinese text, never use ", corner brackets, or any other form!
7. Specify Variable Domains Before Formulas
ALWAYS state which set each variable belongs to before writing formulas, not after.
BAD (domain specified after formula):
We can verify
$$
\langle \operatorname{ad}_{X}(Y), Z \rangle = \langle Y, \operatorname{ad}_{X^{*}}(Z) \rangle
$$
for $X \in \mathfrak{r}$ and $Y, Z \in \mathfrak{g}$.
GOOD (domain specified first):
Take any $X \in \mathfrak{r}$ and $Y, Z \in \mathfrak{g}$. We can verify
$$
\langle \operatorname{ad}_{X}(Y), Z \rangle = \langle Y, \operatorname{ad}_{X^{*}}(Z) \rangle
$$
Use phrases like: "Take any...", "For...", "Let...", "For any...".
Box Title Format
English format:
"1.22 Definition: Real Vector Space"
"1.14 Commutativity of Addition in F^3"
"1.10 Notation: n"
"1.44 Example: A Sum That Is Not Direct"
Chinese format (for Chinese documents):
"1.22 定义:实向量空间"
"1.14 $F^3$ 中加法的可交换性"
"1.10 记号:$n$"
"1.44 例:一个不是直和的和"
Section Numbering Format
English:
Chapter: "Chapter 1", "Chapter 2"
Section: "1.1", "1.2", "2.1"
Subsection: No numbering, just larger sans-serif blue font
Chinese:
Chapter: "第1章", "第2章"
Section: "1.1", "1.2", "2.1"
Subsection: No numbering, just larger sans-serif blue font
Standard Patterns
Pattern 1: Narrative -> Definition -> Explanation
Introduce the concept with background and motivation.
\begin{definition}{Concept Name}{def:concept}
Formal definition.
\end{definition}
Explain the meaning and intuition behind the definition.
Set up the context for the proposition.
\begin{proposition}{Proposition Name}{prop:name}
Statement.
\end{proposition}
\begin{proof}
Coherent proof narrative.
\end{proof}
Discuss the significance and applications.
Quality Checklist
Before considering content complete:
Every section has introductory text before the first box
Narrative weaves through boxes (not box-box-box stacking)
Proofs are coherent narratives, not step lists
No bullets or numbered lists in main narrative text (only in examples/exercises)
No italics - use bold for emphasis/proper nouns
All environments use new syntax: \begin{definition}{Title}{label} (not [Title])
All referenceable items have unique labels in second argument
All cross-references use \ref{}
For English documents: Added \renewcommand{\proofname}{Proof} and \captionsetup{figurename=Figure,tablename=Table}
For Chinese documents: All quotes use and '', NOT " or corner brackets
Variable domains specified BEFORE formulas, not after
For answers.tex: Each solution uses \textbf{解:} / \textbf{Solution:} with one formula per line format
For answers.tex: No paragraph contains multiple inline formulas - use display math for each formula
references/format-en.tex: English textbook template
references/format-zh.tex: Chinese textbook template
These templates contain complete preamble setup, color definitions, and box styles ready to copy into your project.
Exercise and Answer Appendices
When a 习题/ directory exists, create exercise.tex and answers.tex appendix files. Solutions must use "one formula per line" (一行一公式) format with display math for each formula.
See references/exercise-format.md for complete format specifications, examples, anti-examples, and translation guide.
Figures and Illustrations
Figures can be created using TikZ code inline in chapter .tex files, or using Python scripts (matplotlib) stored in a figures/ directory.
TikZ Figures (inline in chapter files)
For mathematical diagrams (group-algebra relationships, commutative diagrams, etc.), use TikZ code directly in chapter .tex files: