refactor(documentclass): implement key-value options for skripsi class
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesClass{skripsi}[2025/05/10 Bachelor Thesis Class]
|
||||
|
||||
\newif\if@draftmark \@draftmarkfalse
|
||||
\newif\if@primarytitle \@primarytitletrue
|
||||
\newif\if@secondarytitle \@secondarytitletrue
|
||||
\RequirePackage{kvoptions}
|
||||
\SetupKeyvalOptions{
|
||||
family=skripsikvopt,
|
||||
prefix=skripsikvopt@
|
||||
}
|
||||
|
||||
% key-value options
|
||||
\DeclareBoolOption[false]{draftmark}
|
||||
\DeclareBoolOption[true]{primarytitle}
|
||||
\DeclareBoolOption[true]{secondarytitle}
|
||||
% section number depth and tocdepth
|
||||
\DeclareStringOption[3]{sectiondepth}
|
||||
\DeclareStringOption[3]{tocdepth}
|
||||
|
||||
\DeclareOption{draftmark}{\@draftmarktrue}
|
||||
\DeclareOption{noprimarytitle}{\@primarytitlefalse}
|
||||
\DeclareOption{nosecondarytitle}{\@secondarytitlefalse}
|
||||
% Add complementary options for the "no" versions
|
||||
\DeclareComplementaryOption{noprimarytitle}{primarytitle}
|
||||
\DeclareComplementaryOption{nosecondarytitle}{secondarytitle}
|
||||
|
||||
\ProcessKeyvalOptions*
|
||||
|
||||
\ProcessOptions \relax
|
||||
\LoadClass[a4paper,12pt,oneside]{book}
|
||||
|
||||
% Load common packages
|
||||
@@ -83,7 +93,7 @@
|
||||
% \renewcommand{\bibname}{DAFTAR PUSTAKA}
|
||||
|
||||
% Conditionally load the watermark package and settings
|
||||
\if@draftmark
|
||||
\ifskripsikvopt@draftmark
|
||||
\RequirePackage{draftwatermark}
|
||||
% All watermark settings in one place:
|
||||
\DraftwatermarkOptions{%
|
||||
@@ -119,19 +129,6 @@
|
||||
\setsansfont{Arial}
|
||||
\setmonofont{Courier New}
|
||||
|
||||
% Metadata commands
|
||||
% \input{metadata}
|
||||
|
||||
% \newcommand{\setthesisinfo}[7]{%
|
||||
% \renewcommand{\thesistitle}{#1}%
|
||||
% \renewcommand{\studentname}{#2}%
|
||||
% \renewcommand{\studentid}{#3}%
|
||||
% \renewcommand{\program}{#4}%
|
||||
% \renewcommand{\faculty}{#5}%
|
||||
% \renewcommand{\university}{#6}%
|
||||
% \renewcommand{\yearofsubmission}{#7}%
|
||||
% }
|
||||
|
||||
% % Header and footer
|
||||
\fancypagestyle{fancy}{%
|
||||
\fancyhf{}
|
||||
@@ -185,7 +182,7 @@
|
||||
{\normalsize\bfseries}{\thesubsection}{1em}{}
|
||||
|
||||
% Section numbering depth
|
||||
\setcounter{secnumdepth}{3}
|
||||
\setcounter{secnumdepth}{\skripsikvopt@sectiondepth}
|
||||
|
||||
% Ensure chapter reference in TOC matches
|
||||
\renewcommand{\cftchappresnum}{\MakeUppercase\chaptername~}
|
||||
@@ -197,7 +194,7 @@
|
||||
\let\original@maketitle\maketitle
|
||||
|
||||
\renewcommand{\maketitle}{%
|
||||
\if@primarytitle
|
||||
\ifskripsikvopt@primarytitle
|
||||
\IfFileExists{frontmatter/maketitle.tex}{%
|
||||
\input{frontmatter/maketitle}%
|
||||
}{%
|
||||
@@ -206,7 +203,7 @@
|
||||
\original@maketitle
|
||||
}%
|
||||
\fi
|
||||
\if@secondarytitle
|
||||
\ifskripsikvopt@secondarytitle
|
||||
\clearpage
|
||||
\IfFileExists{frontmatter/maketitle_secondary.tex}{%
|
||||
\input{frontmatter/maketitle_secondary}%
|
||||
@@ -272,6 +269,9 @@
|
||||
\renewcommand{\cftlottitlefont}{\hfill\bfseries\MakeUppercase}
|
||||
\renewcommand{\cftafterlottitle}{\hfill}
|
||||
|
||||
% TOC depth
|
||||
\setcounter{tocdepth}{\skripsikvopt@tocdepth}
|
||||
|
||||
% Defines a new glossary called “notation”
|
||||
\newglossary[nlg]{notation}{not}{ntn}{Notation}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user