latex-scaffold

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LaTeX Scaffold

LaTeX项目骨架搭建

Convert the approved Markdown draft into a minimal, buildable LaTeX project.
This is a deterministic conversion step; prose quality should already be addressed in
output/DRAFT.md
.
将已审核通过的Markdown草稿转换为可编译的极简LaTeX项目。
这是一个确定性的转换步骤;文本质量应已在
output/DRAFT.md
中完成优化。

Inputs

输入文件

  • output/DRAFT.md
    (or another approved draft)
  • citations/ref.bib
  • output/DRAFT.md
    (或其他已审核通过的草稿)
  • citations/ref.bib

Outputs

输出文件

  • latex/main.tex
    (and any required LaTeX support files)
  • latex/main.tex
    (及所有必要的LaTeX支持文件)

Workflow

工作流程

  1. Create
    latex/
    directory if missing.
  2. Create
    latex/main.tex
    with sections matching the outline.
  3. Wire bibliography to
    citations/ref.bib
    .
  1. latex/
    目录不存在则创建该目录。
  2. 创建
    latex/main.tex
    ,其章节结构与草稿大纲匹配。
  3. 配置参考文献指向
    citations/ref.bib

Quality checklist

质量检查清单

  • latex/main.tex
    exists and references
    citations/ref.bib
    .
  • latex/main.tex
    已生成且正确引用
    citations/ref.bib

Script

脚本使用说明

Quick Start

快速开始

  • python .codex/skills/latex-scaffold/scripts/run.py --help
  • python .codex/skills/latex-scaffold/scripts/run.py --workspace <workspace_dir>
  • python .codex/skills/latex-scaffold/scripts/run.py --help
  • python .codex/skills/latex-scaffold/scripts/run.py --workspace <workspace_dir>

All Options

所有选项

  • See
    --help
    (inputs/outputs are taken from the unit runner when used via pipeline)
  • 查看
    --help
    获取详情(通过工作流使用时,输入/输出由单元运行器自动处理)

Examples

示例

  • Build
    latex/main.tex
    from
    output/DRAFT.md
    :
    • python .codex/skills/latex-scaffold/scripts/run.py --workspace <ws>
  • output/DRAFT.md
    生成
    latex/main.tex
    • python .codex/skills/latex-scaffold/scripts/run.py --workspace <ws>

Notes

注意事项

  • The generated
    latex/main.tex
    includes a table of contents (tocdepth=2) for readability.
  • Language default: the scaffold uses
    article
    (English-looking front matter). If the draft contains CJK characters, it switches to
    ctexart
    so the PDF renders correctly.
  • Conversion rules (high level):
    • Headings
      ##/###/####
      \section/\subsection/\subsubsection
      (strips leading numeric prefixes like
      1.2
      ).
    • Headings starting with
      Appendix
      /
      附录
      trigger
      \appendix
      once, then render as appendix sections.
    • Bold caption lines like
      **Table 1. ...**
      /
      **Appendix Table A1. ...**
      immediately before a Markdown table become a LaTeX
      table
      float with
      \caption{...}
      and a stable
      \label{tab:...}
      .
    • ## Abstract
      abstract
      environment.
    • [@Key]
      or
      [@Key1; @Key2]
      \citep{Key}
      /
      \citep{Key1,Key2}
      .
    • Inline markdown
      **bold**
      /
      *italic*
      /
      `code`
      \textbf{}
      /
      \emph{}
      /
      \texttt{}
      .
  • 生成的
    latex/main.tex
    包含目录(tocdepth=2)以提升可读性。
  • 默认语言:骨架模板使用
    article
    文档类(英文格式的前置内容)。若草稿包含CJK字符,将自动切换为
    ctexart
    文档类以确保PDF渲染正常。
  • 转换规则(概要):
    • 标题
      ##/###/####
      \section/\subsection/\subsubsection
      (移除类似
      1.2
      的数字前缀)。
    • Appendix
      /
      附录
      开头的标题将触发
      \appendix
      命令,之后的标题将作为附录章节渲染。
    • 表格前的粗体标题行(如
      **Table 1. ...**
      /
      **Appendix Table A1. ...**
      )将转换为LaTeX的
      table
      浮动环境,包含
      \caption{...}
      和固定的
      \label{tab:...}
    • ## Abstract
      abstract
      环境。
    • [@Key]
      [@Key1; @Key2]
      \citep{Key}
      /
      \citep{Key1,Key2}
    • 行内Markdown格式
      **粗体**
      /
      *斜体*
      /
      `代码`
      \textbf{}
      /
      \emph{}
      /
      \texttt{}

Troubleshooting

故障排除

Issue: the generated
latex/main.tex
still contains Markdown markers

问题:生成的
latex/main.tex
仍包含Markdown标记

Fix:
  • Re-run
    latex-scaffold
    and ensure the input
    output/DRAFT.md
    is clean (no
    ##
    , no
    **
    , no
    [@...]
    syntax that isn""t handled).
解决方法
  • 重新运行
    latex-scaffold
    ,确保输入的
    output/DRAFT.md
    文件干净(无未被处理的
    ##
    **
    [@...]
    语法)。

Issue: citations are missing in LaTeX

问题:LaTeX中缺少参考文献引用

Fix:
  • Ensure
    citations/ref.bib
    exists and the scaffold points bibliography to it; then compile with
    latex-compile-qa
    .
解决方法
  • 确保
    citations/ref.bib
    文件存在,且骨架已正确配置指向该文件;然后使用
    latex-compile-qa
    命令编译。