feat(documentclass): enhance cover page options and redefine \maketitle behavior to embed cover layout as default while still giving custom user-defined cover page layout

This commit is contained in:
2025-10-31 22:57:13 +07:00
parent 03afd709ca
commit 0530ce0cea

View File

@@ -14,6 +14,8 @@
% section number depth and tocdepth % section number depth and tocdepth
\DeclareStringOption[3]{sectiondepth} \DeclareStringOption[3]{sectiondepth}
\DeclareStringOption[3]{tocdepth} \DeclareStringOption[3]{tocdepth}
% cover page style
\DeclareStringOption[default]{cover} % default is 'custom'
% Add complementary options for the "no" versions % Add complementary options for the "no" versions
\DeclareComplementaryOption{noprimarytitle}{primarytitle} \DeclareComplementaryOption{noprimarytitle}{primarytitle}
@@ -182,37 +184,115 @@
{\normalsize\bfseries}{\thesubsection}{1em}{} {\normalsize\bfseries}{\thesubsection}{1em}{}
% Section numbering depth % Section numbering depth
\makeatletter
\setcounter{secnumdepth}{\skripsikvopt@sectiondepth} \setcounter{secnumdepth}{\skripsikvopt@sectiondepth}
\makeatother
% Ensure chapter reference in TOC matches % Ensure chapter reference in TOC matches
\renewcommand{\cftchappresnum}{\MakeUppercase\chaptername~} \renewcommand{\cftchappresnum}{\MakeUppercase\chaptername~}
\renewcommand{\cftchapaftersnum}{\quad} \renewcommand{\cftchapaftersnum}{\quad}
% Redefine \maketitle % Redefine \maketitle
% Save the original \maketitle before redefining it % Save the original \maketitle before redefining it
\makeatletter
\let\original@maketitle\maketitle \let\original@maketitle\maketitle
\renewcommand{\maketitle}{% \renewcommand{\maketitle}{%
\ifskripsikvopt@primarytitle \ifskripsikvopt@primarytitle
\IfFileExists{frontmatter/maketitle.tex}{% % Check if user explicitly wants default
\input{frontmatter/maketitle}% \ifdefstring{\skripsikvopt@cover}{legacy}{%
}{% % Use original book \maketitle
% Fallback to original \maketitle
\ClassWarning{skripsi.cls}{File frontmatter/maketitle.tex not found, using default maketitle}%
\original@maketitle \original@maketitle
\IfFileExists{frontmatter/maketitle.tex}{%
\ClassWarning{skripsi.cls}{Omit 'cover=legacy' option to use user-defined primary cover page 'frontmatter/maketitle.tex'}
}{}%
}{%
% Try to use user's custom file first
\IfFileExists{frontmatter/maketitle.tex}{%
\input{frontmatter/maketitle}%
\ClassWarning{skripsi.cls}{Using user-defined cover page 'frontmatter/maketitle.tex'}%
}{%
% embedded version
{\begin{titlepage}
\centering
\vspace*{1cm}
{\fontsize{14pt}{16pt}\selectfont \textbf{\MakeUppercase{Tugas Akhir (EMBED)}}\par}
\vspace{1.5cm}
{\fontsize{14pt}{16pt}\selectfont \textbf{\MakeUppercase{\thetitle}}\par}
\vspace{1.5cm}
\includegraphics[width=5cm]{frontmatter/img/logo.png}
\vspace{1.5cm}
\textbf{Disusun oleh:} \\
{\fontsize{14pt}{16pt}\selectfont \textbf{\theauthor}} \\
{\fontsize{14pt}{16pt}\selectfont \textbf{\theauthorid}} \\
\vfill
{\fontsize{12pt}{14pt}\selectfont
\textbf{\MakeUppercase\theprogram} \\
\textbf{\MakeUppercase\thefaculty} \\
\textbf{\MakeUppercase\theuniversity} \\
\textbf{\theyearofsubmission}
}
\end{titlepage}%
}
}%
}% }%
\else
\IfFileExists{frontmatter/maketitle.tex}{%
\ClassWarning{skripsi.cls}{Omit 'noprimarytitle' option to use user-defined cover page 'frontmatter/maketitle.tex'}%
}{}%
\fi \fi
\ifskripsikvopt@secondarytitle \ifskripsikvopt@secondarytitle
\clearpage \clearpage
\IfFileExists{frontmatter/maketitle_secondary.tex}{% \IfFileExists{frontmatter/maketitle_secondary.tex}{%
\input{frontmatter/maketitle_secondary}% \input{frontmatter/maketitle_secondary}%
\ClassWarning{skripsi.cls}{Using user-defined secondary cover page}
}{% }{%
\ClassWarning{skripsi.cls}{File frontmatter/maketitle_secondary.tex not found, skipping}% {
\begin{titlepage}
\centering
{\fontsize{14pt}{16pt}\selectfont \textbf{\MakeUppercase{Tugas Akhir (Embed)}}\par}
\vspace{1.5cm}
{\fontsize{14pt}{16pt}\selectfont \textbf{\MakeUppercase{\thetitle}}\par}
\vspace{1cm}
{\normalsize\selectfont Diajukan guna melengkapi persyaratan untuk memenuhi gelar Sarjana Teknik di Program Studi Teknik Sipil, Fakultas Teknik, Universitas Muhammadiyah Yogyakarta\par}
\vspace{1.5cm}
\includegraphics[width=5cm]{frontmatter/img/logo.png}
\vspace{1.5cm}
\textbf{Disusun oleh:} \\
{\fontsize{14pt}{16pt}\selectfont \textbf{\theauthor}} \\
{\fontsize{14pt}{16pt}\selectfont \textbf{\theauthorid}} \\
\vfill
{\fontsize{12pt}{14pt}\selectfont
\textbf{\MakeUppercase\theprogram} \\
\textbf{\MakeUppercase\thefaculty} \\
\textbf{\MakeUppercase\theuniversity} \\
\textbf{\theyearofsubmission}
}
\end{titlepage}%
}
\ClassWarning{skripsi.cls}{File frontmatter/maketitle_secondary.tex not found, using embedded secondary cover page}%
}% }%
\else
\IfFileExists{frontmatter/maketitle_secondary.tex}{%
\ClassWarning{skripsi.cls}{Omit 'nosecondarytitle' option to use user-defined secondary cover page 'frontmatter/maketitle_secondary.tex'}%
}{}%
\fi \fi
} }
\makeatother
% Chapter & Section format % Chapter & Section format
% thanks to https://latex.org/forum/viewtopic.php?p=83118&sid=a22ccb456531faabf65070c18af69680#p83118 for elegant solution % thanks to https://latex.org/forum/viewtopic.php?p=83118&sid=a22ccb456531faabf65070c18af69680#p83118 for elegant solution
\makeatletter \makeatletter
@@ -267,10 +347,10 @@
\renewcommand{\cftloftitlefont}{\hfill\bfseries\MakeUppercase} \renewcommand{\cftloftitlefont}{\hfill\bfseries\MakeUppercase}
\renewcommand{\cftafterloftitle}{\hfill} \renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftlottitlefont}{\hfill\bfseries\MakeUppercase} \renewcommand{\cftlottitlefont}{\hfill\bfseries\MakeUppercase}
\renewcommand{\cftafterlottitle}{\hfill}
% TOC depth % TOC depth
\makeatletter
\setcounter{tocdepth}{\skripsikvopt@tocdepth} \setcounter{tocdepth}{\skripsikvopt@tocdepth}
\makeatother
% Defines a new glossary called “notation” % Defines a new glossary called “notation”
\newglossary[nlg]{notation}{not}{ntn}{Notation} \newglossary[nlg]{notation}{not}{ntn}{Notation}