SuperAPI AI Directory

5writing

Writing & research

View repository

Updated 10-15 23:32

About this skill

Competition Paper Writing (Typst / LaTeX)

This skill follows 3coding-visual and 4drawio. The preceding phases only provide real data, figure PDFs, and record files; this phase is responsible for selecting the competition template and typesetting engine, organizing the paper structure, and deciding which section each figure and table goes into.

Typst engine: you can invoke the typst-author skill to learn Typst writing;LaTeX engine: refer to the "LaTeX Writing Key Points" section at the end of this file.

Mathematical Modeling Standards Reference

If domain judgment is needed, read the ../_references/math_modeling_norms.md sections "Paper Writing", "Figures/Tables and Visualization", and "Non-Data Figure Tool Selection". This file serves only as a standards knowledge base; the paper structure is still determined by the competition template and the content of the current competition problem.

Template Families

The templates bundled in this skill are located at:

templates/zh/<竞赛>/main.typ         # Typst 模板
templates/zh/<竞赛>-latex/main.tex   # LaTeX 模板
templates/en/<竞赛>/main.typ         # Typst 模板
templates/en/<竞赛>-latex/main.tex   # LaTeX 模板

LaTeX Template Coverage: All Chinese templates and English templates already have LaTeX versions (the-latex suffix), compiled with xelatex.

Supported Chinese templates (Typst + LaTeX dual versions):

apmcm, changsanjiao, cumcm, default, diangongbei, dongsansheng,
huashubei, huaweibei, huazhongbei, mathorcup, mcm, shuweibei, stats, wuyibei

Huawei Cup, Huazhong Cup, and Wuyi Cup uniformly use huaweibei、huazhongbei、wuyibei as the template.

Supported English templates (Typst + LaTeX dual versions):

apmcm, default, mcm

