Quick & Dirty Guide to Typesetting a TTRPG in LaTeX
I’ve been using LaTeX over the past several months to work on my D&D hack Archons & Armigers, write dungeon keys for my ongoing Worlds Without Number campaign, and generally maintain a set of pdf files for all my GM notes, setting gazetteers, etc. It’s great, but it’s a pain in the ass to learn.
This guide is not meant to be a comprehensive breakdown of everything LaTeX can do. For that, see this e-book, the overleaf documentation, and these superb guides by Vladar, author of Into The Dungeon: Revived.
LaTeX is old software, and for everything you could want to do, there are like five different methods. This guide is just me compiling my favorites, with a focus on just laying out in one place what one could use to typeset a half-decent adventure, hack, or supplement.
Basics
Why LaTeX?
The big question; for many using a layout editor like Scribus, InDesign, or Affinity probably makes more sense. Hell, it might make more sense for me. But:
LaTeX is totally free.
With LaTeX you can write first and then make universal formatting changes later with minimal effort. Thus it’s good for less ‘disciplined’ projects where you’re not trying to sell a polished product but just making pdfs of whatever you’ve dreamed up.
You can easily standardize many different documents. If, say, you want to publish a series of dungeon zines and you want them to look like part of the same series, a LaTeX .sty file makes this easy to do.
No fiddly dragging of text-boxes.
It feels really cool to write code instead of using a GUI.
How Do I Start Using LaTeX?
I’d start with Overleaf, a fully online editor with many nice QoL features. If you start getting deep into a big project, installing it locally is easy enough. I use TexLive + VSCode.
How Do I Git Gud?
Google problems and click on the stack exchange results. Read package manuals. Experiment.
Specific Code Suggestions
Again, these are just what I came up with to meet my formatting needs.
Project Setup
Easiest to ignore the Overleaf templates and just make a blank document. For a typical TTRPG project, one will want to mess with default LaTeX formatting quite a bit and write a custom package. So to start, I recommend creating:
A main .tex file. This is where you will actually write whatever you want to typeset.
A .sty file. This will store all the customization you do, which would normally go in the document’s ‘preamble’. Pretty much all of the suggested code below will go here.
A folder for illustrations. It’s best to keep these in a subfolder to avoid cluttering up your workspace.
Document Setup
Choosing a Document Class
As far as I understand, LaTeX is actually a ‘primitive’ typesetting software package called TeX plus a set of ‘higher-level’ default instructions that save you, the user, from having to manually define things like page numbering, making a table of contents, etc. It comes, by default, with several ‘document classes’ (such as book, article, letter, and report) that provide some broad instructions about how to setup a page, what levels of organization are allowed, and so on. Most of these are very plain, intended for professional-looking academic publications. Whatever we go with, we’ll want to extend it extensively.
My recommendation is to use the ‘book’ class because it comes with support for parts, chapters, sections, subsections, and sub-subsections. There’s also a ‘memoir’ class with more options, but to be honest using book + packages seem easier. To set up a book, add the following to the blank .tex file:
\documentclass[10pt,letterpaper,twoside,onecolumn,openany]{book}
\begin{document}
% content will go here
\end{document}
Most of the options should be self-explanatory. Note that this code starts off the document in one-column mode. See later for more info on columns.
Invoking Your Package
All our customization will go in the .sty file mentioned earlier. To set that up, open the file and add the following:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{testpkg}
Now, go to your main .tex document and add:
\usepackage{testpkg}
This tells LaTeX to look for your package and follow all the formatting instructions you put there.
Basic formatting
\textbf{your text here}
for bold text\textit{your text here}
for italics\\
to force a line breakPut
\
before a problematic character to tell LaTeX to treat it as text input. For example,\&
to print an ampersand.Put
%
before a line of text to comment it out and prevent it from rendering. Useful for 'soft-deleting' things you might want to add back in later.
Lists
For a bulleted list:
\begin{itemize}
\item First item text
\item Second item text
\item Blah blah blah
\end{itemize}
For a numbered list, use enumerate
instead of itemize
.
Parts, Chapters, and Sections
With the book class, your sectioning options are:
\part
— Part titles get their own page by default.\chapter
— inserts a pagebreak, and chapter titles occupy the full width of a page by default, regardless of columns\section
— defaults to creating a header in the text, no pagebreak, occupies the width of its column\subsection
— ditto\subsubsection
— ditto
To use these, add \section{Section Name}
to your document's body, followed by whatever text you want under that header.
If you’re keying a dungeon or similar, it’s worth planning out how you will map sectioning hierarchy onto location hierarchy. (I like to use chapters for floors/levels, sections for major thematic areas, subsections for rooms, and lists for room contents, with in-depth NPC/monster/puzzle descriptions meriting a subsubsection).
Useful Packages & Commands for RPGs
Simple Macros
If you know you’ll want to type something often with specific formatting, you can set up a macro to reduce the amount of typing you’ll have to do (and allow you to quickly adjust all instances of it).
For example, I was writing a Zelda-esque dungeon with color-coded keys, and I wanted the text for ‘Red Key’ to show up red every time I typed it. So with the line
\newcommand{\rk}{{\bfseries\color{red}Red Key}}
I was able to type things like ‘When the elementals are defeated, the statue’s hand opens to reveal the \rk’ to get:
Fonts
The default LaTeX font, ‘Latin Modern’ is pretty bland. There are two main ways to replace it.
First, and easiest, is to brows the LaTeX font catalogue, which comes included with all LaTeX installations (and is fully available on Overleaf). The entry for each font will provide the commands needed to implement it. For example, to use the antiquated-looking IM Fell English font used above, you would add
\usepackage{imfellEnglish}
\usepackage[T1]{fontenc}
to your preamble or .sty file.
If you want to use a font you downloaded, you can use the fontspec
package to define a new font family. For example, here is the code I used to implement the free Philosopher font from Google Fonts.
\RequirePackage{fontspec}
\newfontfamily\philosopherfont{Philosopher}[
Path=Fonts/,
Extension = .ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic]
This tells LaTeX to add a new command, \philosopherfont
, that will toggle the text that follows to use that font. In the command options, I specify the file path of the font files, tell LaTeX to look for files with a .ttf extension, and specify that the different versions of the font all have the format of Philosopher-[style].ttf.
Page Setup
The Book class comes with a few default page size options, but the geometry package allows for custom page sizes and margins. Simply add the following line to your .sty file and customize as needed:
\usepackage[paperwidth=8.5in, paperheight=11in, margin=0.5in]{geometry}
Custom Part, Chapter, and Section Headings
The default headings for parts, chapters, and sections are pretty bland and aggressively numbered - great for academic works but usually not necessary for a role-playing game. The titlesec
package allows one to redefine the code used to format each header type.
To overwrite a heading format, use the following code template:
\titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]
This can be interpreted as follows:
command: the section command you want to override (chapter, section, subsection etc.)
shape: how the paragraph formatting around the header works. The manual linked above provides details on these, but a few useful ones are
display
which puts the label in its own paragraph,runin
which puts the label in line with the paragraph text, andwrap
which wraps text around the label.format: contains commands that apply to the whole heading (e.g. specify a font)
label: this specifies the formatting of the numbering scheme that LaTeX applies to sections. Leaving it blank means that headers of this type won't be numbered. The number is represented by a placeholder called
\thechapter
,thesection
etc. For example,{Section \thechapter - \thesection}
would render as 'Section 3 - 2' for section 2 of chapter 3.sep: How far the label and title body are separated horizontally.
before-code: Formatting code before the title body. If you want a line above a header, put
\hrule
here. If you want the section name to be bold but not the number, add\bfseries
here, etc.after-code: Formatting code for after the header. Usually useful for adding spacing (
\vspace{}
,\hspace{}
) or adding a line underneath it (\hrule
).
And here are two examples I've implemented. First, chapter heading code. This places the chapter number in small font above the chapter name, and adds a horizontal line below the name:
\usepackage[explicit]{titlesec} %this invokes the titlesec package and the explicit command gives extra control over where the chapter name actually goes.
\titleformat{\chapter}[display]
{\normalfont\filcenter}
{ \textemdash \ \chaptertitlename \ \thechapter \ \textemdash }
{3pt}
{\titlerule\Large\bfseries\MakeUppercase{#1}}[\vspace{-3pt}\titlerule]
This code formats the sub-sub-section name to be in-line with the following text and applies the small-caps style to it:
\titleformat{\subsubsection}[runin]{\normalfont\bfseries }{}{0pt}{#1 \textemdash}
Tables
Tables are essential for any TTRPG worth its salt. At first glance, the table formatting for LaTeX is… clunky. But, it can be improved with the right tricks.
In general, LaTeX tables are always filled in by separating cells in a row with an ampersand (&) and adding a line break (\) after every row.
After shopping around, I strongly favor the tabularray
package, which extends the basic table syntax and makes it easy to define a default table style with alternating shading and unique formatting for the ‘header’ row.
Here’s my current default table setup:
\newcommand{\ttrpgtbl}[2]{ % this code defines a new command called \ttrpgtbl with two inputs.
\begin{center} % make sure tables are always centered
\begin{tblr}{ % invoke the tabularry package
colspec = {#1}, % the column formatting commands will be the first command input
row{odd} = {white}, row{even} = {lightgray!20}, % alternate row colors
row{1} = {font=\scshape\small}, % make the header row have small caps and use a smaller fort
row{2-Z} = {1pt,font=\small}, % normal rows have 1 pt spacing and use a smaller font
}
#2 % the second input will be the actual table contents
\end{tblr}
\end{center}}
Notice that it is set up as a command. The #1 input is for the column setup, which denotes the alignment and with of each column, and the #2 input is for the actual contents of the table. Thus in practice, this:
\ttrpgtbl{X[1,c]X[6,l]}{
d6 & Complication \\ \midrule % the midrule command creates a horizontal line after the first row
1 & Owner of only copy wants twice the base price \\
2 & Owner of only copy won't sell it \\
3 & Only copy is in Archon's private library\\
4 & Copy rumored to be in a dangerous ruin or vault \\
5 & Owner wants a favor as well as besants \\
6 & A rival mage starts a bidding war
}
results in this:
Illustrations
To insert an illustration, use the \includegraphics[size]{Path/to/image}
command, inserting it wherever you want it to be placed in the text.
You can control the size of the image by specifying a width, most usefully by typing a decimal fraction before \textwidth
, e.g. 0.25\textwidth
which will scale the image according to the allowed width for columns of text.
Minipages
Inserting images is one are where LaTeX suffers compared to dedicated layout software — LaTeX was designed to handle figures in academic publications, where the expectations for artful blending of text & image are much lower.
Of the methods of wrapping text around images, I’ve found using side-by-side minipages to be the most painless, as follows:
\begin{minipage}{0.45\textwidth}
Blah blah blah...
\end{minipage}
\hspace{0.1\textwidth}
\begin{minipage}{0.45\textwidth}
\includegraphics[\textwidth]{Path/to/image}
\end{minipage}
You can then manually adjust the \textwidth
scaling factors for each minipage as needed to resize the image, which automatically uses the full width of the minipage.
I should note that LaTeX supports something called ‘floats’ which allow the software to automatically place images in areas that keep the text looking nice. In my experience this works better for long stretches of unbroken text and poorly for ttrpg materials, so I don’t use them.
Fun Stuff & Best Practices
Page Breaks
LaTeX includes several ways to force a page break. \newpage
, \clearpage
, \cleardoublepage
, and \pagebreak
all perform this function with slight differences. If your page is in twocolumn mode, note that \newpage
will shunt you to the next column, but \pagebreak
and \clearpage
create an actual new page.
Chapters automatically insert page breaks, but selectively using them between sections can be really helpful for ensuring that edits early in the document don’t wreak havoc on formatting down the line.
Multicolumn
One rule-of-thumb I’ve seen is that 6x9" is roughly the widest you can get away with single-column text. Using multiple columns often helps save space if you have lots of bullet points, lists, narrow tables, etc. (As ttrpgs often do).
For columns, I’ve used two simple options:
Using the
\twocolumn
and\onecolumn
commands to toggle between page styles. This induces a page-break whenever invoked, so it doesn’t work if you want, say, a wide table or image to cross both columns.Using the
multicols
package. This lets you specify specific chunks of text to format with multiple columns. I generally find it much more flexible and convenient to work with. One note:multicols
by default splits columns evenly if they don’t fill a page, whereas\twocolumn
fills the whole left column then fills the right column. I prefer the latter as I can insert larger graphics in the leftover space, but it’s worth noting.
Drop Caps
Check out the lettrine
package.
Box Text
The mdframed
package is my preferred package for placing text into colored boxes. The code I use for a simple grey box is below:
\RequirePackage{mdframed}
\usepackage{xcolor}
\newenvironment{boxtext}{\vspace{5pt}\begin{mdframed}[backgroundcolor=lightgray!20,nobreak]}{\end{mdframed}}
Headers & Footers
This is one of those things that’s wierdly more of a huge pain that I would have expected, but the fancyhdr
package allows one to alter how headers and footers function. See here for more.
Inserting information from a csv
Control-panel layouts
A popular RPG-design innovation is the 'control-panel' layout, where information on a particular topic is laid out on an easily-referenced two-page spread. The \cleardoublepage
command unfortunately clears to odd-numbered pages, but we can force text to start on an even page by creating a cleartoleftpage
command as follows:
\makeatletter
\newcommand*{\cleartoleftpage}{%
\clearpage
\if@twoside
\ifodd\c@page
\hbox{}\newpage
\if@twocolumn
\hbox{}\newpage
\fi
\fi
\fi
}
\makeatother