3 Commits

Author SHA1 Message Date
shahondin1624
5a63067b93 Add foreword page and image placement commands
- Introductory page with quote, horizontal rule, and foreword text
- \fillerpage{path} for full-page centered filler images
- \songimage{path} for inline images within song pages
- \fullpageimage{path} for borderless full-page images
- Added graphicx and csquotes packages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:54:21 +02:00
shahondin1624
cae0c52b67 Fix TOC page references and song page footer
- Move \label outside dedup guard so it survives the real pass
  (measurement pass labels are discarded inside vbox)
- Song page footer now shows MO/PfLB/Liederbuch table matching TOC
- Fix TEXINPUTS to include output/ for .songtoc file access

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:23:04 +02:00
shahondin1624
692be693e9 Add matrix TOC with cross-reference columns
Replace the default LaTeX TOC with a table matching the Carmina
Leonis style: song titles with columns for reference books (MO,
PfLB) and the current songbook page number. Uses expl3 iow to
write song data to a .songtoc file during compilation and reads
it back on the second pass. Alternating row colors via rowcolors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:06:05 +02:00
3 changed files with 196 additions and 24 deletions

View File

@@ -11,13 +11,13 @@ $(OUTDIR):
mkdir -p $(OUTDIR)
$(OUTDIR)/$(MAIN).pdf: $(MAIN).tex songbook-style.sty songs/*.tex | $(OUTDIR)
TEXINPUTS=.:$(shell pwd): $(ENGINE) $(FLAGS) $(MAIN).tex
TEXINPUTS=.:$(shell pwd): $(ENGINE) $(FLAGS) $(MAIN).tex
TEXINPUTS=.:$(shell pwd):$(shell pwd)/$(OUTDIR): $(ENGINE) $(FLAGS) $(MAIN).tex
TEXINPUTS=.:$(shell pwd):$(shell pwd)/$(OUTDIR): $(ENGINE) $(FLAGS) $(MAIN).tex
clean:
rm -f $(OUTDIR)/*.aux $(OUTDIR)/*.log $(OUTDIR)/*.out \
$(OUTDIR)/*.toc $(OUTDIR)/*.fls $(OUTDIR)/*.fdb_latexmk \
$(OUTDIR)/*.sxd $(OUTDIR)/*.sxc
$(OUTDIR)/*.sxd $(OUTDIR)/*.sxc $(OUTDIR)/*.songtoc
distclean: clean
rm -f $(OUTDIR)/$(MAIN).pdf

View File

@@ -14,8 +14,13 @@
\RequirePackage[hidelinks]{hyperref}
\RequirePackage{fancyhdr}
\RequirePackage{xcolor}
\RequirePackage{longtable}
\RequirePackage{array}
\RequirePackage{colortbl}
\RequirePackage{rotating}
\RequirePackage{graphicx}
\RequirePackage{csquotes}
\RequirePackage[minimal]{leadsheets}
% Pre-mark musicsymbols as loaded to avoid missing musix11 font error
\ExplSyntaxOn
\cs_new:cpn {leadsheets-library-musicsymbols-loaded} {}
\ExplSyntaxOff
@@ -25,7 +30,11 @@
\setmainfont{TeX Gyre Heros}
\newfontfamily\frakfont{UnifrakturMaguntia-Book}[Path=fonts/,Extension=.ttf]
% --- Page style: page numbers at bottom-outer, large ---
% --- Colors ---
\definecolor{tocrowgray}{gray}{0.92}
\definecolor{tocheadgray}{gray}{0.75}
% --- Page style ---
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE]{\large\bfseries\thepage}
@@ -49,12 +58,112 @@
after-song = \songendsection,
}
% --- Chord appearance: regular weight, black (matching reference style) ---
\setchords{
format = \small,
}
% --- Command to render metadata at bottom of song ---
% ==========================================================================
% Song TOC matrix
% ==========================================================================
\newcounter{songnumber}
\newcounter{tocrowcount}
\ExplSyntaxOn
\iow_new:N \g__sb_toc_iow
\tl_new:N \l__sb_title_tl
\tl_new:N \l__sb_mo_tl
\tl_new:N \l__sb_pflb_tl
\tl_new:N \l__sb_num_tl
\tl_new:N \l__sb_songid_tl
\bool_new:N \g__sb_toc_opened_bool
\seq_new:N \g__sb_written_seq
% Lazy-open: only truncate the file when first song writes to it
% This ensures the TOC reads the PREVIOUS run's data before truncation
\cs_new_protected:Npn \__sb_ensure_toc_open:
{
\bool_if:NF \g__sb_toc_opened_bool
{
\iow_open:Nn \g__sb_toc_iow { \c_sys_jobname_str .songtoc }
\bool_gset_true:N \g__sb_toc_opened_bool
}
}
\AtEndDocument{
\bool_if:NT \g__sb_toc_opened_bool
{ \iow_close:N \g__sb_toc_iow }
}
\cs_new_protected:Npn \writesongtoc
{
% Use leadsheets song ID to skip duplicate calls (measurement pass)
\tl_set:NV \l__sb_songid_tl \l_leadsheets_current_song_id_tl
\seq_if_in:NVF \g__sb_written_seq \l__sb_songid_tl
{
\seq_gput_right:NV \g__sb_written_seq \l__sb_songid_tl
\__sb_ensure_toc_open:
\stepcounter{songnumber}
\tl_set:Nx \l__sb_num_tl { \int_use:N \c@songnumber }
\tl_set:Nx \l__sb_title_tl { \songproperty{title} }
\tl_set:Nx \l__sb_mo_tl { \songproperty{mundorgel} }
\tl_set:Nx \l__sb_pflb_tl { \songproperty{pfadfinderliederbuch} }
\iow_now:Nx \g__sb_toc_iow
{
\exp_not:N \songtocrow
{ \l__sb_title_tl }
{ \l__sb_mo_tl }
{ \l__sb_pflb_tl }
{ \exp_not:N \pageref { song: \l__sb_num_tl } }
}
}
% Label MUST be outside guard: measurement pass label is discarded (inside vbox),
% but the real pass label survives and gets written to .aux
\tl_set:Nx \l__sb_num_tl { \int_use:N \c@songnumber }
\label{song:\tl_use:N \l__sb_num_tl}
}
\ExplSyntaxOff
% --- Render one TOC row ---
\newcommand{\songtocrow}[4]{%
#1 & #2 & #3 & \cellcolor{tocheadgray}\textbf{#4} \\
\hline
}
% --- Rotated column header ---
\newcommand{\rotheader}[1]{%
\begin{turn}{70}\footnotesize\textbf{#1}\end{turn}%
}
% --- Print the song TOC table ---
\newcommand{\printsongtoc}{%
\thispagestyle{fancy}%
{\Large\bfseries Inhaltsverzeichnis\par}%
\vspace{5mm}%
\footnotesize
\rowcolors{2}{tocrowgray}{white}%
\begin{longtable}{%
>{\raggedright\arraybackslash}p{0.52\textwidth}|%
>{\centering\arraybackslash}p{0.10\textwidth}|%
>{\centering\arraybackslash}p{0.10\textwidth}|%
>{\centering\arraybackslash\columncolor{tocheadgray}}p{0.12\textwidth}%
}
& \rotheader{MO} & \rotheader{PfLB}
& \rotheader{\normalsize Lieder-\newline\normalsize buch} \\
\hline
\endfirsthead
& \rotheader{MO} & \rotheader{PfLB}
& \rotheader{\normalsize Lieder-\newline\normalsize buch} \\
\hline
\endhead
\InputIfFileExists{\jobname.songtoc}{}{}%
\end{longtable}%
}
% ==========================================================================
% Song end section
% ==========================================================================
\newcommand{\songendsection}{%
\vfill
\ifsongproperty{note}{%
@@ -74,27 +183,60 @@
}{}%
}%
\endgroup
% Reference book footer
\vspace{3mm}%
\begingroup\footnotesize
\noindent
\makebox[0.18\textwidth][c]{MO}%
\makebox[0.18\textwidth][c]{PfLB}%
\hfill\par\noindent
\makebox[0.18\textwidth][c]{%
\ifsongproperty{mundorgel}{\songproperty{mundorgel}}{}%
}%
\makebox[0.18\textwidth][c]{%
\ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{}%
}%
\hfill
\begingroup\footnotesize\centering
\begin{tabular}{ccc}
MO & PfLB & Liederbuch \\
\ifsongproperty{mundorgel}{\songproperty{mundorgel}}{} &
\ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{} &
\thepage
\end{tabular}\par
\endgroup
\newpage
}
% --- Song title template: Fraktur title, metadata at bottom ---
% ==========================================================================
% Song title template
% ==========================================================================
\definesongtitletemplate{songbook}{%
{\LARGE\frakfont\songproperty{title}\par}%
\addcontentsline{toc}{section}{\songproperty{title}}%
\writesongtoc
\vspace{4mm}%
}
% ==========================================================================
% Image placement
% ==========================================================================
% Full-page filler image (centered, scaled to fit, own page)
% Usage: \fillerpage{images/drawing.png}
\newcommand{\fillerpage}[1]{%
\clearpage
\thispagestyle{empty}%
\vspace*{\fill}%
\begin{center}%
\includegraphics[width=0.85\textwidth,height=0.85\textheight,keepaspectratio]{#1}%
\end{center}%
\vspace*{\fill}%
\clearpage
}
% Inline image within a page (e.g., at end of a song with remaining space)
% Usage: \songimage{images/landscape.png}
\newcommand{\songimage}[1]{%
\begin{center}%
\includegraphics[width=0.8\textwidth,keepaspectratio]{#1}%
\end{center}%
}
% Full-page image with no margins (bleeds to edges)
% Usage: \fullpageimage{images/cover.png}
\newcommand{\fullpageimage}[1]{%
\clearpage
\thispagestyle{empty}%
\newgeometry{margin=0pt}%
\noindent\includegraphics[width=\paperwidth,height=\paperheight]{#1}%
\restoregeometry
\clearpage
}

View File

@@ -17,10 +17,40 @@
\vfill
\end{titlepage}
% --- Table of Contents ---
\tableofcontents
% --- Foreword / Introductory page ---
\thispagestyle{empty}
{\large\bfseries\itshape
\enquote{Das Volkslied ist nun einmal da --, daran k\"onnen wir nicht
vorbei -- es ergreift uns stark und tief, und die Antwort auf
das Warum? bleiben wir schuldig.}
\par}
\vspace{2mm}
\noindent\rule{\textwidth}{0.4pt}
\vspace{4mm}
\small
So hei\ss t es im Vorwort des wohl bekanntesten Liederbuchs
in der Jugendbewegung, dem \textit{Zupfgeigenhansl}, aus dem Jahr 1913.
Und auch wir erleben auf Fahrt und Lager immer wieder die Kraft des
gemeinsamen Singens. Mit diesem Liederbuch haben wir eine Auswahl
an Liedern aus unterschiedlichen Quellen zusammengetragen.
Singen verbindet uns, macht Freude und ist ein entscheidendes Element
unserer Lager und Fahrt.
\vspace{5mm}
Herzlichst Gut Pfad
\clearpage
% --- Table of Contents ---
\printsongtoc
\clearpage
% --- Filler images can be placed between songs ---
% Example: \fillerpage{images/drawing.png}
% --- Songs (alphabetical) ---
\input{songs/abend-wird-es-wieder}
\input{songs/auf-auf-zum-froehlichen-jagen}