From bf6b91fa1c68f79d3003b96a11737958e66b0aaf Mon Sep 17 00:00:00 2001 From: "Rifqi D. Panuluh" Date: Thu, 30 Oct 2025 21:36:17 +0700 Subject: [PATCH] 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. --- latex/thesis.cls | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/latex/thesis.cls b/latex/thesis.cls index ba200a7..b9cc05b 100644 --- a/latex/thesis.cls +++ b/latex/thesis.cls @@ -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 }