/paperfit:template-migratorfrom paperfit
Migrates LaTeX papers between conference templates (e.g., ECCV, ICLR), adapting figure sizes, page budgets, and macro compatibility. Triggered by /migrate-template command.
Ships in paperfit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
本技能专门处理 Category E:跨模板迁移缺陷,包括:
该技能由 code-surgeon-agent 在 /migrate-template 命令触发时调用,负责将一篇论文从原模板平滑迁移至目标模板,并自动适配图表尺寸、页数预算和宏包兼容性。这是 PaperFit 最具差异化价值的能力,直接解决了科研工作者切换会议投稿时的真实痛点。
能力边界:当前 typed runtime 没有自动模板迁移 executor,可选自动批处理的 --apply 必须报告不支持,不能偷偷回退到旧脚本。用户已授权迁移时,宿主可以用原生编辑工具完成并验证迁移,无需等待自动 executor。先核对建议:请你看看这是否是对的;保留原模板/源码及可回退候选,确认目标模板、当前编译页和内容。
| 缺陷 ID | 描述 | 优先级 | 是否允许语义修改 |
|---|---|---|---|
| E1 | 单栏↔双栏图表尺寸失配 | Critical | 否 |
| E2 | 页数预算不匹配 | Critical | 是(最后手段) |
| E3 | 模板特定宏兼容性 | Critical | 否 |
| 输入项 | 来源 | 说明 |
|---|---|---|
主 .tex 文件路径 | 项目上下文 | 需修改的源文件 |
| 目标模板名称 | 用户命令参数 | 如 ECCV2024、ICLR2025 |
| 模板配置 | config/templates.yaml | 包含目标模板的栏数、默认字号、页宽、预期页数等 |
| 原模板信息 | 自动检测或用户指定 | 当前 \documentclass 及主要宏包 |
| 排版侦探报告 | layout-detective-agent | 迁移后首次编译的 E 类缺陷列表 |
{
"skill": "template-migrator",
"status": "success | partial | failed",
"modified_files": ["main.tex", "figures/fig1.tex"],
"changes": [
{
"defect_id": "E1",
"object": "Figure 1",
"action": "单栏图改为跨栏图",
"before": "\\begin{figure}\n\\includegraphics[width=\\linewidth]{fig1.pdf}\n\\end{figure}",
"after": "\\begin{figure*}\n\\includegraphics[width=\\textwidth]{fig1.pdf}\n\\end{figure*}"
}
],
"macro_fixes": [
{
"issue": "\\theoremstyle undefined in ECCV",
"fix": "改用 \\newtheorem 直接定义"
}
],
"unresolved": [],
"page_budget_status": {
"current_pages": 9,
"target_pages": 14,
"gap": 5,
"action_taken": "核对用户页数政策并比较保持内容的布局候选"
}
}
config/templates.yaml 读取目标模板的完整配置。documentclass:如 \documentclass[10pt,twocolumn]{article} 或 \documentclass{iclr2025}column_type:single 或 doubledefault_figure_width:\linewidth 或 \textwidthexpected_pages:配置中的页数参考值;不能代替用户指定的 exact/at_most、正文/参考文献/附录范围或当前投稿规则forbidden_packages:与新模板冲突的宏包列表required_packages:新模板必须加载的宏包示例配置(config/templates.yaml 片段):
ECCV2024:
documentclass: "\documentclass[10pt,twocolumn]{article}"
column_type: double
default_figure_width: "\linewidth"
expected_pages: 14
forbidden_packages: ["amsthm", "algorithm2e"]
required_packages: ["graphicx", "amsmath", "amssymb"]
float_behavior: "figures may use figure* for wide content"
.tex 文件的 \documentclass 声明。\usepackage{...})。\documentclass 自动推断。候选管理:
\documentclass将原 \documentclass 替换为目标模板的声明。
% 修改前(ICLR 2025 单栏)
\documentclass{iclr2025}
% 修改后(ECCV 2024 双栏)
\documentclass[10pt,twocolumn]{article}
注意:若目标模板有多个可选参数(如 review、final),询问用户偏好或使用默认值。
forbidden_packages。\usepackage 行。algorithm2e → algorithmic)。\ifdefined 等实现跨模板兼容。% 修改前(含 amsthm,与新模板冲突)
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
% 修改后(改用 LaTeX 原生定义)
% \usepackage{amsthm} % removed for template compatibility
\newtheorem{theorem}{Theorem}
若目标模板要求特定宏包(如 graphicx),确保导言区已加载。若缺失,添加之。
% 确保必需宏包存在
\usepackage{graphicx}
\usepackage{amsmath}
这是跨模板迁移中最关键、最易出错的环节。
| 原模板 | 目标模板 | 处理策略 |
|---|---|---|
| 单栏 | 双栏 | 所有图表默认改为单栏宽(\columnwidth),宽图改为跨栏(figure*) |
| 双栏 | 单栏 | 所有跨栏图(figure*)改为普通图(figure),宽度改为 \linewidth |
| 双栏 | 双栏 | 保持原策略,仅检查宽度是否适配新模板的栏宽 |
| 单栏 | 单栏 | 基本不变,仅检查页宽是否变化 |
对于原单栏中的全宽图,在双栏中若仍用单栏会显得过小。需根据图片宽高比智能决策:
figure*。figure,但宽度设为 \columnwidth。% 原单栏全宽图(宽度 = \linewidth)
\begin{figure}
\includegraphics[width=\linewidth]{wide_arch.pdf}
\end{figure}
% 迁移后(宽高比大,改为跨栏)
\begin{figure*}
\includegraphics[width=\textwidth]{wide_arch.pdf}
\end{figure*}
\columnwidth。tabularx{\linewidth},改为 tabularx{\columnwidth}。table* 并使用 \textwidth。% 修改前(单栏宽表)
\begin{table}
\begin{tabularx}{\linewidth}{|l|X|X|}
...
\end{tabularx}
\end{table}
% 修改后(双栏单栏宽表)
\begin{table}
\begin{tabularx}{\columnwidth}{|l|X|X|}
...
\end{tabularx}
\end{table}
equation 改为 multline 或 align 并手动断行。figure*。Undefined control sequence 等错误(E3),返回第三步修正宏包冲突。layout-detective-agent 检测 E1/E2 缺陷。expected_pages 仅为参考。space-util-fixer 比较原生布局、人工空白、对象容器和自然流动;增页修改应同步考虑补偿候选。--keep-content 不是改内容的授权。输出一份 Markdown 迁移报告,包含:
双栏模板的排版行为与单栏有本质不同:
\FloatBarrier 或调整源码位置。迁移成功的判定标准:
Template Migrator Skill 就绪。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/consistency-polisherInspect and repair local table, figure, and caption presentation while preserving content and venue formatting./float-optimizerPaperFit advice for LaTeX figure/table placement, width, clustering and breakable-table flow, verified against current page images./overflow-repairPaperFit overflow repair expertise for LaTeX paper layout./paperfitDiagnose and repair LaTeX paper layout through PaperFit's structured visual closed loop over rendered pages, source-grounded repairs, and visual verification. Use for overflowing figures or tables, float placement, readability, and submission page budgets./space-util-fixerPaperFit space util fixer expertise for LaTeX paper layout./taxonomy-vtoPaperFit taxonomy vto expertise for LaTeX paper layout.npx claudepluginhub openraiser/paperfit --plugin paperfitOther plugins' skills for the same job