学术写作
未发现用户侧风险
LaTeX 论文转换
当用户要求将学术 LaTeX 论文从一种格式(如 Springer、IPOL)转换为另一种(如 MDPI、IEEE、Nature)时使用。自动执行提取、注入、格式修复和编译。
文件预览
1 个文件
SKILL.md
4.3 KB · 可预览
---
name: latex-paper-conversion
description: "This skill should be used when the user asks to convert an academic paper in LaTeX from one format (e.g., Springer, IPOL) to another format (e.g., MDPI, IEEE, Nature). It automates extraction, injection, fixing formatting, and compiling."
risk: safe
source: community
date_added: "2026-03-14"
---
# LaTeX Paper Conversion
## Overview
This skill automates the tedious and recurring process of converting an academic paper written in LaTeX from one publisher's template to another. Different journals (e.g., Springer, MDPI, IEEE) have vastly different structural requirements, document classes, margin settings, and bibliography styles. This skill streamlines these conversions by executing a structured multi-stage workflow, extracting content, mapping it to a new template, and resolving common compilation errors.
## When to Use This Skill
- Use when the user requests to port an existing LaTeX paper to a new journal's format.
- Use when the user provides an existing `.tex` file and a new template directory.
- Use when the user mentions converting from format A (e.g., IPOL/Neural Processing) to format B (e.g., MDPI).
## How It Works
### Step 1: Pre-requisites & Assessment
Identify the **Source LaTeX file** and asking the user for the **Target Template Directory**. Understand the core layout mapping (single-column vs. double-column, bibliography style).
### Step 2: Extraction & Injection Script Generation
Create a Python script (e.g., `convert_format.py`) to parse the source LaTeX file. Use Regular Expressions to extract core text blocks. Merge the new template's `preamble`, the extracted `body`, and the `backmatter`. Write this to a new file in an output directory.
### Step 3: Systematic Fixing
Perform generic fixes on the extracted body text before writing the final file, or in subsequent calls:
- Convert math environment cases (e.g., `\begin{theorem}` to `\begin{Theorem}`).
- Adjust aggressive float placements (e.g., `[!t]` or `[h!]`) to template-supported options. Avoid forcing `[H]` unless the `float` package is explicitly loaded.
- Ensure `\includegraphics` paths are relative to the new `.tex` file location.
- Convert `\begin{tabular}` to `\begin{tabularx}{\textwidth}` or use `\resizebox` if moving to a double-column layout.
### Step 4: Compilation & Debugging
Run a build cycle (`pdflatex` -> `bibtex` -> `pdflatex`). Check the `.log` file using `grep` or `rg` to systematically fix any packages conflicts, undefined commands, or compilation halts.
## Examples
### Example 1: Converting IPOL to MDPI
\```
USER: "I need to convert my paper 'SAHQR_Paper.tex' to the MDPI format located in the 'MDPI_template_ACS' folder."
AGENT: *Triggers latex-paper-conversion skill*
1. Analyzes source `.tex` and target `template.tex`.
2. Creates Python script to extract Introduction through Conclusion.
3. Injects content into MDPI template.
4. Updates image paths and table float parameters `[h!]` to `[H]`.
5. Compiles via pdflatex and bibtex to confirm zero errors.
\```
## Best Practices
- ✅ Always write a Python extraction script; DO NOT manually copy-paste thousands of lines of LaTeX.
- ✅ Always run `pdflatex` and verify the `.log` to ensure the final output compiles.
- ✅ Explicitly ask the user for the structural mapping if the source and target differ drastically (e.g., merging abstract and keywords).
- ❌ Don't assume all math packages automatically exist in the new template (e.g., add `\usepackage{amsmath}` if missing).
## Common Pitfalls
- **Problem:** Overfull hboxes in tables when moving from single to double column.
**Solution:** Detect `\begin{tabular}` and automatically wrap in `\resizebox{\columnwidth}{!}{...}` or suggest a format change.
- **Problem:** Undefined control sequence errors during compilation.
**Solution:** Search the `Paper.log` and include the missing `\usepackage{}` in the converted template.
## Additional Resources
- [Overleaf LaTeX Documentation](https://www.overleaf.com/learn)
## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
SKILL.md
元数据
| name | latex-paper-conversion |
|---|---|
| description | 当用户要求将学术 LaTeX 论文从一种格式(例如 Springer, IPOL)转换为另一种格式(例如 MDPI, IEEE, Nature)时使用此技能。它自动化提取、注入、格式修复和编译。 |
| risk | safe |
| source | community |
| date_added | 2026-03-14 |
LaTeX 论文转换
概述
此技能自动化了将用一种出版商模板编写的学术 LaTeX 论文转换为另一种模板的繁琐且重复的过程。不同期刊(如 Springer, MDPI, IEEE)在结构要求、文档类、页边距设置和参考文献样式上有巨大差异。本技能通过执行结构化的多阶段工作流程来简化这些转换:提取内容、映射到新模板、解决常见的编译错误。
何时使用本技能
- 当用户请求将现有 LaTeX 论文移植到新期刊格式时。
- 当用户提供现有的
.tex文件和一个新模板目录时。 - 当用户提到将格式 A(例如 IPOL/Neural Processing)转换为格式 B(例如 MDPI)时。
工作原理
步骤 1:先决条件与评估
识别源 LaTeX 文件,并向用户询问目标模板目录。了解核心布局映射(单栏 vs 双栏、参考文献样式)。
步骤 2:提取与注入脚本生成
创建一个 Python 脚本(例如 convert_format.py)来解析源 LaTeX 文件。使用正则表达式提取核心文本块。将新模板的序言部分、提取的正文、以及结尾部分合并。将其写入输出目录中的新文件。
步骤 3:系统性修复
在写入最终文件之前,或在后续调用中对提取的正文文本进行通用修复:
- 转换数学环境大小写(例如,将
\begin{theorem}转换为\begin{Theorem})。 - 将激进的浮动体放置选项(例如,
[!t]或[h!])调整为模板支持的选项。除非显式加载了float包,否则避免使用[H]。 - 确保
\includegraphics路径是相对于新.tex文件位置的。 - 如果转为双栏布局,将
\begin{tabular}转换为\begin{tabularx}{\textwidth}或使用\resizebox。
步骤 4:编译与调试
运行构建循环(pdflatex -> bibtex -> pdflatex)。使用 grep 或 rg 检查 .log 文件,系统性修复任何包冲突、未定义命令或编译中断。
示例
示例 1:将 IPOL 转换为 MDPI
text
用户:“我需要将我的论文‘SAHQR_Paper.tex’转换为位于‘MDPI_template_ACS’文件夹中的 MDPI 格式。”
代理:*触发 latex-paper-conversion 技能*
1. 分析源 `.tex` 和目标 `template.tex`。
2. 创建 Python 脚本提取从引言到结论的内容。
3. 将内容注入 MDPI 模板。
4. 更新图片路径,并将表格浮动参数 `[h!]` 改为 `[H]`。
5. 通过 pdflatex 和 bibtex 编译,确认零错误。最佳实践
- ✅ 始终编写 Python 提取脚本;不要手动复制粘贴数千行 LaTeX 代码。
- ✅ 始终运行
pdflatex并验证.log文件,确保最终输出成功编译。 - ✅ 如果源格式与目标格式差异很大(例如,摘要和关键词的合并),请明确向用户询问结构映射。
- ❌ 不要假设所有数学包自动存在于新模板中(例如,如果缺少,请添加
\usepackage{amsmath})。
常见陷阱
- 问题:从单栏转为双栏时表格出现 Overfull hbox。
解决方案:检测
\begin{tabular}并自动用\resizebox{\columnwidth}{!}{...}包裹,或建议格式更改。 - 问题:编译期间出现未定义控制序列错误。
解决方案:搜索
Paper.log并在转换后的模板中包含缺少的\usepackage{}。
附加资源
局限性
- 仅当任务明确符合上述范围时使用本技能。
- 不要将输出视为对环境特定验证、测试或专家审查的替代。
- 如果缺少必需的输入、权限、安全边界或成功标准,请停下来向用户澄清。