feat(documentclass): add fallback to default \maketitle when custom files missing

Add file existence checks for frontmatter templates with graceful
fallback to original \maketitle when frontmatter/maketitle.tex is
not found. Includes class warnings for missing files.
This commit is contained in:
2025-10-30 21:36:17 +07:00
parent 9565847b3a
commit bf6b91fa1c

View File

@@ -193,13 +193,26 @@
% Redefine \maketitle
% Save the original \maketitle before redefining it
\let\original@maketitle\maketitle
\renewcommand{\maketitle}{%
\if@primarytitle
\input{frontmatter/maketitle}%
\IfFileExists{frontmatter/maketitle.tex}{%
\input{frontmatter/maketitle}%
}{%
% Fallback to original \maketitle
\ClassWarning{thesis.cls}{File frontmatter/maketitle.tex not found, using default maketitle}%
\original@maketitle
}%
\fi
\if@secondarytitle
\clearpage
\input{frontmatter/maketitle_secondary}%
\IfFileExists{frontmatter/maketitle_secondary.tex}{%
\input{frontmatter/maketitle_secondary}%
}{%
\ClassWarning{thesis.cls}{File frontmatter/maketitle_secondary.tex not found, skipping}%
}%
\fi
}