LaTeX 是一种基于 TeX 的排版系统,广泛用于生成科学和数学文档。以下是一些常用的 LaTeX 语法速查:

基础语法

  • 标题:使用 \title{} 声明文档标题。
\title{我的文档}
\author{作者名}
\date{\today}
\begin{document}
\maketitle
\end{document}
  • 段落:LaTeX 自动处理段落格式。
这是一段文本。这是另一段文本。
  • 换行:使用 \newline 或空行来实现换行。
这是一行文本。
\newline
这是另一行文本。

文本格式

  • 加粗:使用 \textbf{}
\textbf{加粗文本}
  • 斜体:使用 \textit{}
\textit{斜体文本}
  • 下划线:使用 \underline{}
\underline{下划线文本}

链接与图片

  • 链接:使用 \href{}
\href{https://www.example.com}{访问网站}
  • 图片:使用 \includegraphics{}
\includegraphics[width=0.5\textwidth]{example.png}

表格

  • 创建表格:使用 tabular 环境。
\begin{tabular}{|c|c|c|}
\hline
列1 & 列2 & 列3 \\
\hline
内容1 & 内容2 & 内容3 \\
\hline
\end{tabular}

数学公式

  • 简单公式:使用 $
$x^2 + y^2 = z^2$
  • 复杂公式:使用 \[ ... \]
\[
\frac{d}{dx} \left( \int_0^x f(t) \, dt \right) = f(x)
\]

更多详细内容,请参考我们的 LaTeX 教程