In this adventure, I sought to create an automated toolset to track and maintain my Dungeons and Dragons characters. I kept both the character sheet proper, as well as a history log of all the sessions. The difficulty here was using the old clunker LaTeX to create these documents.
Foundation
Digging around at the start to see what options exist already for this type of work, I started investigating tools like pandoc for converting these documents from some plaintext language like Markdown into a final, good looking document. The problem became here that pandoc is highly HTML centric without specifying things, and often ends up using LaTeX as an intermediary anyway depending on the task. As this tool is widely adopted in Academic environments, I wanted to give it a shot especially that there is work done here already for DnD specifically.
I ventured upon a Github repository from one matsavage that seems to have addressed this much more comprehensively than I had intended (matsavage/DND-5e-LaTeX-Character-Sheet-Template). It even provided a Github action, this man was reading my dreams at night..
I used this as a foundation. While great and useful, this tool from matsavage used nix as a backend for management of the PDF commands to kick off the compilation. Personally, from a network background which is as close to pure magic as it gets with older network devices, using Nix is just foreign, confusing and overhead with no apparent benefit. I then started to use parts of the program in my own, namely the stylesheets written already. Additionally, lots of work was done to map coordinates of the PDF to allow LaTeX to draw atop the PDF itself – very tedious based off the files in the repo, so I just forked it entirely and removed Nix. I used Makefile instead.
Internals

I had two Texfiles for the project, one for the history and one for the Character Sheet. The history page uses csv file to populate an inventory change log in the PDF spat out.


The Dockerfile is pretty complicated and takes forever to build. It requires downloading the entirety of TexLive to compile the PDFs, so docker makes that real simple after the first run as it stores it as a layer.
I wanted to use local compilation as the PDF changes that generated new PDF artifacts sometimes ran too frequently for me to feel comfortable using Github for.
Since the Docker solution is sluggish and heavy to implement, the most useful deployment for this that I have found is just to use the dndtemplate.sty and other file’s from matsavage’s repo, and replace the Nix parts with just a simple Makefile.
chars:
latexmk -lualatex characters/*.tex
open mychar*.pdf
icloudarchive:
latexmk -lualatex characters/*.tex
mkdir -p ~/Documents/Archive/DnD/DnD_TheSages/History/$(today)
cp mychar*.pdf ~/Documents/Archive/DnD/DnD_TheSages/History/$(today)
open ~/Documents/Archive/DnD/DnD_TheSages/History/$(today)/mychar*.pdf
Specifically, this is useful because it’s a run once that just uses MacTex on my laptop, and then backs up the generated PDF files in my iCloud Drive.