FormaTeX

\begin{article}

draft — not published

Scaffold Any LaTeX Document — latex-structure Skill

Generate a complete compilable LaTeX starter for any doc type — thesis, conference paper, CV, Beamer presentation — with the right class and packages.

Scaffold Any LaTeX Document — latex-structure Skill

You open your editor, create a new file, and stare at a blank main.tex. You know you need a thesis — or maybe an IEEE conference paper — but you are not sure whether to use article or report, you have forgotten whether IEEEtran needs \IEEEoverridecommandlockouts, and you cannot remember the correct load order for hyperref. Twenty minutes later you have copy-pasted fragments from three Stack Overflow answers and you are not confident any of it compiles cleanly.

The latex-structure skill for Claude Code solves exactly this. It reads your intent, picks the right document class, wires up a coherent package baseline, and hands you a file that compiles on the first try.


What Is latex-structure?

latex-structure is a Claude Code skill — a prompt-driven automation that scaffolds complete, compilable LaTeX documents. You describe what you need ("IEEE double-column conference paper", "PhD thesis in French", "Beamer presentation for a 20-minute talk") and the skill:

  1. Identifies the document type from your description.
  2. Selects the appropriate document class (article, IEEEtran, acmart, report, book, moderncv, beamer, or scrlttr2).
  3. Outputs a starter document with the correct class options, an essential package baseline, and a logical section skeleton.

The output is not a snippet — it is a file you can drop into your project and compile immediately with pdflatex, xelatex, or lualatex. If you are using FormatEx to compile remotely, you can pipe the file straight to the API without touching a local TeX installation. See the getting started with FormatEx guide for the full workflow.


How to Install

The skill lives in the formatex/latex-skills repository on GitHub. Installation is a single copy command per skill file.

bash
# Clone the repo once
git clone https://github.com/formatex/latex-skills.git

# Copy the skill into your Claude Code skills directory
cp latex-skills/latex-structure.md ~/.claude/skills/latex-structure.md

After copying, the skill is available in any Claude Code session as /latex-structure. No restart required.


Document Classes

The skill covers every common LaTeX document class. Use the table below to understand which class applies to your situation.

ClassUse caseKey options the skill sets
articleJournal articles, short reports, homework11pt, a4paper
IEEEtranIEEE conference and journal papersconference or journal mode
acmartACM conference and journal paperssigconf, acmsmall, etc.
reportTechnical reports, dissertations (no publisher)12pt, chapter-level structure
bookBooks, long-form documentsopenright, front/main/backmatter
moderncvCVs and resumesclassic or banking style
beamerSlide presentationsTheme, color theme, aspect ratio
scrlttr2Formal letters (KOMA-Script)DIN or letter format

If your institution mandates a custom .cls file — common for PhD theses at European universities — the skill outputs a scaffold that uses \documentclass{your-class} as a placeholder, with comments explaining where to drop the .cls file. More on that in the thesis section below.


Essential Package Baseline

One of the most common sources of LaTeX frustration is package load order. The skill enforces a consistent, safe baseline and adjusts it depending on your chosen compiler.

pdflatex

For pdflatex, the skill loads:

latex
\usepackage[utf8]{inputenc}   % UTF-8 source encoding
\usepackage[T1]{fontenc}      % 8-bit output font encoding
\usepackage{microtype}        % Microtypographic extensions
% ... content packages ...
\usepackage{hyperref}         % MUST be last (or near-last)

inputenc and fontenc are pdflatex-specific. Omitting fontenc is a subtle bug that breaks hyphenation for accented characters — the skill never omits it.

XeLaTeX and LuaLaTeX

For xelatex and lualatex, inputenc and fontenc are replaced by fontspec, which handles Unicode natively:

latex
\usepackage{fontspec}         % Unicode font loading (xe/lualatex only)
\usepackage{microtype}
% ... content packages ...
\usepackage{hyperref}

The hyperref Rule

hyperref must load last (or very close to last) because it redefines internal LaTeX commands. Loading it early is a common source of mysterious compile errors. The skill always places hyperref at the end of the preamble, with a comment explaining why. If you later add packages manually, keep them before hyperref. The latex-packages skill can help you identify safe load positions for additional packages.

microtype is included unconditionally — it improves text rendering with no configuration required and has no known conflicts with any of the supported classes.


Practical Examples

Conference Paper (IEEE)

Prompt: "IEEE conference paper, two columns, pdflatex"

The skill produces:

latex
\documentclass[conference]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{cite}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage[colorlinks=false]{hyperref}

\begin{document}

