Latex scaffold

From flonat/flonat-research · View interactive version

Latex scaffold is an AI agent skill from the GitHub repository flonat/flonat-research. 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.

How to use this skill

Skill file

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

Inputs

Outputs


Workflow

Step 1: Analyse the Draft

Read the Markdown file and inventory:

Step 2: Create the LaTeX File

Apply these conversion rules:

| Markdown | LaTeX |

|----------|-------|

| # 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:

These indicate incomplete conversion — fix them.

Step 4: Wire Bibliography

Step 5: Compile and Verify

Run latex to compile. Verify:


Rules


Cross-References

| Skill | When to use alongside |

|-------|----------------------|

| latex | Compile the scaffolded .tex file |

| latex | For manual compilation config and .latexmkrc setup |

| bib-validate | After scaffolding to verify all citation keys resolve |

| proofread | After scaffolding for grammar and consistency check |

| latex-template | After 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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.