Extract \usepackage to config/ files

This commit is contained in:
2024-06-28 17:12:06 +02:00
parent 0f9ed24779
commit a0e9332d12
5 changed files with 123 additions and 114 deletions

View File

@@ -0,0 +1,33 @@
\newcommand{\importchapter}[2]{% Load a chapter (#2) in a path (#1)
\cleardoublepage% after a clear double page
\graphicspath{{#1/figures/}}% with figures
\includefrom{#1}{#2}% and relative paths \input in the chapter
}
\newcommand{\chaptertoc}{% Print the table of contents for the chapter
\vspace*{-1cm}%
\horizontalrule%
\vspace*{-0.5cm}%
\localtableofcontents%
\horizontalrule%
}
% Add chapter label as prefix to all other sub-labels
\NewCommandCopy{\oldlabel}{\label}
\newcommand{\labelprefix}{main}
\newcommand{\mainlabel}[1]{%
\renewcommand{\labelprefix}{#1}%
\oldlabel{\labelprefix}%
}
\renewcommand{\label}[1]{\oldlabel{\labelprefix:#1}}
% References
\newcommand{\chapref}[1]{chapter~\ref{#1}}
\newcommand{\Chapref}[1]{Chapter~\ref{#1}}
\renewcommand{\eqref}[1]{Equation~\ref{\labelprefix:eq:#1}}
\renewcommand{\figref}[1]{Figure~\ref{\labelprefix:fig:#1}}
\newcommand{\partref}[1]{part~\ref{#1}}
\newcommand{\Partref}[1]{Part~\ref{#1}}
\renewcommand{\secref}[1]{section~\ref{\labelprefix:sec:#1}}
\newcommand{\Secref}[1]{Section~\ref{\labelprefix:sec:#1}}
\renewcommand{\tabref}[1]{Table~\ref{\labelprefix:tab:#1}}