agentleFS
flonatflonat/flonat-research/skills/latex-scaffold/SKILL.md

latex-scaffold

Skill150 starsChanged 11 days agoMITView on GitHub

Convert an existing Markdown manuscript draft into a buildable LaTeX project with canonical structure and build configuration. Use when prose already exists but no LaTeX source tree does. Not for checking template drift in an existing project; use $latex-template.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the Markdown file and inventory:

    line 36
  2. Very specific:

    After conversion, scan the .tex file for any remaining Markdown syntax:

    line 103
  3. Very specific:

    If a .bib file exists in the project, point \addbibresource{} to it

    line 114
  4. Very specific:

    If the project has a references.bib, use that

    line 115
  5. Very specific:

    If no .bib exists but citations are present, create placeholder comments: % TODO: create .bib with keys: Key1, Key2, ...

    line 116
  6. Very specific:

    Ensure \printbibliography is at the end of the document (not \bibliography{})

    line 117
  7. Very specific:

    Run latex to compile. Verify:

    line 121
  8. Very specific:

    Before writing \cite{key}, verify with paperpile get-item key and paperpile export-bib key.

    line 154
  9. Very specific:

    If unresolved, write \CiteTodo{slug}{title/author/year/DOI hint} — never a guessed key.

    line 157
  10. Very specific:

    Run scripts/bib/citation_lint.py before commit.

    line 160

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LaTeX Scaffold

Convert an approved Markdown draft into a minimal, compilable LaTeX project. This is a deterministic format conversion — prose quality should already be addressed in the source draft.

When to Use

  • Converting a literature review, survey, or report from Markdown to LaTeX for PDF output
  • Turning meeting notes or drafts into a formatted document
  • Bootstrapping a LaTeX project from an existing outline
  • Any time you need md→tex without rewriting content

Inputs

  • A Markdown file (.md) — the draft to convert
  • A .bib file (optional) — if the draft contains citations

Outputs

  • A .tex file ready to compile with latex
  • The fail-closed canonical .latexmkrc if one does not already exist. Invoke the latex pre-flight to copy the canonical artifact; never synthesize selected directives.

Workflow

Step 1: Analyse the Draft

Read the Markdown file and inventory:

  • Heading structure (determine \section / \subsection depth)
  • Citations ([@Key] or [@Key1; @Key2] patterns)
  • Tables (Markdown pipe tables)
  • Math blocks ($...$ inline, $$...$$ display)
  • Figures (![caption](path))
  • Code blocks (fenced with language)
  • Whether an abstract section exists

Step 2: Create the LaTeX File

Apply these conversion rules:

MarkdownLaTeX
# Title (first H1)\title{...}
## Section\section{...}
### Subsection\subsection{...}
#### Subsubsection\subsubsection{...}
## Abstract\begin{abstract}...\end{abstract}
Headings starting with Appendix\appendix once, then \section{...}
**bold**\textbf{...}
*italic*\emph{...}
`code`\texttt{...}
[@Key]\citep{Key}
[@Key1; @Key2]\citep{Key1,Key2}
@Key (inline)\citet{Key}
$...$ / $$...$$Pass through unchanged
- item\begin{itemize}\item ...\end{itemize}
1. item\begin{enumerate}\item ...\end{enumerate}
> quote\begin{quote}...\end{quote}
![caption](path)\begin{figure}[htbp]\includegraphics{path}\caption{caption}\end{figure}
Pipe tables\begin{table}[htbp]\begin{tabular}{...}...\end{tabular}\end{table}
Fenced code blocks\begin{verbatim}...\end{verbatim}
--- (horizontal rule)\bigskip\hrule\bigskip or omit

Preamble Template

\documentclass[a4paper,11pt]{article}

\usepackage[a4paper,margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\usepackage[backend=biber,style=authoryear,natbib=true]{biblatex}
\addbibresource{references.bib}

\title{...}
\author{...}
\date{\today}

\begin{document}
\maketitle
% content here
\printbibliography
\end{document}

Adjust the preamble based on what the draft actually uses (e.g., skip graphicx if no figures). The natbib=true option provides \citet/\citep compatibility. If the project already uses natbib (e.g., with a journal .bst file), keep natbib — but for new scaffolds, biblatex is the default.

Step 3: Strip Markdown Residue

After conversion, scan the .tex file for any remaining Markdown syntax:

  • ## heading markers
  • ** bold markers
  • [@ citation markers
  • Pipe | table syntax
  • ![ image markers

These indicate incomplete conversion — fix them.

Step 4: Wire Bibliography

  • If a .bib file exists in the project, point \addbibresource{} to it
  • If the project has a references.bib, use that
  • If no .bib exists but citations are present, create placeholder comments: % TODO: create .bib with keys: Key1, Key2, ...
  • Ensure \printbibliography is at the end of the document (not \bibliography{})

Step 5: Compile and Verify

Run latex to compile. Verify:

  • Document compiles without errors
  • All citations resolve (or are marked as TODO)
  • Tables render correctly
  • Math renders correctly
  • Page count is reasonable

Rules

  • No content rewriting — this is format conversion only. Do not improve prose, fix grammar, or reorganise sections.
  • Preserve all content — every paragraph, figure reference, and citation in the draft must appear in the .tex output.
  • Strip heading numbering — if the draft has numbered headings like 1.2 Methods, let LaTeX handle the numbering (just use \subsection{Methods}).
  • Use latex for compilation — never bare pdflatex or latexmk without out/ directory.
  • Bold caption lines like **Table 1. Description** immediately before a pipe table should become \caption{Description} inside a table float.

Cross-References

SkillWhen to use alongside
latexCompile the scaffolded .tex file
latexFor manual compilation config and .latexmkrc setup
bib-validateAfter scaffolding to verify all citation keys resolve
proofreadAfter scaffolding for grammar and consistency check
latex-templateAfter scaffolding to verify preamble aligns with the working paper template

Citation Contract

<!-- paperpile-citation-contract -->
  1. Paperpile is the only source of truth for committed citation keys and BibTeX metadata.
  2. Before writing \cite{key}, verify with paperpile get-item key and paperpile export-bib key.
  3. Resolve unknowns in order: DOI lookup → Paperpile substring search → refpile semantic search → Paperpile verify.
  4. A DOI miss is not non-membership; continue with title/author search and refpile.
  5. If unresolved, write \CiteTodo{slug}{title/author/year/DOI hint} — never a guessed key.
  6. Drafting sub-agents must not write/edit the active .bib; only the orchestrator regenerates it from Paperpile exports.
  7. Stage genuine new refs under .paperpile-import/ for manual Paperpile import; don't cite until Paperpile mints the key.
  8. Run scripts/bib/citation_lint.py before commit; zero placeholders, zero non-Paperpile keys, zero hand-authored metadata.

See rules/paperpile-citations.md for the full workflow.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.