WtA character journal - LaTeX fun

LaTeX is tough. I have previously raved on the pandoc tool for converting markdown to PDF or HTML as it mostly abstracts all the tough bits. Because to make a PDF from markdown it breezes through LaTeX first. Looking around found some great baseline templates to create documents that don’t look too academic white paper. But since things had been working well for my work document outputs matching our official templates, I thought I’d try something trickier.

For a while I’ve wanted to make a Player Journal for Werewolf the Apocalypse games. There are tonnes for D&D but few for others. Something to hold my character sheet, character specific and generic rules extracted, and more spread out point spend areas so erasers don’t ruin the sheets.

I wanted the sheet to get design inspiration from the official sheets so wanted to have the headers with a specific font, centred, and a background image.

I did not expect how hard it would be.

First how to get the font in there. Funnily enough that was easy - if the font is in the system you can define a new font family like so

\usepackage{fontspec}

\newfontface\balthazar{Balthazar}

Then was how to get the image into the background. I played with relative indents etc until I found the right webpage that said it needed to be inside a \makebox so it can be anchored under text

\makebox(\linewidth,0){ %make it the width of the page, but no height
\raisebox{-2.7\height}{ %Move it down a bit so that it's in line with the text
\includegraphics[width=0.9\linewidth]{header-line.png}}} % add the graphic. Extension is unneccessary, but I add it

Centering text proved problematic. As this was from the template using the sectsty library and the \sectionfont shortcuts, the way the headers were setup didn’t give me access to \centering. A bunch of tweaking and I figured the auto label adding to the heading was breaking the centering. I reverted sectsty to use the full titling component and removed the label.

\usepackage[sf,sl,outermarks]{titlesec}
1pandoc --pdf-engine=xelatex --template=templates\template.latex -f markdown-auto_identifiers -o "x.pdf" test.markdown

Putting the text on top of the background image was black text on a dark image. I tried using a colorbox to give it a white background but looked very poor. More checking I found the bordering function to give a highlight of white around the text, using the contour library. It worked!

\usepackage{contour}

\balthazar\fontsize{30}{32}\selectfont\filcenter\contour{white}

But then. Oh boy and then. Centering the text moved the background image. The text anchor seemed to change the image anchor. Like having everything cantered had the image centered on the start of the text. Since the text was at different lengths and centered that made the image move. I couldn’t figure it out, using hspace and other things. Finally I tried just putting a blank line in the title formatting section by adding \\ and it separated the anchor! I now have headers that are centered with a background image. Yay

\newfontface\balthazar{Balthazar}
\usepackage[export]{adjustbox}
\usepackage[sf,sl,outermarks,explicit]{titlesec}
\usepackage{contour}
\contournumber{64}
\contourlength{.11em}

\titleformat{\section}[block]
{\newpage
\makebox(\linewidth,0){
\raisebox{-2.7\height}{
\includegraphics[width=0.9\linewidth]{header-line.png}}}}
{\thesection}
{1em}
{\\
\balthazar\fontsize{30}{32}\selectfont\filcenter\contour{white}{#1}}{}