1  Template Chapter

Dos and Don’ts of typesetting in Quarto

Published

May 23, 2025

Abstract

Here’s where you’d put some text for an abstract, if you want it. It’ll be in smaller font size than the rest of the article, though.

Keywords

mass spectrometry, instrumentation, isotope geochemistry, geochronology

Warning

🚧 This Mass Spec Academy content is under construction. 🚧

1.1 Basics

Write using Markdown syntax, and find a quick tutorial here: My link text.

Check out template_chapter.qmd on VS Code to see how this is all typeset.

To be consistent across the project, let’s typeset the mass number of an isotope with a LaTeX superscript, like \(^{12}\)C. The element symbol’s letters go outside the dollar signs. Likewise for a chemical formula, like CO\(_2\). Numbers and uncertainties are in unicode, like 10 ± 2 Ma, rather than LaTeX like \(10 \pm 2\) Ma.

1.2 This is a top-level section, like Headings and Labels

After the title of the section, you can optionally add a label in curly braces {} so that you can refer to it later. The #sec- at the start of the section label is mandatory for Quarto. Quarto will yell at you if you have accidentally duplicated a label name from another chapter so that you can change yours.

To refer to this section anywhere in the book, just write @sec-template-headings.

With a labelled section like this one, you can link back to Section 1.2. If you want to just refer to the section number (without the word “Section”), then use [-@sec-template-headings]. Please use hyphens instead of underscores in your label names to keep LaTeX happy.

Relevant headers and references docs

1.2.1 This is a subsection, like Ion Counter Types

This is a subsubsection like Dynode Voltage Schemes

1.3 Figures

The Quarto syntax for a figure looks like

![Caption text here](relative_path_to_figure.png){#fig-my-label fig-alt="Alt text" width="XX%"}

Here’s an example. Use a blank line between the text and the figure syntax so that it isn’t set inline. Figures are numbered sequentially and can refer to them if you add a label, just like for sections. The label must start with #fig- and don’t use underscores please. Also, if the contents of the curly braces appear below the figures instead of styling the figure, it’s because you used commas between the options that appear inside the curly braces (don’t do that).

Extended Geometry Magnetic Sector Mass Spectrometer
Figure 1.1: An extended geometry magnetic sector mass spectrometer.

Relevant Quarto Docs for many more figure options

Another way to format a figure

1.4 Citations

Export your references from your reference manager or from the online journal article in a BibTeX format, then add the work to the references.bib file. The name of the bibliography entry is the first element after the opening curly brace. You can reference the entry in the text using an @ followed by the name of the entry. For instance, Wang et al. (2021) typesets a reference to an atomic mass table reference.

All the usual inline reference formats are included, like (Wang et al. 2021) or (e.g., Wang et al. 2021) or (Wang et al. 2021; Yergey and Yergey 1997).

Your cited reference will automatically be added to the References section.

Relevant citations docs

1.5 Equations

You can typeset inline equations like \(F = ma\) and display-style equations like:

\[ \sigma^2_z = \sigma^2_x \left( \dfrac{\partial z}{\partial x} \right)^{\hspace{-4pt}2} + 2\sigma^2_{xy}\left( \dfrac{\partial z}{\partial x} \right) \!\! \left( \dfrac{\partial z}{\partial y} \right) + \sigma^2_y \left( \dfrac{\partial z}{\partial y} \right)^{\hspace{-4pt}2} \tag{1.1}\]

Typeset equations like Equation 1.1 using LaTeX syntax. VS Code with the Quarto extension gives you a nice interactive preview of the display-style equation on the left-hand panel if you hit the “Preview” button above the first double dollar sign. A display equation will be numbered if you include a label after the final double dollar sign, like {#eq-unct-propagation-xyz} above.

For more complicated equation environments, you’re best off with a trial and error approach, but Quarto seems to include many of the usual (e.g., amsmath) packages by default.

Relevant equations docs

1.6 Callout Blocks

Note

We could use callout blocks in the html version of our book. This might be helpful for text asides in a less formal tone.

Perhaps we could use collapse callouts for the end-of-chapter questions and answers?

Relevant callouts docs

1.7 Code

Check out background.qmd for a short Python code that creates a figure output. The code that created that figure is automatically included on the website as a collapsible code block above the figure. You can edit and execute the Python inside VS Code and then preview in Quarto to see the results.

If you wish to add an executable code block, then make sure to un-comment the jupyter: python3 line from the header at the top of the document by removing the # in front of it.

Relevant code block docs