diff --git a/config/thesis_commands.tex b/config/thesis_commands.tex index 39e2d17..35688a7 100644 --- a/config/thesis_commands.tex +++ b/config/thesis_commands.tex @@ -5,41 +5,7 @@ \includefrom{#1}{#2}% and relative paths \input in the chapter } -\usepackage{titletoc} % Local table of contents -\newcommand{\chaptertoc}{% Print the table of contents for the chapter - \hypersetup{linkcolor=black}% - - \vspace{-1em}% - \horizontalrule% - \vspace{-1.5em}% - \section*{Contents}% Add a section title - \vspace{-0.5em}% - - \startcontents% Start referencing the contents - \renewcommand{\cftsecfont}{\bfseries}% Bold sections in local ToC - \printcontents{}{1}{}% Print the contents - - \horizontalrule% - \vspace{2em}% -} - -% 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}} -\renewcommand{\eqref}[2][\labelprefix]{Equation~\ref{#1:eq:#2}} -\renewcommand{\figref}[2][\labelprefix]{Figure~\ref{#1:fig:#2}} -\newcommand{\partref}[1]{Part~\ref{#1}} -\renewcommand{\secref}[2][\labelprefix]{Section~\ref{#1:#2}} -\renewcommand{\tabref}[2][\labelprefix]{Table~\ref{#1:tab:#2}} - +% Equations \NewEnvironmentCopy{oldequation}{equation} \RenewDocumentEnvironment{equation}{m}{% \begin{oldequation}% @@ -115,6 +81,23 @@ labelfont={sf,bf,up}, % sans-serif, bold, upright } +% Labels and references +% 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}} + +\newcommand{\chapref}[1]{Chapter~\ref{#1}} +\renewcommand{\eqref}[2][\labelprefix]{Equation~\ref{#1:eq:#2}} +\renewcommand{\figref}[2][\labelprefix]{Figure~\ref{#1:fig:#2}} +\newcommand{\partref}[1]{Part~\ref{#1}} +\renewcommand{\secref}[2][\labelprefix]{Section~\ref{#1:#2}} +\renewcommand{\tabref}[2][\labelprefix]{Table~\ref{#1:tab:#2}} + % Tables \RenewDocumentEnvironment{tab}{O{htbp} m m O{}}{% #1 = position, #2 = label, #3 = title, #4 = additional caption \begin{table}[#1]% @@ -133,3 +116,22 @@ }{% \end{sidewaystable}% } + +% Local table of contents +\usepackage{titletoc} +\newcommand{\chaptertoc}{% Print the table of contents for the chapter + %\hypersetup{linkcolor=black}% + + \vspace{-1em}% + \horizontalrule% + \vspace{-1.5em}% + \section*{Contents}% Add a section title + \vspace{-0.5em}% + + \startcontents% Start referencing the contents + \renewcommand{\cftsecfont}{\bfseries}% Bold sections in local ToC + \printcontents{}{1}{}% Print the contents + + \horizontalrule% + \vspace{2em}% +}