Presets

Presets are reusable building blocks provided by Texpile. Instead of writing everything from scratch, you can use presets to quickly add common fields, packages, and transpilation rules to your template.

Presets use the @texpile/... syntax and can be used in three places: exports, document sections (preamble, frontmatter, backmatter), and rules.

How Presets Work

To use a preset, add its @texpile/... identifier to the relevant section of your template:

@texpile/exports/title/v1

You can mix presets with your own custom definitions. Order matters: later items override earlier ones, so you can start with a preset and then override specific parts.

Export Presets

Export presets add common fields to your template’s Settings menu without having to define them manually.

PresetFieldTypePlaceholder
@texpile/exports/title/v1Titlerich_text#title#
@texpile/exports/author/v1Authorrich_text#author#
@texpile/exports/date/v1Datedate#date#
@texpile/exports/abstract/v1Abstracttemplate_block#abstract#
@texpile/exports/citation-style/v1Citation Styleselect#citation_style#

The citation-style preset provides a dropdown with 8 built-in options: IEEE, APA 7th, MLA 9th, Chicago (Author-Date), Vancouver, Nature, Author-Year (Harvard), and Numeric.

You can mix presets with custom fields. A typical exports list might look like:

@texpile/exports/title/v1       (preset)
@texpile/exports/author/v1      (preset)
@texpile/exports/date/v1        (preset)
Student ID: studentnumber       (custom string field)
Course: course                  (custom string field)

Package Presets

Package presets add common LaTeX package configurations to your preamble.

PresetWhat it adds
@texpile/packages/fonts-xelatex/v1Font configuration for XeLaTeX (fontspec, babel, csquotes)
@texpile/packages/hyperref/v1PDF hyperlinks and metadata (\usepackage[hidelinks]{hyperref})
@texpile/packages/lang-zh-hans/v1Simplified Chinese language support (xeCJK with Noto Sans CJK SC)
@texpile/packages/lang-zh-hant/v1Traditional Chinese language support (xeCJK with Noto Sans CJK TC)

Geometry Presets

PresetWhat it adds
@texpile/geometry/standard-1in/v1Standard 1-inch margins on all sides (US letter)

Formatting Presets

PresetWhat it adds
@texpile/formatting/manual-indent/v1Disables automatic paragraph indentation (parskip package) while preserving manual indent

Citation Presets

Citation presets set up bibliography packages in your preamble. Each one configures BibLaTeX with the appropriate citation style.

PresetStyle
@texpile/citations/biblatex/v1Basic BibLaTeX (use with citation-style export for style selection)
@texpile/citations/biblatex-ieee/v1IEEE
@texpile/citations/biblatex-apa/v1APA 7th Edition
@texpile/citations/biblatex-mla/v1MLA 9th Edition
@texpile/citations/biblatex-chicago/v1Chicago (Author-Date)
@texpile/citations/biblatex-nature/v1Nature
@texpile/citations/biblatex-vancouver/v1Vancouver (Medical/Life Sciences)

Citation presets provide both preamble setup (the \usepackage[style=...]{biblatex} line) and backmatter setup (\printbibliography). When you place a citation preset in your preamble, Texpile auto-infers the preamble portion. When placed in backmatter, it uses the backmatter portion.

Table Presets

Table presets override the default table formatting rules. Use these in your rules section.

PresetStyle
@texpile/tables/academic/v1Professional academic formatting with booktabs (toprule/midrule/bottomrule)
@texpile/tables/professional-booktabs/v1Professional booktabs style for academic papers and lab reports
@texpile/tables/apa-style/v1APA 7th edition table format with booktabs
@texpile/tables/mla-style/v1MLA format with double horizontal lines and full-width columns
@texpile/tables/basic-bordered/v1Simple table with borders on all sides (grid style)

Rules Presets

Rules presets provide base transpilation rules that define how editor content is converted to LaTeX. See Transpilation Rules for full details.

PresetWhat it provides
@texpile/base/v1Default rules for all elements (headings, paragraphs, images, tables, marks, etc.) and core packages
@texpile/beamer/v1Beamer-specific rules for presentation slides (frame blocks, modified image/table rules)

The @texpile/base/v1 preset is used by almost every template. It provides sensible defaults for all document elements and includes essential packages (amsmath, graphicx, xcolor, hyperref, etc.).

Rules cascade, so you typically start with @texpile/base/v1 and then add overrides:

@texpile/base/v1                     (preset: all default rules)
@texpile/tables/academic/v1          (preset: booktabs-style tables)
heading/1: \section*{#text#}         (inline override: unnumbered sections)

How Cascading Works

When you list multiple presets and overrides, Texpile resolves them from top to bottom. Later items override earlier ones. However, each section of the template handles this differently:

Rules: Deep Merge

Rules use a deep merge. You can override a specific part of a rule without replacing the whole thing.

For example, if @texpile/base/v1 defines headings like this:

heading:
  1: \section{#text#}
  2: \subsection{#text#}
  3: \subsubsection{#text#}

And you add an inline override that only changes level 1:

heading:
  1: \section*{#text#}

The result is:

heading:
  1: \section*{#text#}       ← overridden
  2: \subsection{#text#}     ← kept from base
  3: \subsubsection{#text#}  ← kept from base

Only heading.1 was replaced. Levels 2 and 3 are untouched because the merge is recursive. This works the same way for nested rules like table.tableBorders, image, citation, etc.

Full Rules Example

Here is how three items in a rules list get merged step by step:

Step 1: @texpile/base/v1 (provides all defaults)

heading.1    = \section{#text#}
heading.2    = \subsection{#text#}
blockquote   = \begin{quote} #content# \end{quote}
paragraph    = #text#
table, image, marks, etc.

Step 2: @texpile/tables/academic/v1 (overrides just table rules)

table borders → booktabs style (toprule/midrule/bottomrule)
Everything else from step 1 is kept.

Step 3: Inline override (overrides heading.1 and blockquote)

heading.1    = \section*{#text#}
blockquote   = \begin{displayquote} #content# \end{displayquote}
Everything else from steps 1-2 is kept.

The final result contains all defaults from the base preset, with table rules from the academic preset, and heading.1 + blockquote from the inline override.

Exports: ID-Based Override

Exports use ID-based deduplication. If two exports have the same ID, the later one completely replaces the earlier one (no deep merge). This means you can override a preset’s default field by defining a custom field with the same ID after it.

For example:

@texpile/exports/title/v1       → adds a title field (rich_text, default "Untitled Document")
Custom title field (same ID)    → replaces the entire preset field

The second definition wins because it has the same ID. The preset’s field is completely replaced with your custom one.

Document Sections: No Merge

Preamble, frontmatter, and backmatter do not merge. Presets are expanded inline (their content is inserted at the position where the preset appears), and identical strings are deduplicated.

For example, if two presets both include \usepackage{graphicx}, only the first occurrence is kept. This only works for exact string matches, so \usepackage{graphicx} and \usepackage[draft]{graphicx} are treated as different and both kept.

What Does Not Cascade

Metadata fields like id, name, description, and version do not cascade from presets. This prevents preset names from leaking into your template.