brycewang-stanford/Auto-Empirical-Research-Skills / skills/22-christopherkenny-skills/skills/latex-to-quarto
latex-to-quarto
VerifiedConverts 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.9 KB |
| references/01-preamble-yaml.md | markdown | 6.0 KB |
| references/02-document-structure.md | markdown | 4.3 KB |
| references/03-text-formatting.md | markdown | 3.7 KB |
| references/04-math.md | markdown | 4.0 KB |
| references/05-citations.md | markdown | 3.4 KB |
| references/06-cross-references.md | markdown | 3.4 KB |
| references/07-figures.md | markdown | 3.8 KB |
| references/08-tables.md | markdown | 3.9 KB |
| references/09-sections-lists.md | markdown | 3.6 KB |
| references/10-misc.md | markdown | 5.2 KB |
references/07-figures.md
View on GitHub# Figures
---
## `\includegraphics` (Standalone, No `figure` Environment)
| LaTeX | Quarto |
|-------|--------|
| `\includegraphics{figs/plot.pdf}` | `` |
| `\includegraphics[width=0.8\textwidth]{figs/plot.pdf}` | `{width=80%}` |
| `\includegraphics[width=5cm]{figs/plot.pdf}` | `{width=5cm}` |
| `\includegraphics[height=3in]{figs/plot.pdf}` | `{height=3in}` |
| `\includegraphics[scale=0.5]{figs/plot.pdf}` | `{width=50%}` |
| `\includegraphics[width=\textwidth]{figs/plot.pdf}` | `{width=100%}` |
| `\includegraphics[width=0.5\textwidth]{figs/plot.pdf}` | `{width=50%}` |
---
## Full `figure` Environment
```latex
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{figs/map.pdf}
\caption{A map of the study region.}
\label{fig:map}
\end{figure}
```
Becomes:
```markdown
{#fig-map width=80% fig-align="center"}
```
### Placement Rules
- `\centering` → `fig-align="center"` attribute
- `\caption{...}` → becomes the alt text / caption between ` → remove (no meaning in Quarto)
- `\begin{figure*}` (two-column spanning) → add `fig-env="figure*"` to attribute block
---
## `figure*` (Span Two Columns)
```latex
\begin{figure*}
\centering
\includegraphics[width=\textwidth]{figs/wide.pdf}
\caption{Wide figure spanning both columns.}
\label{fig:wide}
\end{figure*}
```
Becomes:
```markdown
{#fig-wide width=100% fig-align="center" fig-env="figure*"}
```
---
## Subfigures (`subfig` / `subcaption`)
Convert to a Quarto div with `layout-ncol` (or `layout-nrow`):
```latex
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{figs/a.pdf}
\caption{First panel.}
\label{fig:a}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{figs/b.pdf}
\caption{Second panel.}
\label{fig:b}
\end{subfigure}
\caption{Both panels together.}
\label{fig:both}
\end{figure}
```
Becomes:
```markdown
::: {#fig-both layout-ncol=2}
{#fig-a}
{#fig-b}
Both panels together.
:::
```
Key rules for subfigures:
- Outer `\label` → `{#fig-label}` on the div opening
- `layout-ncol=N` where N is the number of columns
- Each `\subfigure` → a separate `![]()` image with its own `{#fig-sub-label}`
- The overall caption goes as plain text **inside** the div, after the last image
- Remove `\hfill`, `\hspace`, `\quad` between subfigures
---
## `wrapfigure` (Wrapped Text)
```latex
\begin{wrapfigure}{r}{0.4\textwidth}
\includegraphics[width=0.38\textwidth]{figs/side.pdf}
\caption{Side figure.}
\label{fig:side}
\end{wrapfigure}
```
Becomes (flag for review — text wrapping is HTML-only):
```markdown
{#fig-side width=38% fig-align="right"}
```
Note in report: text wrapping around figures is not supported in Word output.
Use a standard figure or a column layout instead for multi-format compatibility.
---
## Figures with No Caption or Label
```latex
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{figs/diagram.png}
\end{figure}
```
Becomes:
```markdown
{width=60% fig-align="center"}
```
An empty alt text (`![]`) is valid Quarto — the figure will appear without a caption
and without a figure number.
---
## File Extension Notes
- `.pdf` figures render in PDF output and are fine to keep
- `.eps` figures may not render in HTML; flag and suggest converting to `.pdf` or `.png`
- `.png`, `.jpg`, `.svg` render in all formats
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |