SimpleTex DocumentationSimpleTex Documentation
Home
FAQ
API
Tutorials
Blog
Updates
Use now
  • 简体中文
  • English
Home
FAQ
API
Tutorials
Blog
Updates
Use now
  • 简体中文
  • English
  • Mathematical Typesetting

    • LaTeX Basics: From Zero to Mathematical Typesetting
    • Advanced LaTeX Mathematical Typesetting Techniques
    • Typst Quick Start Guide: A Modern Alternative to LaTeX
    • List of commonly used mathematical symbols in LaTeX
  • OCR Technology

    • Mathematical Handwritten Formula Recognition Technology Comparison and Applications

Advanced LaTeX Mathematical Typesetting Techniques

After mastering the basics of LaTeX, you may want to further enhance your mathematical typesetting capabilities to handle more complex formulas and structures. This article will introduce some advanced LaTeX mathematical typesetting techniques to help you create professional-quality mathematical documents.

Complex Matrix and Table Creation

Matrices are common structures in mathematical typesetting, and LaTeX provides various matrix environments to choose different bracket styles according to your needs.

Basic Matrix Environments:

% Matrix without brackets
\begin{matrix}
a & b & c \\
d & e & f \\
g & h & i
\end{matrix}

% Matrix with parentheses
\begin{pmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{pmatrix}

% Matrix with square brackets
\begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{bmatrix}

% Matrix with curly braces
\begin{Bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{Bmatrix}

% Determinant (single vertical lines)
\begin{vmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{vmatrix}

% Norm (double vertical lines)
\begin{Vmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{Vmatrix}

Enhanced Matrix Features:

Use the smallmatrix environment from the amsmath package to create inline small matrices:

\usepackage{amsmath}
Inline matrix example: $\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}$

Block Matrices:

\begin{pmatrix}
  A & B \\
  C & D
\end{pmatrix}
\quad \text{where $A=\begin{pmatrix} a & b \\ c & d \end{pmatrix}$}

Large Matrices with Ellipses:

\begin{pmatrix}
  a_{11} & a_{12} & \cdots & a_{1n} \\
  a_{21} & a_{22} & \cdots & a_{2n} \\
  \vdots & \vdots & \ddots & \vdots \\
  a_{m1} & a_{m2} & \cdots & a_{mn}
\end{pmatrix}

Theorem and Proof Environment Setup

Academic documents often require special environments for theorems, lemmas, proofs, etc. The amsthm package provides convenient environment definition functionality.

Basic Setup:

\usepackage{amsthm}

% Define theorem-class environments
\theoremstyle{plain} % Default style: bold title, italic content
\newtheorem{theorem}{Theorem}[section] % Numbered by section
\newtheorem{lemma}[theorem]{Lemma} % Shares numbering with theorem
\newtheorem{corollary}{Corollary}[theorem] % Secondary numbering

% Define definition-class environments
\theoremstyle{definition} % Bold title, normal content
\newtheorem{definition}{Definition}[section]
\newtheorem{example}{Example}[section]

% Define remark-class environments
\theoremstyle{remark} % Italic title, normal content
\newtheorem{remark}{Remark}[section]

Usage Examples:

\begin{theorem}
For any real numbers $a$ and $b$, $(a+b)^2 = a^2 + 2ab + b^2$.
\end{theorem}

\begin{proof}
$(a+b)^2 = (a+b)(a+b) = a^2 + ab + ba + b^2 = a^2 + 2ab + b^2$
\end{proof}

\begin{lemma}
If $n$ is odd, then $n^2$ is also odd.
\end{lemma}

\begin{definition}
A number $n$ is called even if there exists an integer $k$ such that $n = 2k$.
\end{definition}

Multiline Formulas and Alignment Techniques

For longer formulas or those requiring alignment, various environments from the amsmath package can be used.

Multiline Unaligned Formulas (gather environment):

\begin{gather}
a = b + c \\
d = e + f + g \\
h = i + j
\end{gather}

Multiline Aligned Formulas (align environment):

\begin{align}
a &= b + c \\
d &= e + f + g \\
h &= i + j
\end{align}

Sub-equation Numbering (subequations environment):

\begin{subequations}
\begin{align}
E &= mc^2 \label{eq:einstein1} \\
m &= \frac{E}{c^2} \label{eq:einstein2}
\end{align}
\end{subequations}

Piecewise Functions (cases environment):

f(x) = 
\begin{cases}
x^2, & \text{if } x \geq 0 \\
-x^2, & \text{if } x < 0
\end{cases}

Long Formula Line Breaking (multline environment):

\begin{multline}
a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q \\
= r + s + t + u + v + w + x + y + z
\end{multline}

Custom Mathematical Symbols and Commands

Creating custom commands can simplify the input of complex or repeatedly used formulas.

Simple Command Definitions:

\newcommand{\R}{\mathbb{R}} % Real number set
\newcommand{\Z}{\mathbb{Z}} % Integer set
\newcommand{\N}{\mathbb{N}} % Natural number set
\newcommand{\deriv}[2]{\frac{d #1}{d #2}} % Derivative
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}} % Partial derivative

Usage Examples:

$\deriv{y}{x}$ represents the derivative of $y$ with respect to $x$
$\pderiv{f}{x}$ represents the partial derivative of $f$ with respect to $x$
$x \in \R$ indicates that $x$ is a real number

Commands with Default Parameters:

\newcommand{\norm}[1]{\left\lVert#1\right\rVert} % Norm
\newcommand{\abs}[1]{\left|#1\right|} % Absolute value
\newcommand{\set}[2]{\{#1 \mid #2\}} % Set definition

Creating New Mathematical Operators:

\DeclareMathOperator{\Tr}{Tr} % Matrix trace
\DeclareMathOperator{\spn}{span} % Linear space
\DeclareMathOperator{\proj}{proj} % Projection

Advanced Mathematical Symbols and Structures

Commutative Diagrams (using tikz-cd package):

\usepackage{tikz-cd}
\begin{tikzcd}
A \arrow[r, "f"] \arrow[d, "g"'] & B \arrow[d, "h"] \\
C \arrow[r, "i"'] & D
\end{tikzcd}

Multiple Integrals Simplification:

\usepackage{esint} % Provides more integral symbols
\iiint_{V} f(x,y,z) \, dx \, dy \, dz
\oiint_{S} \vec{F} \cdot d\vec{S}

Another Method for Custom Piecewise Functions:

\usepackage{mathtools} % Extension of amsmath
\begin{dcases}
f(x) = x^2, & x > 0 \\
f(x) = -x^2, & x \leq 0
\end{dcases}

Using SimpleTex to Simplify Complex Formula Input

For complex mathematical structures, manually inputting LaTeX code can be very time-consuming and error-prone. SimpleTex provides powerful formula recognition capabilities that can:

  1. Recognize complex typeset formulas through screenshots, including matrices, multiline formulas, and special symbols
  2. Recognize handwritten mathematical derivation processes and convert them to standardized LaTeX code
  3. Import recognition results directly into your LaTeX documents

Using SimpleTex can significantly improve mathematical typesetting efficiency, especially when dealing with complex mathematical structures, saving a lot of coding time.

Conclusion

Mastering these advanced mathematical typesetting techniques will enable you to handle various complex mathematical structures and expressions more flexibly. With accumulated practical experience, you can develop custom commands and environments suitable for your own workflow, further improving the efficiency and quality of mathematical typesetting.

Combining intelligent tools like SimpleTex, even the most complex mathematical formulas can be handled with ease, allowing you to focus on mathematical thinking and content creation rather than being troubled by tedious coding.

Last Updated:: 4/25/25, 4:42 PM
Prev
LaTeX Basics: From Zero to Mathematical Typesetting
Next
Typst Quick Start Guide: A Modern Alternative to LaTeX