Loading...
Loading...
Compare original and translation side by side
| Concept | Description |
|---|---|
| Preamble | Everything before |
| Document body | Content between |
| Commands | Start with |
| Environments | |
| Packages | Extensions loaded with |
| 概念 | 描述 |
|---|---|
| 导言区(Preamble) | 位于 |
| 文档主体(Document body) | 位于 |
| 命令(Commands) | 以 |
| 环境(Environments) | |
| 宏包(Packages) | 在导言区通过 |
\documentclass[options]{class}| Class | Use case |
|---|---|
| Short documents, papers, assignments |
| Longer documents with chapters |
| Books (front/back matter, chapters) |
| Presentations/slides |
| Formal letters |
| Flexible — replaces article/report/book |
\documentclass[options]{class}| 文档类 | 适用场景 |
|---|---|
| 短篇文档、论文、作业 |
| 包含章节的长篇文档 |
| 书籍(包含前言/后语、章节) |
| 演示文稿/幻灯片 |
| 正式信函 |
| 灵活通用的文档类,可替代article/report/book |
\documentclass[12pt,a4paper,twocolumn,draft]{article}| Option | Values |
|---|---|
| Font size | |
| Paper | |
| Columns | |
| Sides | |
| Draft | |
\documentclass[12pt,a4paper,twocolumn,draft]{article}| 选项 | 可选值 |
|---|---|
| 字体大小 | |
| 纸张尺寸 | |
| 分栏方式 | |
| 单面/双面 | |
| 草稿模式 | |
\documentclass[12pt,a4paper]{article}
% === PREAMBLE ===
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\title{My Document}
\author{Author Name}
\date{\today}
% === BODY ===
\begin{document}
\maketitle
\tableofcontents
\section{Introduction}
Content here.
\end{document}\documentclass[12pt,a4paper]{article}
% === 导言区 ===
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\title{我的文档}
\author{作者姓名}
\date{\today}
% === 主体内容 ===
\begin{document}
\maketitle
\tableofcontents
\section{引言}
内容写在这里。
\end{document}| Command | Result |
|---|---|
| bold |
| italic |
| underlined |
| emphasis (italic, or upright if already italic) |
| |
| SMALL CAPS |
| sans-serif |
| 命令 | 效果 |
|---|---|
| 粗体 |
| 斜体 |
| 下划线 |
| 强调(默认斜体,若已为斜体则变为正体) |
| |
| 小型大写字母 |
| 无衬线字体 |
\tiny \scriptsize \footnotesize \small \normalsize
\large \Large \LARGE \huge \Huge{\large This text is large.}\tiny \scriptsize \footnotesize \small \normalsize
\large \Large \LARGE \huge \Huge{\large 这段文字是大号字体。}| Command | Declaration | Family |
|---|---|---|
| | Serif (Roman) |
| | Sans-serif |
| | Monospace |
| 命令 | 声明式命令 | 字体族 |
|---|---|---|
| | 衬线字体(罗马体) |
| | 无衬线字体 |
| | 等宽字体 |
\begin{center} Centered text. \end{center}
\begin{flushleft} Left-aligned. \end{flushleft}
\begin{flushright} Right-aligned. \end{flushright}\centering\raggedright\raggedleft\begin{center} 居中对齐文本。 \end{center}
\begin{flushleft} 左对齐文本。 \end{flushleft}
\begin{flushright} 右对齐文本。 \end{flushright}\centering\raggedright\raggedleft\vspace{1cm} % vertical space
\hspace{2em} % horizontal space
\vfill % stretch vertical
\hfill % stretch horizontal
\\[0.5cm] % line break with extra space
\setlength{\parskip}{0.5em} % paragraph spacing
\setlength{\parindent}{0pt} % remove paragraph indent
\noindent % suppress indent for one paragraphsetspace\usepackage{setspace}
\onehalfspacing % or \doublespacing, \singlespacing\vspace{1cm} % 垂直间距
\hspace{2em} % 水平间距
\vfill % 可拉伸垂直间距
\hfill % 可拉伸水平间距
\\[0.5cm] % 换行并添加额外间距
\setlength{\parskip}{0.5em} % 段落间距
\setlength{\parindent}{0pt} % 取消段落首行缩进
\noindent % 取消当前段落的首行缩进setspace\usepackage{setspace}
\onehalfspacing % 或 \doublespacing(双倍行距)、\singlespacing(单倍行距)| Character | LaTeX | Character | LaTeX |
|---|---|---|---|
| | | |
| | | |
| | | |
| | | |
| | | |
| 字符 | LaTeX写法 | 字符 | LaTeX写法 |
|---|---|---|---|
| | | |
| | | |
| | | |
| | | |
| | | |
\part{Part Title} % only in report/book
\chapter{Chapter Title} % only in report/book
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\paragraphsub{Subparagraph}\section*{}\part{篇标题} % 仅在report/book类中可用
\chapter{章标题} % 仅在report/book类中可用
\section{节}
\subsection{小节}
\subsubsection{子小节}
\paragraph{段落}
\paragraphsub{子段落}\section*{}\tableofcontents % requires two compilations
\listoffigures
\listoftables\tableofcontents % 需要编译两次才能生成正确目录
\listoffigures
\listoftables% Bulleted
\begin{itemize}
\item First item
\item Second item
\end{itemize}
% Numbered
\begin{enumerate}
\item First
\item Second
\end{enumerate}
% Labeled
\begin{description}
\item[Term] Definition here.
\end{description}enumitem\usepackage{enumitem}
\begin{enumerate}[label=(\alph*), start=1]% 无序列表
\begin{itemize}
\item 第一项
\item 第二项
\end{itemize}
% 有序列表
\begin{enumerate}
\item 第一项
\item 第二项
\end{enumerate}
% 描述列表
\begin{description}
\item[术语] 定义内容。
\end{description}enumitem\usepackage{enumitem}
\begin{enumerate}[label=(\alph*), start=1]\section{Methods}\label{sec:methods}
See Section~\ref{sec:methods} on page~\pageref{sec:methods}.hyperref\autoref{sec:methods}\label\caption\section{研究方法}\label{sec:methods}
请参见第~\ref{sec:methods}节,页码~\pageref{sec:methods}。hyperref\autoref{sec:methods}\label\captionThis has a footnote.\footnote{Footnote text here.}这段文字带有脚注。\footnote{脚注内容写在这里。}Inline: $E = mc^2$ or \(E = mc^2\)
Display:
\[ E = mc^2 \]
% Numbered equation:
\begin{equation}\label{eq:einstein}
E = mc^2
\end{equation}行内公式:$E = mc^2$ 或 \(E = mc^2\)
行间公式:
\[ E = mc^2 \]
% 带编号的公式:
\begin{equation}\label{eq:einstein}
E = mc^2
\end{equation}\usepackage{amsmath} % align, cases, matrices, etc.
\usepackage{amssymb} % extra symbols (ℝ, ℤ, etc.)
\usepackage{mathtools} % extends amsmath (dcases, coloneqq, etc.)\usepackage{amsmath} % 增强的数学环境,如align、cases、矩阵等
\usepackage{amssymb} % 额外的数学符号(ℝ、ℤ等)
\usepackage{mathtools} % 扩展amsmath功能(如dcases、coloneqq等)% Fractions
\frac{a}{b} \dfrac{a}{b} (display-size)
% Roots
\sqrt{x} \sqrt[3]{x}
% Sub/superscripts
x_{i} x^{2} x_{i}^{2} a_{i,j}
% Sums, products, integrals
\sum_{i=1}^{n} x_i \prod_{i=1}^{n} x_i
\int_{0}^{\infty} f(x)\,dx
\lim_{x \to \infty} f(x)
% Brackets (auto-sized)
\left( \frac{a}{b} \right)
\left[ ... \right]
\left\{ ... \right\}% 分数
\frac{a}{b} \dfrac{a}{b} (行间公式大小的分数)
% 根式
\sqrt{x} \sqrt[3]{x}
% 下标/上标
x_{i} x^{2} x_{i}^{2} a_{i,j}
% 求和、乘积、积分
\sum_{i=1}^{n} x_i \prod_{i=1}^{n} x_i
\int_{0}^{\infty} f(x)\,dx
\lim_{x \to \infty} f(x)
% 自动调整大小的括号
\left( \frac{a}{b} \right)
\left[ ... \right]
\left\{ ... \right\}\begin{pmatrix} a & b \\ c & d \end{pmatrix} % (a b; c d)
\begin{bmatrix} a & b \\ c & d \end{bmatrix} % [a b; c d]
\begin{vmatrix} a & b \\ c & d \end{vmatrix} % |a b; c d| (determinant)
\begin{Bmatrix} a & b \\ c & d \end{Bmatrix} % {a b; c d}\begin{pmatrix} a & b \\ c & d \end{pmatrix} % (a b; c d)
\begin{bmatrix} a & b \\ c & d \end{bmatrix} % [a b; c d]
\begin{vmatrix} a & b \\ c & d \end{vmatrix} % |a b; c d|(行列式)
\begin{Bmatrix} a & b \\ c & d \end{Bmatrix} % {a b; c d}\begin{align}
f(x) &= x^2 + 2x + 1 \label{eq:f} \\
g(x) &= x^3 - 1 \label{eq:g}
\end{align}
% No numbering:
\begin{align*}
a &= b + c \\
d &= e + f
\end{align*}\begin{align}
f(x) &= x^2 + 2x + 1 \label{eq:f} \\
g(x) &= x^3 - 1 \label{eq:g}
\end{align}
% 无编号的对齐公式:
\begin{align*}
a &= b + c \\
d &= e + f
\end{align*}f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}| Lower | Command | Upper | Command |
|---|---|---|---|
| α | | Α | |
| β | | Β | |
| γ | | Γ | |
| δ | | Δ | |
| ε | | Ε | |
| θ | | Θ | |
| λ | | Λ | |
| μ | | — | — |
| π | | Π | |
| σ | | Σ | |
| φ | | Φ | |
| ω | | Ω | |
| 小写 | 命令 | 大写 | 命令 |
|---|---|---|---|
| α | | Α | |
| β | | Β | |
| γ | | Γ | |
| δ | | Δ | |
| ε | | Ε | |
| θ | | Θ | |
| λ | | Λ | |
| μ | | — | — |
| π | | Π | |
| σ | | Σ | |
| φ | | Φ | |
| ω | | Ω | |
| Symbol | Command | Symbol | Command |
|---|---|---|---|
| ≤ | | ≥ | |
| ≠ | | ≈ | |
| ± | | × | |
| ÷ | | · | |
| ∈ | | ∉ | |
| ⊂ | | ⊆ | |
| ∪ | | ∩ | |
| ∞ | | ∂ | |
| ∇ | | ∀ | |
| ∃ | | → | |
| ⇒ | | ⇔ | |
| ℝ | | ℤ | |
| … | |
| 符号 | 命令 | 符号 | 命令 |
|---|---|---|---|
| ≤ | | ≥ | |
| ≠ | | ≈ | |
| ± | | × | |
| ÷ | | · | |
| ∈ | | ∉ | |
| ⊂ | | ⊆ | |
| ∪ | | ∩ | |
| ∞ | | ∂ | |
| ∇ | | ∀ | |
| ∃ | | → | |
| ⇒ | | ⇔ | |
| ℝ | | ℤ | |
| … | |
\begin{table}[htbp]
\centering
\caption{Results summary}\label{tab:results}
\begin{tabular}{lcrp{4cm}}
\toprule
Name & Count & Score & Description \\
\midrule
Alpha & 10 & 95.2 & First entry \\
Beta & 20 & 87.1 & Second entry \\
\bottomrule
\end{tabular}
\end{table}\begin{table}[htbp]
\centering
\caption{结果汇总}\label{tab:results}
\begin{tabular}{lcrp{4cm}}
\toprule
名称 & 数量 & 得分 & 描述 \\
\midrule
Alpha & 10 & 95.2 & 第一条记录 \\
Beta & 20 & 87.1 & 第二条记录 \\
\bottomrule
\end{tabular}
\end{table}| Spec | Alignment |
|---|---|
| Left |
| Center |
| Right |
| Paragraph (top-aligned, fixed width) |
| Middle-aligned paragraph (requires |
| ` | ` |
| 格式符 | 对齐方式 |
|---|---|
| 左对齐 |
| 居中对齐 |
| 右对齐 |
| 段落式(顶部对齐,固定宽度) |
| 垂直居中的段落式(需加载 |
| ` | ` |
\usepackage{booktabs} % \toprule, \midrule, \bottomrule (professional rules)
\usepackage{multirow} % \multirow{nrows}{width}{text}
\usepackage{longtable} % tables spanning multiple pages
\usepackage{tabularx} % auto-width X columns\usepackage{booktabs} % 提供\toprule、\midrule、\bottomrule(专业表格线)
\usepackage{multirow} % 提供\multirow{nrows}{width}{text}实现跨行单元格
\usepackage{longtable} % 支持跨多页的表格
\usepackage{tabularx} % 支持自动宽度的X列\multicolumn{3}{c}{Spanning header} \\
\multirow{2}{*}{Tall cell}\multicolumn{3}{c}{跨三列的表头} \\
\multirow{2}{*}{跨行单元格}\usepackage{graphicx}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{images/photo.png}
\caption{A descriptive caption.}\label{fig:photo}
\end{figure}\usepackage{graphicx}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{images/photo.png}
\caption{描述性标题。}\label{fig:photo}
\end{figure}| Option | Example |
|---|---|
| |
| |
| |
| |
| |
| 选项 | 示例 |
|---|---|
| |
| |
| |
| |
| |
| Specifier | Meaning |
|---|---|
| Here (approximately) |
| Top of page |
| Bottom of page |
| Dedicated float page |
| Override internal limits |
| Exactly here (requires |
| 参数 | 含义 |
|---|---|
| 此处(尽可能靠近当前位置) |
| 页面顶部 |
| 页面底部 |
| 单独的浮动体页面 |
| 覆盖内部限制,强制放置 |
| 精确放置在当前位置(需加载 |
\usepackage{subcaption}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{img1.png}
\caption{First}\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{img2.png}
\caption{Second}\label{fig:sub2}
\end{subfigure}
\caption{Both images}\label{fig:both}
\end{figure}\usepackage{subcaption}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{img1.png}
\caption{第一张图}\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{img2.png}
\caption{第二张图}\label{fig:sub2}
\end{subfigure}
\caption{两张图片合集}\label{fig:both}
\end{figure}references.bib@article{smith2023,
author = {Smith, John and Doe, Jane},
title = {An Important Paper},
journal = {Journal of Examples},
year = {2023},
volume = {42},
pages = {1--15},
doi = {10.1234/example}
}
@book{knuth1984,
author = {Knuth, Donald E.},
title = {The {\TeX}book},
publisher = {Addison-Wesley},
year = {1984}
}\usepackage{natbib} % or use biblatex
\bibliographystyle{plainnat}
As shown by \citet{smith2023}... % Smith and Doe (2023)
This is known \citep{smith2023}. % (Smith and Doe, 2023)
\bibliography{references}pdflatex → bibtex → pdflatex → pdflatexreferences.bib@article{smith2023,
author = {Smith, John and Doe, Jane},
title = {An Important Paper},
journal = {Journal of Examples},
year = {2023},
volume = {42},
pages = {1--15},
doi = {10.1234/example}
}
@book{knuth1984,
author = {Knuth, Donald E.},
title = {The {\TeX}book},
publisher = {Addison-Wesley},
year = {1984}
}\usepackage{natbib} % 或使用biblatex
\bibliographystyle{plainnat}
如\citet{smith2023}所示... % 显示为Smith and Doe (2023)
这一结论见\citep{smith2023}。 % 显示为(Smith and Doe, 2023)
\bibliography{references}pdflatex → bibtex → pdflatex → pdflatex\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{references.bib}
\textcite{smith2023} % Smith and Doe (2023)
\parencite{smith2023} % (Smith and Doe, 2023)
\printbibliographypdflatex → biber → pdflatex → pdflatex\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{references.bib}
\textcite{smith2023} % 显示为Smith and Doe (2023)
\parencite{smith2023} % 显示为(Smith and Doe, 2023)
\printbibliographypdflatex → biber → pdflatex → pdflatex| Feature | natbib | biblatex |
|---|---|---|
| Backend | BibTeX | Biber (recommended) |
| Flexibility | Limited styles | Highly customizable |
| Unicode | Poor | Full support |
| Recommendation | Legacy projects | New projects |
| 特性 | natbib | biblatex |
|---|---|---|
| 后端工具 | BibTeX | Biber(推荐) |
| 灵活性 | 样式有限 | 高度可定制 |
| Unicode支持 | 差 | 完全支持 |
| 推荐场景 | 遗留项目 | 新项目 |
\begin{verbatim}
def hello():
print("Hello, world!")
\end{verbatim}
Inline: \verb|some_code()|\begin{verbatim}
def hello():
print("Hello, world!")
\end{verbatim}
行内代码:\verb|some_code()|\usepackage{listings}
\usepackage{xcolor}
\lstdefinestyle{mystyle}{
basicstyle=\ttfamily\small,
keywordstyle=\color{blue},
commentstyle=\color{gray},
stringstyle=\color{red},
numbers=left,
numberstyle=\tiny,
frame=single,
breaklines=true
}
\begin{lstlisting}[language=Python, style=mystyle, caption={Example}]
def factorial(n):
"""Compute factorial."""
if n <= 1:
return 1
return n * factorial(n - 1)
\end{lstlisting}\usepackage{listings}
\usepackage{xcolor}
\lstdefinestyle{mystyle}{
basicstyle=\ttfamily\small,
keywordstyle=\color{blue},
commentstyle=\color{gray},
stringstyle=\color{red},
numbers=left,
numberstyle=\tiny,
frame=single,
breaklines=true
}
\begin{lstlisting}[language=Python, style=mystyle, caption={示例代码}]
def factorial(n):
"""计算阶乘。"""
if n <= 1:
return 1
return n * factorial(n - 1)
\end{lstlisting}\usepackage{minted}
\begin{minted}[linenos, frame=lines, fontsize=\small]{python}
def factorial(n):
if n <= 1:
return 1
return n * factorial(n - 1)
\end{minted}pdflatex -shell-escape document.tex\usepackage{minted}
\begin{minted}[linenos, frame=lines, fontsize=\small]{python}
def factorial(n):
if n <= 1:
return 1
return n * factorial(n - 1)
\end{minted}pdflatex -shell-escape document.tex\documentclass{beamer}
\usetheme{Madrid} % or: Berlin, Warsaw, Metropolis, etc.
\usecolortheme{default} % or: beaver, crane, dolphin, etc.
\title{My Presentation}
\author{Author}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\section{Introduction}
\begin{frame}{Introduction}
\begin{itemize}
\item<1-> First point (appears on slide 1+)
\item<2-> Second point (appears on slide 2+)
\item<3-> Third point
\end{itemize}
\end{frame}
\begin{frame}{With Columns}
\begin{columns}
\begin{column}{0.5\textwidth}
Left content
\end{column}
\begin{column}{0.5\textwidth}
Right content
\end{column}
\end{columns}
\end{frame}
\end{document}MadridBerlinMetropolisWarsawCambridgeUS\documentclass{beamer}
\usetheme{Madrid} % 可选主题:Berlin, Warsaw, Metropolis等
\usecolortheme{default} % 可选配色:beaver, crane, dolphin等
\title{我的演示文稿}
\author{作者}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{目录}
\tableofcontents
\end{frame}
\section{引言}
\begin{frame}{引言}
\begin{itemize}
\item<1-> 第一点(从第1张幻灯片开始显示)
\item<2-> 第二点(从第2张幻灯片开始显示)
\item<3-> 第三点
\end{itemize}
\end{frame}
\begin{frame}{分栏布局}
\begin{columns}
\begin{column}{0.5\textwidth}
左侧内容
\end{column}
\begin{column}{0.5\textwidth}
右侧内容
\end{column}
\end{columns}
\end{frame}
\end{document}MadridBerlinMetropolisWarsawCambridgeUS| Command | Effect |
|---|---|
| Show content incrementally |
| Show on slide 2 only |
| Only on slide 1 (no space reserved) |
| Visible from slide 2 onward |
| Highlighted on slide 2 |
| 命令 | 效果 |
|---|---|
| 内容逐步显示 |
| 仅在第2张幻灯片显示 |
| 仅在第1张幻灯片显示(不保留空白) |
| 从第2张幻灯片开始显示 |
| 在第2张幻灯片高亮显示 |
\usepackage[margin=2.5cm]{geometry}
% or:
\usepackage[top=3cm, bottom=3cm, left=2cm, right=2cm]{geometry}\usepackage[margin=2.5cm]{geometry}
% 或自定义各边距:
\usepackage[top=3cm, bottom=3cm, left=2cm, right=2cm]{geometry}\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all
\fancyhead[L]{Left Header}
\fancyhead[R]{\rightmark} % current section
\fancyfoot[C]{\thepage} % page number center
\renewcommand{\headrulewidth}{0.4pt}\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % 清空所有默认设置
\fancyhead[L]{左侧页眉}
\fancyhead[R]{\rightmark} % 当前节标题
\fancyfoot[C]{\thepage} % 居中显示页码
\renewcommand{\headrulewidth}{0.4pt}\pagenumbering{roman} % i, ii, iii (for front matter)
\pagenumbering{arabic} % 1, 2, 3 (for main content)
\thispagestyle{empty} % no number on this page\pagenumbering{roman} % 罗马数字i, ii, iii(用于前言部分)
\pagenumbering{arabic} % 阿拉伯数字1, 2, 3(用于正文)
\thispagestyle{empty} % 当前页不显示页码\usepackage{multicol}
\begin{multicols}{2}
Content in two columns...
\end{multicols}\usepackage{multicol}
\begin{multicols}{2}
双栏布局的内容...
\end{multicols}| Package | Purpose |
|---|---|
| Enhanced math environments |
| Extra math symbols (ℝ, ℤ, etc.) |
| Extensions to amsmath |
| Image inclusion |
| Clickable links, PDF metadata |
| Page margins and dimensions |
| Professional table rules |
| Multi-row table cells |
| Multi-page tables |
| Auto-width table columns |
| Color support |
| Code listings |
| Syntax-highlighted code (needs Pygments) |
| Programmatic graphics and diagrams |
| Data plots (built on TikZ) |
| Custom headers/footers |
| Line spacing |
| Customize list environments |
| Subfigures and subtables |
| Extra float control ( |
| Language/hyphenation support |
| Input encoding ( |
| Font encoding ( |
| Microtypographic enhancements |
| Smart cross-references ( |
| SI units and number formatting |
| Algorithm pseudocode |
| Citation management |
| Modern bibliography management |
| Context-sensitive quotation marks |
| Typeset URLs |
| Customize caption formatting |
| Appendix management |
hyperrefcleverefhyperref| 宏包 | 用途 |
|---|---|
| 增强数学环境 |
| 提供额外数学符号(ℝ、ℤ等) |
| 扩展amsmath功能 |
| 插入图片 |
| 生成可点击链接、PDF元数据 |
| 设置页面边距和尺寸 |
| 生成专业表格线 |
| 实现表格跨行单元格 |
| 生成跨多页的表格 |
| 自动调整表格列宽 |
| 支持颜色设置 |
| 插入代码列表 |
| 语法高亮代码块(需Pygments) |
| 编程方式绘制图形和图表 |
| 绘制数据图表(基于TikZ) |
| 自定义页眉页脚 |
| 设置行间距 |
| 自定义列表环境 |
| 生成子图和子表格 |
| 增强浮动体控制(如 |
| 支持多语言和断字 |
| 设置输入编码(如utf8) |
| 设置字体编码(如T1) |
| 微排版优化 |
| 智能交叉引用( |
| 排版SI单位和数字格式 |
| 排版算法伪代码 |
| 引用管理 |
| 现代参考文献管理 |
| 上下文敏感的引号 |
| 排版URL链接 |
| 自定义标题格式 |
| 附录管理 |
hyperrefcleverefhyperref| Engine | Use when |
|---|---|
| Default. Most compatible. ASCII/Latin input. |
| System fonts (TTF/OTF), full Unicode |
| System fonts + Lua scripting, full Unicode |
| 引擎 | 适用场景 |
|---|---|
| 默认引擎,兼容性最好,支持ASCII/Latin编码 |
| 支持系统字体(TTF/OTF)和完整Unicode编码 |
| 支持系统字体+Lua脚本,完整Unicode编码 |
undefined% 基础文档编译
pdflatex document.tex
% 含参考文献的文档(BibTeX)
pdflatex document.tex
bibtex document
pdflatex document.tex
pdflatex document.tex
% 含参考文献的文档(Biber/BibLaTeX)
pdflatex document.tex
biber document
pdflatex document.tex
pdflatex document.tex
% 自动化编译(推荐)
latexmk -pdf document.tex % 使用pdflatex编译
latexmk -xelatex document.tex % 使用xelatex编译
latexmk -lualatex document.tex % 使用lualatex编译
latexmk -pdf -pvc document.tex % 实时预览,自动重新编译| 错误信息 | 原因 | 解决方法 |
|---|---|---|
| 命令拼写错误或缺少对应宏包 | 检查命令拼写;添加 |
| 数学符号未放在数学环境中 | 将符号包裹在 |
| 导言区存在错误 | 检查导言区的语法错误 |
| 文件路径错误或文件缺失 | 检查文件名和路径;确认文件扩展名正确 |
| 行宽超过页面宽度 | 重新措辞;添加 |
| 参考文献条目缺失或未运行bibtex | 运行bibtex/biber;检查.bib文件中的引用键 |
| 待处理的浮动体过多 | 添加 |
| 图片缩放参数错误 | 检查 |
| 两个宏包冲突 | 只加载其中一个;查阅宏包文档确认兼容性 |
.log!LaTeX Warning:Package xyz Warning:Rerun to get cross-references right\input{chapters/intro}\include{chapters/intro}\clearpage\includeonlypreamble.stypreamble.tex\input{preamble}\caption{...}\label{fig:x}Figure~\ref{fig:x}Section~\ref{sec:y}\documentclass[draft]{article}\centeringcenter\\booktabs\hlinemicrotypecleveref\cref{fig:x}undefined| 任务 | 命令 |
|---|---|
| 粗体 | |
| 斜体 | |
| 等宽字体 | |
| 创建节 | |
| 交叉引用 | |
| 引用文献 | |
| 添加脚注 | |
| 插入图片 | |
| 插入URL | |
| 列表项 | |
| 新页面 | |
| 注释 | |
| 行内数学公式 | |
| 行间数学公式 | |
| 分数 | |
| Error | Cause | Fix |
|---|---|---|
| Typo or missing package | Check spelling; add |
| Math symbol outside math mode | Wrap in |
| Error in preamble | Check preamble for typos |
| Wrong path or missing file | Check filename/path, check extension |
| Line too wide | Rephrase, add |
| Missing bib entry or no bibtex run | Run bibtex/biber, check .bib keys |
| Too many figures queued | Add |
| Image scaling issue | Check |
| Two packages conflict | Load one, check docs for compatibility |
| 命令 | 符号 | 命令 | 符号 |
|---|---|---|---|
| sin | | cos |
| tan | | log |
| ln | | exp |
| min | | max |
| lim | | Σ |
| Π | | ∫ |
.log!LaTeX Warning:Package xyz Warning:Rerun to get cross-references right| 命令 | 符号 |
|---|---|
| → |
| ← |
| ↔ |
| ⇒ |
| ⇐ |
| ⇔ |
| ↦ |
| ↑ |
| ↓ |
\input{chapters/intro}\include{chapters/intro}\clearpage\includeonlypreamble.stypreamble.tex\input{preamble}\caption{...}\label{fig:x}Figure~\ref{fig:x}Section~\ref{sec:y}\documentclass[draft]{article}\centeringcenter\\booktabs\hlinemicrotypecleveref\cref{fig:x}| Task | Command |
|---|---|
| Bold | |
| Italic | |
| Monospace | |
| Section | |
| Reference | |
| Citation | |
| Footnote | |
| Image | |
| URL | |
| List item | |
| New page | |
| Comment | |
| Math inline | |
| Math display | |
| Fraction | |
| Command | Symbol | Command | Symbol |
|---|---|---|---|
| sin | | cos |
| tan | | log |
| ln | | exp |
| min | | max |
| lim | | Σ |
| Π | | ∫ |
| Command | Symbol |
|---|---|
| → |
| ← |
| ↔ |
| ⇒ |
| ⇐ |
| ⇔ |
| ↦ |
| ↑ |
| ↓ |