skills/22-christopherkenny-skills/skills/latex-to-quarto/SKILL.md
Converts LaTeX article-class .tex documents to Quarto .qmd format for multi-format publishing (HTML, PDF, Word). Use when asked to convert, port, migrate, or translate a .tex LaTeX file to Quarto; when porting an academic paper or manuscript from LaTeX to Quarto; when a .tex document needs to render to HTML, Word, or Typst PDF. Covers preamble → YAML front matter, section headings, text formatting, math, citations (natbib/biblatex), cross-references, figures, tables, lists, footnotes, hyperlinks, and special characters.
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research latex-to-quartoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Convert a full LaTeX .tex article to a Quarto .qmd document that renders correctly
to HTML, PDF (Typst or LaTeX), and Word.
This skill handles the entire conversion pipeline: preamble extraction, document structure,
and all inline/block transformations.
This skill writes the output file (overwriting the input or writing to a second path).
Before writing, tell the user what file will be changed and remind them that git diff or
file history can recover the original.
| Position | Required | Description |
|----------|----------|-------------|
| 1 | Yes | Path to the input .tex file (e.g., paper/paper.tex) |
| 2 | No | Output .qmd path. Defaults to same directory, .qmd extension. |
Example invocations:
/latex-to-quarto paper/paper.tex
/latex-to-quarto paper/paper.tex paper/paper.qmd
| Task | Reference File |
|------|----------------|
| \documentclass, \usepackage, \title, \author → YAML | 01-preamble-yaml.md |
| \begin{document}, \maketitle, \begin{abstract}, \appendix | 02-document-structure.md |
| \textbf, \emph, \texttt, \footnote, \href | 03-text-formatting.md |
| equation, align, gather, inline math delimiters | 04-math.md |
| \cite, \citep, \citet, natbib/biblatex commands | 05-citations.md |
| \label, \ref, \autoref, \eqref, prefix mapping | 06-cross-references.md |
| \includegraphics, figure environment, subfigures | 07-figures.md |
| tabular, table, booktabs, \multicolumn | 08-tables.md |
| \section, \subsection, itemize, enumerate | 09-sections-lists.md |
| Special characters, \newpage, verbatim, \input | 10-misc.md |
Identify the input .tex path (arg 1) and output path (arg 2).
If arg 2 is omitted, replace the .tex extension with .qmd in the same directory.
Use the Read tool to load the full .tex file.
Hold the entire content in memory — you will produce one complete .qmd file at the end.
Everything before \begin{document} is the preamble. Extract:
\documentclass options → YAML format: settings\title{}, \author{}, \date{} → YAML title:, author:, date:\bibliography{file} / \addbibresource{file} → YAML bibliography:geometry, setspace, natbib, biblatex) → YAML format optionsSee 01-preamble-yaml.md for the full mapping table.
Remove \begin{document} and \end{document}.
Remove \maketitle (title is rendered from YAML automatically).
Convert \begin{abstract}...\end{abstract} to YAML abstract:.
See 02-document-structure.md.
Work through the full document body and apply every applicable rule. Key principles:
$...$ or $$...$$ except to
move \label{} outside display math and convert delimiters (\(...\) → $...$).\textbf{\emph{text}} → ***text***. Process inner commands first.Apply reference files in this order (structural → inline):
Combine:
--- delimiters)---)Use the Write tool to write the complete .qmd file in one pass.
Do not use Edit for individual substitutions — a single full write ensures nothing is missed.
Tell the user:
quarto render to verify the outputLaTeX uses a \documentclass preamble; Quarto uses YAML front matter between ---.
% LaTeX preamble
\documentclass[12pt,a4paper]{article}
\usepackage[margin=1in]{geometry}
\title{My Paper}
\author{Jane Doe}
\date{\today}
\bibliography{refs}
# Quarto YAML front matter
---
title: "My Paper"
author: "Jane Doe"
date: today
bibliography: refs.bib
format:
html: default
pdf:
documentclass: article
papersize: a4
fontsize: 12pt
geometry: margin=1in
---
Unlike conversion to Typst, Quarto uses LaTeX math directly.
Inline \(...\) → $...$; display \[...\] → $$...$$.
Math content (operators, symbols, matrices) stays unchanged.
\citep{key} → [@key]; \citet{key} → @key.
The .bib file is referenced in YAML and left unchanged.
@label Not \ref{}\ref{fig:map} → @fig-map. Labels move from standalone \label{} commands
into element attribute blocks {#fig-map}.
Input (paper.tex):
\documentclass[12pt]{article}
\usepackage{natbib}
\title{My Study}
\author{Jane Doe}
\date{2025}
\begin{document}
\maketitle
\begin{abstract}
We examine the effect of X on Y.
\end{abstract}
\section{Introduction}
Prior work \citep{smith2020} shows that $x > 0$.
See Figure~\ref{fig:map} for an overview.
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{figs/map.pdf}
\caption{Study region.}
\label{fig:map}
\end{figure}
\bibliography{refs}
\end{document}
Output (paper.qmd):
---
title: "My Study"
author: "Jane Doe"
date: 2025
bibliography: refs.bib
---
## Abstract
We examine the effect of X on Y.
# Introduction
Prior work [@smith2020] shows that $x > 0$.
See @fig-map for an overview.
{#fig-map width=80% fig-align="center"}
Flag these in your report with a suggested fix but no automatic conversion:
| Pattern | Suggested Quarto Equivalent |
|---------|------------------------------|
| \begin{theorem}, \begin{proof}, \begin{lemma} | ::: {.callout-note} div, or install a theorem extension |
| \newcommand{}{} / \renewcommand{}{} | Inline the macro expansion throughout; flag remaining uses |
| \input{file} / \include{file} | Inline contents or use {{< include file.qmd >}} shortcode |
| \vspace{} / \hspace{} | Remove or replace with CSS; no direct Quarto equivalent |
| \multicolumn{}{}{} in tables | Requires manual table restructuring |
| TikZ / PGF diagrams | Remove or replace with Mermaid/Observable JS |
| Beamer \begin{frame} | Switch to format: revealjs with ## slide headings |
| \bibliographystyle{} | Remove; use csl: in YAML if a specific citation style is needed |
| Multiple \label in one align block | Each labeled row may need its own equation block |
$...$ and $$...$$\includegraphics and \bibliography (adjust extension if needed)@ref and [@citation] patterns already in correct Quarto form\begin{verbatim}...\end{verbatim} (convert to fenced block, keep content)tools
Recommend AND run open-source AI tools, agents, Claude Code / Codex skills, and MCP servers for any stage of a literature review — searching, reading, extracting, synthesizing, screening, citation-checking, and paper writing. Use when the user asks "what tool should I use to..." OR "install/run/use <tool> to ..." for research/lit-review work: automating a survey or related-work section, PDF→Markdown extraction for LLMs (MinerU/marker/docling), PRISMA / systematic review (ASReview), citation-backed Q&A over PDFs (PaperQA2), wiring papers into Claude/Cursor via MCP (arxiv/paper-search/zotero servers), or chatting with a Zotero library. Ships a launcher (scripts/litrun.py) that installs each tool in an isolated venv and runs it. Curated catalog of 70+ vetted projects. 支持中英文(用于「文献综述工具选型」与「一键安装/运行」)。
development
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
documentation
Use when the project collects primary data or runs a field, lab, or survey experiment, before the intervention begins — write the pre-analysis plan, size the sample from a power calculation, and register with the AEA RCT Registry. Apply after the design is chosen in aer-identification and before any outcome data are seen.
tools
Guide economists to authoritative data sources with explicit, confirmed data specifications before retrieval; interfaces with Playwright MCP to navigate portals and extract real data, not articles about data.