/paperfit:space-util-fixerfrom paperfit
Fixes space utilization defects in LaTeX paper layouts including widow/orphan lines, page budget violations, unbalanced columns, and vertical holes.
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 A:空间利用缺陷,包括:
figure*/[H]/不当断页有关)该技能由 code-surgeon-agent 或 semantic-polish-agent 调用,通过对段落级排版控制、浮动体调度和最小语义改写的组合运用,优化页面空间分配,使文档达到专业级的视觉均衡。
空间利用问题的修复常常需要多轮迭代,因为局部调整会影响全局分页。因此,每次修改后必须重新编译并审查页图。
宿主先核对检测建议:请你看看这是否是对的,根据当前页图和源码采纳、调整或拒绝。收到用户排版修复授权后,宿主可用原生工具编辑;无需调用可选批处理来获得相同授权。可选自动批处理默认只生成计划,写回需要显式 --apply,多轮批处理另需 --max-rounds N 及其 runtime 就绪、范围和当前证据检查。
| 缺陷 ID | 描述 | 优先级 | 是否允许语义修改 |
|---|---|---|---|
| A1 | 孤行/寡行 | High | 是(最后手段) |
| A2 | 末页大面积留白 | High | 是(最后手段) |
| A3 | 页数预算违反 | Critical | 是(最后手段) |
| A4 | 双栏末页左右栏高度不齐 | Medium | 否 |
| A5 | 双栏页内列竖向空洞(非末页、栏内大块无正文空白) | High | 视情况 |
| 输入项 | 来源 | 说明 |
|---|---|---|
主 .tex 文件路径 | 项目上下文 | 需修改的源文件 |
| 排版侦探报告 | layout-detective-agent 输出 | 包含 A 类缺陷的页码和描述 |
| 目标页数(若适用) | 用户约束 | A3 修复必须提供 |
| 模板类型 | templates.yaml 或上下文 | 单栏/双栏 |
{
"skill": "space-util-fixer",
"status": "success | partial | failed",
"modified_files": ["main.tex"],
"changes": [
{
"defect_id": "A1",
"object": "第4页顶部孤行",
"action": "在段落前添加 \\looseness=-1",
"before_snippet": "The proposed method achieves...",
"after_snippet": "{\\looseness=-1 The proposed method achieves...\\par}"
}
],
"unresolved": []
}
\newpage 或 \clearpage 来“凑页数”,这会破坏文档结构的自然性。问题特征:
候选策略:按实际段落、页图和模板选择,可组合有共同原因的修改,不要求依次试完。
\looseness=-1)通过在段落前设置 \looseness=-1,指示 TeX 引擎尝试将段落收缩一行,从而消除孤行或小尾巴。
% 修改前
The proposed method achieves state-of-the-art performance on several
benchmarks, demonstrating the effectiveness of our approach.
% 修改后
{\looseness=-1 The proposed method achieves state-of-the-art performance on several
benchmarks, demonstrating the effectiveness of our approach.\par}
注意:
{ } 括起,并在组内结束段落(\par),使 TeX 断行时仍使用局部设置。若先关闭组、再以空行结束段落,设置已经恢复,可能完全无效。\looseness=1)若段落太紧,可尝试扩张一行,使段末行变长。
{\looseness=1 This paragraph will be typeset with one more line...\par}
\emergencystretch)在局部段落中试验后备伸展量,比较实际断行和词间距;它不是增加段落间或行间的竖向空白,也不保证改变行数。
{\emergencystretch=1em This paragraph content...\par}
semantic-polish-agent)若排版控制无效,则进行最小语义改写:
in order to 改为 to,或将 demonstrate 改为 show)。% 修改前
The proposed method achieves state-of-the-art performance on several
benchmarks, demonstrating the effectiveness of our approach.
% 修改后
The proposed method achieves state-of-the-art results on several
benchmarks, showing the effectiveness of our approach.
语义改写必须获得针对正文编辑的单独授权,并由 semantic-polish-agent 执行,本技能仅提出请求。布局修复授权不包含正文改写;布局验收会检查实际正文 token,候选标签不能覆盖正文差异。
在导言区增加以下设置(通常模板已包含,可作为兜底):
\widowpenalty=10000
\clubpenalty=10000
\displaywidowpenalty=10000
注意:此设置影响全局,需谨慎。若模板已设置,则无需重复。
Read docs/PAGE_FIT_TOOLBOX.md from the PaperFit package root. Plan the requested page objective, readability, template and float flow together from the start. Use the host's native tools to test a coherent layout change.
问题特征:
修复策略:
\balance 或 flushend 宏包在导言区加载 flushend 宏包,自动平衡末页两栏高度。
\usepackage{flushend}
注意:flushend 与某些宏包(如 multicol)可能冲突,需在特定模板下测试。
若自动平衡无效,在最后一节结束前插入 \balance 命令(需 balance 宏包)。
\usepackage{balance}
...
\section{Conclusion}
...
\balance
\end{document}
对末页最后一段使用 \looseness=-1 或 \looseness=1,改变其行数,从而影响两栏高度。
若末页有浮动体,尝试将其移至前一页或强制放在当前页底部,以改变栏内内容分布。
问题特征:某一页左栏或右栏在标题/段落后出现大块竖向空白(无图无表),另一栏同期仍有连续正文;常见于 figure* 顶到下一页后在栏内留下“断层”、滥用 \\ / \clearpage、\FloatBarrier、[H] 等。
修复策略(优先浮动体与断页,再动正文):
figure* / table*:尝试将浮动环境在源码中前移/后移,或改为单栏 figure/table(若尺寸允许)。\\(段内强制换行)、\newpage、\vfill;慎用 [H]。\FloatBarrier,评估是否可删除或挪到节末。Float too large 日志后再看栏内空洞是否消失。\looseness。正文改写需要已有的单独授权和语义核验,不得为填空白添加句子。每完成一项修复后:
Space Utilization Fixer Skill 就绪。 等待调用,优化页面空间分配。
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub openraiser/paperfit --plugin paperfit9 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.Other plugins' skills for the same job