Export Types
Exports define the fields that appear in a document’s Settings menu. When a user creates a document from your template, they fill in these fields, and the values replace the corresponding #variable# placeholders in your preamble, frontmatter, and backmatter.
You can also use export presets (e.g., @texpile/base/title, @texpile/base/author) to add common fields without defining them manually. See Presets for more on how presets work.
Common Properties
All field types share these base properties:
- ID: the variable name, used as the placeholder (e.g.,
authorbecomes#author#). Must be unique across all exports. - Name: the label shown to users in the Settings menu.
- Default: the fallback value if the user does not provide one.
- Required: if enabled and the user leaves the field empty, the default value is used instead.
Field Types
String
A simple text input. This is the most common type.
Example: a Student ID field
- ID:
studentnumber - Name: “Student ID/Number”
- Default:
000000 - Required: false
Usage in your template:
Student No: #studentnumber# Another example: a required Course field
- ID:
course - Name: “Course”
- Default:
PHYS 211 - Required: true
Rich Text
Similar to a string field, but the input supports rich text formatting (bold, italic, etc.). The value is output as formatted LaTeX.
Example: an Instructor Name field
- ID:
instructor - Name: “Instructor Name”
- Type:
rich_text - Default:
Dr. Smith - richFormat: true
Usage in your template:
Instructor: #instructor# If the user types “Dr. Jane Smith”, the output will include the appropriate LaTeX formatting (e.g., Dr. \textbf{Jane} Smith).
Select
A dropdown menu that lets the user pick from predefined options. Each option has three properties:
- value: the internal identifier
- label: what the user sees in the dropdown
- output: the LaTeX code that replaces the placeholder
Example: a Lab Section selector
- ID:
lab_section - Name: “Lab Section”
- Default:
A
Options:
| Value | Label | Output |
|---|---|---|
A | Section A (Monday) | Section A |
B | Section B (Wednesday) | Section B |
C | Section C (Friday) | Section C |
Usage in your template:
Lab Section: #lab_section# The user sees the friendly labels in the dropdown, but the output value is what actually replaces the placeholder. This means you can have the output be arbitrary LaTeX code that differs from what the user sees.
List
A repeatable group of fields. Users can add or remove entries in the Settings menu. This is useful when you need multiple items with the same structure, like a list of authors.
Each list export has:
- fields: the sub-fields for each entry (each with their own ID, type, name, and required flag)
- item: a LaTeX template that defines the output for a single entry. Use
#fieldid#to reference each sub-field. - separator: LaTeX code inserted between entries
- default: the initial entries when a user creates a new document
Example: a simple authors list
Fields: name (required), affiliation, email
When the user adds two authors, the output might look like:
% Author 1 (generated from item template)
\authorblockN{Alice Smith}
\authorblockA{MIT \\ [email protected]}
% separator
\and
% Author 2 (generated from item template)
\authorblockN{Bob Jones}
\authorblockA{Stanford \\ [email protected]} The item template also supports conditional syntax for optional fields. For example, #affiliation:?Affiliation: #affiliation## means “if affiliation is provided, output Affiliation: followed by the value, otherwise output nothing”. This prevents empty lines when a user leaves a field blank.
Tip: The conditional syntax can get complex. If you’re unsure, start with a simple item template and test with the Compile button.
Template Block
A rich-text content area that appears directly in the editor as a special block. Unlike other field types that are edited in Settings, template blocks are edited inline in the document, like the Abstract block in many templates.
Properties specific to template block:
- placeholder: hint text shown when the block is empty (e.g., “Write your abstract here.“)
- wrap: the LaTeX wrapper around the block content. Use
#content#as the placeholder for the user’s text. - insertInto: which variable in your document structure this block’s content gets inserted into (e.g.,
#abstract#) - allowMultiple: whether users can insert more than one of this block type (default: true)
- allowNestSelf: whether this block type can be nested inside another of the same type (default: true)
- style: visual styling of the block in the editor (e.g.,
style-1)
Example: an Abstract block
- ID:
abstract - Name: “Abstract”
- placeholder: “Write your abstract here (150-250 words).”
- wrap:
#content# - insertInto:
#abstract# - allowMultiple: false
- style:
style-1
Usage in your frontmatter:
\begin{abstract}
#abstract#
\end{abstract} The content the user types in the Abstract block replaces #abstract# in the final document.