Added section pages

This commit is contained in:
Miha Frangež 2025-09-03 13:13:07 +02:00
parent 40d27c6bb7
commit f421352446
3 changed files with 28 additions and 48 deletions

View file

@ -123,34 +123,22 @@ All rights reserved.}\\[0.5cm]
% INCLUDE ALL THE PDFs
%----------------------------------------------------------------------------------------
% This is a hack to make sure works in the same category don't get duplicated sections in the ToC
\newcommand{\includework}[2]{%
\includepdf[
pages=-,
pagecommand={},
addtotoc={1,subsection,1,{#2},{#2}}
]{#1}%
}
% Store the last category/section that was used
\def\lastsection{}
\newcommand{\worksection}[1]{%
\newpage
\center % Center everything on the page
\vspace*{60pt}
\newcommand{\includework}[3]{%
% Expand \lastsection before comparison
\edef\tmplastsection{\lastsection}%
\edef\tmpcurrentsection{#1}%
\ifx\tmpcurrentsection\tmplastsection
% Same as last → only add subsection
\includepdf[
pages=-,
pagecommand={\thispagestyle{plain}},
addtotoc={1,subsection,1,{#3},{#3}}
]{#2}%
\else
% Different → add section and subsection
\def\lastsection{#1}% Update the last section
\includepdf[
pages=-,
pagecommand={\thispagestyle{plain}},
addtotoc={
1,section,1,{#1},{#1},
1,subsection,1,{#3},{#3}
}
]{#2}%
\fi
\section{{#1}}
\vfill % Fill the rest of the page with whitespace
}
% Include all the PDFs