All numerical, figure, and table conclusions in the paper must come from reports/RESULTS_REPORT.md or figures/*. Fabrication, estimation, or use of a different rounding method is not allowed.

Workflow

Step 0: Determine the typesetting engine

Before writing the paper, the user must choose the typesetting engine. The engine determines all subsequent steps (template path, section file extension, figure insertion syntax, compilation command); choosing wrong will cause formatting errors throughout the paper.

Use the AskUserQuestion tool to ask the user: "Which typesetting engine will be used to write the paper?"

  • Option 1: LaTeX (compiled with xelatex, mainstream for mathematical modeling competitions, all templates ready) — put the recommended option first
  • Option 2: Typst (compiled with typst, invoke the typst-author skill to assist writing)

Before asking, first read the "User Preferences → Typesetting Engine" field of plan.md as the preset option:

  • If plan.md already records the engine choice, confirm with the user: "The previously selected engine is detected to be <LaTeX/Typst>, continue using it?"
  • If plan.md does not exist or does not record an engine choice, directly ask the user to choose.
  • If the user does not specify clearly or skips,use LaTeX by default。

Select the corresponding template family according to the determined engine:

  • Typst engine: use templates/<lang>/<竞赛>/main.typ, invoke the typst-author skill. Compilation command typst compile main.typ。
  • LaTeX engine: use templates/<lang>/<竞赛>-latex/main.tex, xelatex compilation (both Chinese and English need to be run twice to resolve cross-references). Compilation command xelatex -interaction=nonstopmode main.tex(execute twice).

All code examples, file extensions, and figure insertion syntax in subsequent steps must use the version corresponding to the selected engine; do not mix them.

Step 1: Select language and template

Unless the user explicitly requests Chinese, MCM/ICM/COMAP shall always use English. All Chinese competition names use Chinese.

Template key example (Typst engine):

长三角 -> zh/changsanjiao
APMCM 英文版 -> en/apmcm
全国赛/国赛/CUMCM -> zh/cumcm
统计建模 -> zh/stats
MCM/ICM/COMAP -> en/mcm

Template key example (LaTeX engine):

全国赛/国赛/CUMCM -> zh/cumcm-latex
MCM/ICM/COMAP -> en/mcm-latex

Step 2: Prepare the template

Use the following command to check whether the bundled template is accessible (SKILL_DIR is the directory where this skill is located):

Typst template:

ls "$SKILL_DIR/templates/zh/<竞赛>/main.typ" 2>/dev/null && echo "OK" || echo "MISSING"
  • File exists (OK): directly copy the entire templates/zh/<竞赛>/ directory to paper/. These templates are self-contained entry files and do not depend on additional shared style files.
  • File does not exist (MISSING): this indicates that the skill is not fully installed or is in a sandbox. In this case, follow the corresponding section file structure listed in Step 3 of this SKILL.md to rebuild a minimal compilable Typst framework from scratch, and note "rebuilt from default structure" in paper/ .

When a matching template exists, never write the paper from scratch.

LaTeX template:

ls "$SKILL_DIR/templates/zh/<竞赛>-latex/main.tex" 2>/dev/null && echo "OK" || echo "MISSING"
  • File exists (OK): copy the entire templates/zh/<竞赛>-latex/ directory to paper/。
  • File does not exist (MISSING): this indicates that the skill is not fully installed or is in a sandbox. In this case, follow the corresponding section file structure listed in Step 3 of this SKILL.md to rebuild a minimal compilable LaTeX framework from scratch, and note "rebuilt from default-latex structure" in paper/ .

Step 3: Build the figure and table plan

Before writing each section of the main text, based on figures/*.pdf、reports/RESULTS_REPORT.md, and reports/DRAWIO_REPORT.md(if it exists), build the figure and table plan:

图表规划
fig_roadmap.pdf -> 引言/问题重述
fig_flow_q1.pdf -> 问题一模型构建
fig_flow_q2.pdf -> 问题二模型构建
fig_pipeline.pdf -> 数据预处理/方法节
结果图 -> 对应的结果节

Image paths are relative to the file in which the image is written: when written in paper/main.typ or paper/main.tex , usually use ../figures/xxx.pdf; when written in paper/sections/*.typ or paper/sections/*.tex , usually use ../../figures/xxx.pdf。

Typst engineImage insertion:

#figure(
  image("../../figures/fig_q1_error_dist.pdf", width: 85%),
  caption: [问题一预测误差分布],
)

LaTeX engineImage insertion:

\begin{figure}[H]
  \centering
  \includegraphics[width=0.85\textwidth]{../../figures/fig_q1_error_dist.pdf}
  \caption{问题一预测误差分布}
  \label{fig:q1_error}
\end{figure}

English papers use English captions.

Step 4: Write each section

The following section file names use the .typ(Typst) or .tex(LaTeX) extension according to the selected engine. For example, the Typst engine uses 1_restatement.typ, and the LaTeX engine uses 1_restatement.tex. The main body of the file name remains consistent.

Section files of the general Chinese mathematical modeling template (changsanjiao、diangongbei、huashubei、mathorcup、wuyibei):

1_restatement.typ  - 问题重述与分析
2_analysis.typ     - 数据理解与总体思路
3_assumptions.typ  - 模型假设
4_symbols.typ      - 符号说明
5_problem1.typ     - 问题一建模与求解
6_problem2.typ     - 问题二建模与求解
7_problem3.typ     - 问题三建模与求解
...         - 根据题目调整问题数量  
8_evaluation.typ   - 灵敏度分析、模型评价与推广
A_code.typ         - 附录代码

National Competition/Huazhong Cup/Huawei Cup (cumcm、huazhongbei、huaweibei) follow the section structure below:

1_restatement.typ
2_analysis.typ
3_assumptions.typ
4_symbols.typ
5_problem1.typ
6_problem2.typ
7_problem3.typ
...        - 根据题目调整问题数量
8_sensitivity.typ
9_evaluation.typ
A_code.typ

The Northeast Three Provinces template (dongsansheng) additionally uses a separate abstract file:

abstract.typ
1_restatement.typ
2_analysis.typ
3_assumptions.typ
4_symbols.typ
5_problem1.typ
6_problem2.typ
7_problem3.typ
...       - 根据题目调整问题数量
8_evaluation.typ
A_code.typ

The Shuwei Cup template (shuweibei) retains the original LaTeX example entry naming:

Abstract.typ
Introduction.typ
2_analysis.typ
3_assumptions.typ
4_symbols.typ
5_problem1.typ
6_problem2.typ
7_problem3.typ
...      - 根据题目调整问题数量
8_evaluation.typ
Appendices1.typ
A_code.typ

Chinese default template (default):

1_restatement.typ
2_assumptions.typ
3_symbols.typ
4_problem1.typ
5_problem2.typ
6_problem3.typ
...      - 根据题目调整问题数量
7_sensitivity.typ
8_evaluation.typ
A_code.typ

Section files of the Chinese statistical modeling template:

1_introduction.typ
2_method.typ
3_data.typ
4_analysis.typ
5_results.typ
6_conclusion.typ
A_code.typ

Section files of the English MCM/APMCM (en/mcm、en/apmcm、zh/mcm、zh/apmcm):

1_introduction.typ
2_assumptions.typ
3_model_design.typ
4_solution.typ
5_sensitivity.typ
6_strengths_weaknesses.typ
7_conclusions.typ
A_code.typ

LaTeX template section files(corresponding to the -latex suffix template, with a one-to-one correspondence to the Typst version structure):

National Competition LaTeX template (zh/cumcm-latex, corresponding to the cumcm Typst version):

1_restatement.tex
2_analysis.tex
3_assumptions.tex
4_symbols.tex
5_problem1.tex
6_problem2.tex
7_problem3.tex
8_sensitivity.tex
9_evaluation.tex
A_code.tex

MCM/ICM LaTeX template (en/mcm-latex):

1_introduction.tex
2_assumptions.tex
3_model_design.tex
4_solution.tex
5_sensitivity.tex
6_strengths_weaknesses.tex
7_conclusions.tex
A_code.tex

The section file naming of the remaining LaTeX templates (changsanjiao-latex、default-latex、huashubei-latex、mathorcup-latex、wuyibei-latex、huazhongbei-latex、huaweibei-latex、diangongbei-latex、dongsansheng-latex、shuweibei-latex、stats-latex、apmcm-latex、mcm-latex、en/apmcm-latex、en/default-latex) is similar to the above structure, subject to the file names referenced by main.tex in \input{} .

English default template (en/default):

1_introduction.typ
2_assumptions.typ
3_notations.typ
4_model.typ
5_sensitivity.typ
6_evaluation.typ
7_conclusions.typ
A_code.typ

Main text writing should use coherent academic paragraphs. Avoid workflow-internal names in the final paper, such as reports/、figures/ or CLAUDE.md。

Step 5: References

Use only references that actually exist. Choose the file name by engine: for Typst use paper/references.typ, for LaTeX use paper/references.tex。

Typst engine:

#set enum(numbering: "[1]")
#enum[
  作者. 题名[J]. 期刊名, 年份, 卷(期): 页码.
  Author. "Title." Journal or Conference, year.
]

In-text superscript citation:相关研究已用于物流网络优化#super("[1]")。

LaTeX engine:

\begin{thebibliography}{99}
  \bibitem{ref1} 作者. 题名[J]. 期刊名, 年份, 卷(期): 页码.
  \bibitem{ref2} Author. "Title." Journal, year.
\end{thebibliography}

Use \cite{ref1} or \cite{ref1,ref2}。

Step 6: Write the abstract or summary last

After all sections are complete, write a Chinese abstract or English Summary Sheet. It must include the method and precise numerical results for each sub-problem.

Key points for LaTeX writing

The following key points are for the LaTeX engineto use. For the Typst engine, please call the typst-author skill to get syntax help.

Compilation command

# 中文模板(xelatex,跑两遍解决交叉引用)
xelatex main.tex && xelatex main.tex

# 英文模板(xelatex,同样跑两遍)
xelatex main.tex && xelatex main.tex

Document structure

\documentclass[a4paper,12pt]{article}   % 英文
\documentclass[a4paper,12pt]{ctexart}   % 中文

\usepackage{...}   % 宏包加载
\usepackage{graphicx}   % 图片支持
\usepackage{booktabs}   % 三线表
\usepackage{amsmath,amssymb}   % 数学公式
\usepackage{hyperref}   % 交叉引用(需两遍编译)

Inserting figures and tables

\begin{figure}[H]
  \centering
  \includegraphics[width=0.85\textwidth]{../../figures/fig_q1.pdf}
  \caption{图注}
  \label{fig:q1}
\end{figure}

% 三线表
\begin{table}[htbp]
  \centering
  \caption{表注}
  \begin{tabular}{ccc}
    \toprule
    \textbf{列1} & \textbf{列2} & \textbf{列3} \\
    \midrule
    数据 & 数据 & 数据 \\
    \bottomrule
  \end{tabular}
\end{table}

Cross-references

如图~\ref{fig:q1}所示,...   % 图片引用
式~(\ref{eq:objective}) 给出...   % 公式引用
见第~\pageref{fig:q1} 页   % 页码引用

Mathematical formulas

行内公式:$f(x) = \sum_{i=1}^n \theta_i \phi_i(x)$

行间公式:
\begin{equation}
  \mathcal{L}(\theta) = \frac{1}{N}\sum_{i=1}^N (y_i - \hat{y}_i)^2
  \label{eq:objective}
\end{equation}

Sections and emphasis

\section{问题重述}
\subsection{问题背景}
\textbf{问题一:} xxx   % 对应 Typst 的 #strong