\title{Your Paper Title}
\author{\IEEEauthorblockN{Author Name}
\IEEEauthorblockA{Institution \\ email@example.com}}
\maketitle

\begin{abstract}
Your abstract here.
\end{abstract}

\section{Introduction}
\section{Related Work}
\section{Methodology}
\section{Results}
\section{Conclusion}

\bibliographystyle{IEEEtran}
\bibliography{references}

\end{document}

This compiles without modification. The cite package is included because IEEEtran relies on it for citation compression. hyperref is set to colorlinks=false — the IEEE style guide disallows colored links in submitted PDFs.

PhD Thesis

Prompt: "PhD thesis, English, pdflatex, university of Edinburgh"

latex
\documentclass[12pt, a4paper, twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage[hidelinks]{hyperref}

\begin{document}

\frontmatter
\include{title}
\include{abstract}
\include{acknowledgements}
\tableofcontents
\listoffigures
\listoftables

\mainmatter
\include{chapters/introduction}
\include{chapters/background}
\include{chapters/methodology}
\include{chapters/results}
\include{chapters/discussion}
\include{chapters/conclusion}

\backmatter
\bibliographystyle{plainnat}
\bibliography{references}
\appendix
\include{appendices/appendix-a}

\end{document}

Note \frontmatter, \mainmatter, and \backmatter — these are report/book class commands that control page numbering (Roman numerals in front matter, Arabic in main matter) and chapter handling. They are explained in detail in the thesis section below.


Thesis-Specific Notes

Thesis scaffolding is the most complex use case because requirements vary by institution and country.

Institution .cls files. Many universities distribute a custom document class (e.g., edinburgh-thesis.cls, ub-thesis.cls). The skill generates a scaffold using the standard report class by default, but adds a prominently commented block at the top:

latex
% If your institution provides a .cls file, replace \documentclass{report}
% with \documentclass{your-institution-class} and drop the .cls file
% in the same directory as this .tex file.

frontmatter / mainmatter / backmatter. The \frontmatter command switches page numbering to lowercase Roman numerals (i, ii, iii...) and suppresses chapter numbers in the TOC for pages like the abstract and acknowledgements. \mainmatter resets to Arabic page 1 and restores chapter numbers. \backmatter handles the bibliography and appendices. These three macros are available in report and book classes — not in article.

Table of contents. The skill includes \tableofcontents in the front matter automatically. For theses requiring a list of figures and list of tables, \listoffigures and \listoftables are included as commented lines — uncomment them if your institution requires them.

Babel and multilingual theses. For non-English theses, the skill loads babel with the correct language option for pdflatex, or polyglossia for xelatex/lualatex. A French thesis prompt, for example, produces \usepackage[french]{babel} and sets \frenchsetup{StandardLists=true} to avoid list formatting issues.

For a deeper look at citation scaffolding in thesis documents, see the latex-citations skill.


Beamer Presentations

For beamer documents the skill picks a clean default theme and exposes the three main customization axes as comments:

latex
\documentclass[aspectratio=169]{beamer}
\usetheme{Madrid}        % Change theme: Bergen, Boadilla, CambridgeUS, etc.
\usecolortheme{default}  % Change color: albatross, beaver, crane, etc.
\usefonttheme{serif}     % Optional: professorial look

\usepackage{microtype}
\usepackage{graphicx}

\title{Presentation Title}
\subtitle{Optional Subtitle}
\author{Author Name}
\institute{Institution}
\date{\today}

\begin{document}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents
\end{frame}
\section{Introduction}
\begin{frame}{Introduction}
  % Content here
\end{frame}
\end{document}

aspectratio=169 sets 16:9 widescreen format, which is the default for modern projectors. Change to 43 for 4:3 if your venue requires it. hyperref is not explicitly loaded in Beamer documents — Beamer loads it internally, and a double-load causes errors.


latex-structure handles the scaffold. Other skills in the formatex/latex-skills collection handle what comes next:

For context on choosing the right compilation engine for your document, the LaTeX engine guide covers pdflatex vs xelatex vs lualatex trade-offs in detail. If you are integrating LaTeX compilation into a development workflow, LaTeX for developers covers the FormatEx API patterns.


Start With a Solid Foundation

Blank .tex files are a tax on your time. The latex-structure skill eliminates the setup phase so you can start writing immediately — with the right class, the right packages, and a structure that matches your document type.

Install the skill, describe your document, and compile the result through the FormatEx API without touching a local TeX installation. The first scaffold takes about three seconds. The rest is writing.

\end{article}

Back to blog

\related{posts}

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy