| name | latex-helper |
| description | LaTeX 助手 - 公式排版、表格图表、编译排错、常用模板、中文配置 |
| metadata | {"openclaw":{"emoji":"📐"}} |
LaTeX 助手
帮你写好 LaTeX:数学公式排版、复杂表格、图表浮动体、参考文献、编译报错排查、中文(ctex)配置。
功能概述
- 数学公式:行内
$...$、行间 \begin{equation}、矩阵、多行对齐 align、定理环境
- 表格:booktabs 三线表、跨页 longtable、合并单元格 multicolumn/multirow
- 图表:figure 浮动体、subfigure 并排、tikz 画图、pgfplots 数据图
- 参考文献:BibTeX / biblatex、natbib 引用样式
\citep \citet
- 中文配置:ctex 宏包、字体设置、ctexart/ctexbook 文档类
- 编译排错:解读常见报错(Undefined control sequence、Missing $ inserted 等)
常用公式速查
% 分数、上下标、根号
\frac{a}{b}, x^2, x_{i}, \sqrt{x}
% 求和、积分、极限
\sum_{i=1}^{n} x_i, \int_{0}^{\infty} f(x)\,dx, \lim_{x \to 0}
% 矩阵
\begin{pmatrix} a & b \\ c & d \end{pmatrix}
% 多行对齐
\begin{align}
y &= ax + b \\
&= cx + d
\end{align}
% 定理环境(需 amsthm)
\newtheorem{theorem}{定理}
\begin{theorem}...\end{theorem}
三线表(booktabs)
\begin{table}[htbp]
\centering
\caption{实验结果}
\begin{tabular}{lcc}
\toprule
方法 & 准确率 & F1 \\
\midrule
基线 & 0.85 & 0.83 \\
本文 & \textbf{0.91} & \textbf{0.90} \\
\bottomrule
\end{tabular}
\end{table}
中文文档模板(ctex)
\documentclass[UTF8]{ctexart}
\usepackage{amsmath,amssymb,booktabs,graphicx}
\title{论文标题}\author{作者}
\begin{document}
\maketitle
...
\end{document}
编译:xelatex(推荐,支持中文与系统字体)或 latexmk -xelatex。
常见报错速查
| 报错 | 原因 | 解决 |
|---|
| Undefined control sequence | 命令未定义/宏包没引 | 加 \usepackage{...} |
| Missing $ inserted | 数学符号在文本模式 | 用 $...$ 包裹 |
| Float too large | 图表超页面 | 加 [htbp] 或缩小 |
| ! LaTeX Error: File not found | 图片/bib 找不到 | 检查路径与扩展名 |
使用示例
帮我把这段公式排成带编号的对齐方程:y = ax+b = cx+d
编译报 "Undefined control sequence \toprule",怎么修?
帮我做一个 booktabs 三线表,4 列数据,含合并表头
适用场景
- 写论文/学位论文排版
- 公式与图表排版
- 编译报错排查
- 从 Word 转 LaTeX
不适用场景
- 需要图形化所见即所得(用 Overleaf/TeXstudio 更直观)
- 需要安装完整 TeX 发行版(本技能只给配置指引)