I am trying to generate custom-named headers in PDF files from Markdown. I am using LaTeX and the Eisvogel template.
I want to edit the numbering of the Markdown headers, i.e., the single hash (#), the double hash (##) and triple hash (###) with the following: Part, Lab 1, and Step 1.1, and then every subsequent step should be numbered Step 1.2, Step 1.3, Step 1.4, and so on. The next Lab should be numbered on Lab 2, and its steps are Step 2.1, Step 2.2, Step 2.3, and so on.
So, instead of the following:
# Part 1
## Lab 1.1
### Step 1.1.1
### Step 1.1.2
## Lab 1.2
### Step 1.2.1
### Step 1.2.2
I want the headings to appear as follows:
# Part
## Lab 1
### Step 1.1
### Step 1.2
## Lab 2
### Step 2.1
### Step 2.2
Here is how the formatting is currently set up in the Eisvogel.tex template file:
\usepackage{titlesec}
%% With Part, Lab, Step numbers in each section header
\titleformat{\section}
{\normalfont\huge\bfseries\justifyheadingleft\sffamily\color{black}}
{Part \thesection:}{0.5em}
{}[{\titlerule[1.2pt]}]
\titleformat{\subsection}
{\normalfont\LARGE\bfseries\justifyheadingright\sffamily\color{green}}
{Lab \thesubsection:}{0.5em}
{}[{\titlerule[1.2pt]}]
\titleformat{\subsubsection}
{\normalfont\Large\bfseries\sffamily\color{black}}
{Step \thesubsubsection}
{0em}{}
%% End Lab, Part, Step, and number
Here is how it looks when I use the Pandoc command to build the Lab01.md file to PDF.
In a nutshell, removing the numbering at the Part portion is easy; I change this entry: {Part \thesection:}' to {Part:}`.
But when I try editing the section portion of my LaTeX template (Eisvogel.tex) and change the subsection to section, and subsubsection to subsection, and so on, it messes things up.
%% With Lab, Part, Step and number in section header (Lab Guide Settings)
\usepackage{titlesec}
\titleformat{\section}
% \titleformat{\chapter}
{\normalfont\huge\bfseries\justifyheadingleft\sffamily\color{green}}
{Part:}{0.5em}{}[{\titlerule[1.2pt]}]
\titleformat{\section}
{\normalfont\LARGE\bfseries\justifyheadingright\sffamily\color{green}}
{Lab \thesection:}{0.5em}{}[{\titlerule[1.2pt]}]
\titleformat{\subsection}
{\normalfont\Large\bfseries\sffamily\color{black}}
{Step \thesubsection}{0em}{}
\titleformat{\subsubsection}
{\normalfont\Large\bfseries\sffamily\color{black}}
{Step \thesubsubsection}{0em}{}
%%% End Lab, Part, and Step section
This then generates what looks to be correct, but EVERY Step is now labeled 1.1. Also, The next Lab is still labeled Lab 1: and every Step in that next lab is Step 1.2, Step 1.2, Step 1.2, and so on.
I need to retain the Part numbering so it is included in the Table of Contents. And when you look at the ToC, it appears just fine and the numbering is consistent, but the actual section numbers do not work.
I figure this is a simple syntax change, but I am uncertain where to look.
I tried the lua filter detailed in Specify Pandoc HTML numbering to start from <h2>, but having never used Lua filters before, I was not successful.
I have looked at the scrartcl.cls' file in the /usr/local/texlive/2025basic/texmf-dist/tex/latex/koma-script' directory, but have not been successful in correcting this issue.
Here is my build script:
#!/bin/sh
DATE=$(date "+%Y-%m-%d %H:%M")
time -p pandoc \
-s $(cat includes-lg.txt) \
-o "../LG_L01.pdf" \
-M date="$DATE" \
-V fontsize=10pt \
--pdf-engine pdflatex \
--from markdown \
--toc \
--toc-depth 2 \
--filter=pandoc-latex-environment \
--filter=pandoc-latex-unlisted \
--template "eisvogel-lg.tex" \
--number-sections \
--syntax-highlighting=idiomatic
echo $DATE
The includes-lg.txt file contains a preambleLG.md file and the L01.md file:
preambleLG.md
../L01.md


