Clean chapter commands

This commit is contained in:
2024-09-27 22:37:45 +02:00
parent b793c55564
commit 90fbfec368
2 changed files with 28 additions and 27 deletions

View File

@@ -32,6 +32,31 @@
\setcounter{secnumdepth}{3} % Number subsubsections
% Parts and chapters
\NewCommandCopy{\oldchapter}{\chapter}
\RenewDocumentCommand{\chapter}{s o m}{% #1 = star (no number), #2 = short title, #3 = title
\IfBooleanTF{#1}{%
\oldchapter*{#3}% Starred chapter
\addcontentsline{toc}{chapter}{#3}% Add to the table of contents
}{%
\IfValueTF{#2}{%
\oldchapter[#2]{#3}% Chapter with short title
}{%
\oldchapter{#3}% Regular chapter
}%
\addcontentsline{lof}{chapter}{\thechapter.\ #3} % Add to the list of figures
\addcontentsline{lot}{chapter}{\thechapter.\ #3} % Add to the list of tables
}%
}
\newcommand{\importchapter}[2]{% Load a chapter (#2) in a path (#1)
\glsresetall% Reset the acronyms
\graphicspath{{#1/figures/}}% Enable relative paths for images
\cleardoublepage% Start on a right page
\includefrom{#1}{#2}% Include with relative paths \input in the chapter
}
% Headers
\usepackage{emptypage} % Remove headers and footers on empty pages
\usepackage{etoolbox} % Patching commands