Fixed category duplication, added introduction

This commit is contained in:
Miha Frangež 2025-08-31 18:02:17 +02:00
parent c033998e95
commit 2a85b7821f
5 changed files with 72 additions and 66 deletions

View file

@ -3,7 +3,6 @@
\usepackage{eso-pic,graphicx}
\usepackage{pdfpages}
\usepackage{tabu}
\usepackage[top=2cm, bottom=2cm, outer=1.5cm, inner=1.5cm]{geometry}
% Make TOC clickable
\usepackage{hyperref}
\hypersetup{
@ -13,32 +12,27 @@
linkcolor=black,
urlcolor=black
}
\usepackage{etoolbox} % for \ifstrequal
%----------------------------------------------------------------------------------------
% NOTE TO EDITORS:
% Anything that you need to edit is marked with "EDIT THIS"
% grep/CTRL+F is your friend
%----------------------------------------------------------------------------------------
% PAGE DIMENSIONS
%%----------------------------------------------------------------------------------------
\usepackage[top=2cm, bottom=2cm, outer=1.5cm, inner=1.5cm]{geometry}
%----------------------------------------------------------------------------------------
% VARIABLES
%----------------------------------------------------------------------------------------
\include{edit_this/10-variables}
\input{edit_this/10-variables}
\newcommand{\nextyear}{\the\numexpr\currentyear+1\relax}
\definecolor{fri_red}{RGB}{225, 48, 41}
\renewcommand{\contentsname}{Kazalo / Contents}
\begin{document}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
@ -46,7 +40,7 @@
\center % Center everything on the page
%----------------------------------------------------------------------------------------
% HEADING SECTIONS
% TITLE PAGE: HEADING SECTIONS
%----------------------------------------------------------------------------------------
\vspace*{30pt}
@ -59,27 +53,21 @@
\textsc{\large Zbornik}\\[0.5cm] % Minor heading such as course title
\textsc{\Large Digitalna forenzika}\\[0.5cm] % Major heading such as course name
%----------------------------------------------------------------------------------------
% TITLE SECTION
% TITLE PAGE: TITLE SECTION
%----------------------------------------------------------------------------------------
{ \Huge \bfseries Seminarske naloge,}\\[0.4cm] % Title of your document
{ \Huge \bfseries \currentyear/\nextyear}\\[0.4cm] % Title of your document
%----------------------------------------------------------------------------------------
% DATE SECTION
% TITLE PAGE: DATE SECTION
%----------------------------------------------------------------------------------------
\vspace*{300pt}
{\large Ljubljana, \currentyear}\\[2cm]
%----------------------------------------------------------------------------------------
\vfill % Fill the rest of the page with whitespace
% \AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{ozadjeA4.png}}
\end{titlepage}
%----------------------------------------------------------------------------------------
@ -101,18 +89,18 @@ All rights reserved.}\\[0.5cm]
\clearpage
\pagenumbering{arabic}
%
%----------------------------------------------------------------------------------------
% TABLE OF CONTENTS
%
%----------------------------------------------------------------------------------------
\renewcommand{\contentsname}{Kazalo / Contents}
\tableofcontents
\newpage
%----------------------------------------------------------------------------------------
% THE ACTUAL CONTENT
%%----------------------------------------------------------------------------------------
% INTRODUCTION
%----------------------------------------------------------------------------------------
\section{Uvod / Introduction}
\input{edit_this/30-introduction}
@ -124,35 +112,48 @@ All rights reserved.}\\[0.5cm]
\newpage
%----------------------------------------------------------------------------------------
% ABSTRACTS
%----------------------------------------------------------------------------------------
\section{Povzetki / Summaries}
\input{edit_this/50-summaries}
%----------------------------------------------------------------------------------------
% INCLUDE ALL THE PDFs
%----------------------------------------------------------------------------------------
\newcommand{\lastsection}{} % stores last section name
% This is a hack to make sure works in the same category don't get duplicated sections in the ToC
% Store the last category/section that was used
\def\lastsection{}
\newcommand{\includework}[3]{%
\ifstrequal{#1}{\lastsection}{%
% same as last → only add subsection
\includepdf[
pages=-,
pagecommand={\thispagestyle{plain}},
addtotoc={1,subsection,1,{#3},{#3}}
]{#2}%
}{%
% different → add both section and subsection
\renewcommand{\lastsection}{#1}%
\includepdf[
pages=-,
pagecommand={\thispagestyle{plain}},
addtotoc={
1,section,1,{#1},{#1},
1,subsection,1,{#3},{#3}
}
]{#2}%
}%
% 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
}
% Include all the PDFs
\input{edit_this/70-pdf-includes}
\end{document}