classicthesis 中的章节格式已损坏

classicthesis 中的章节格式已损坏

我一直在classicthesis为一个项目使用该软件包。它提供了用于构建文档的部分、章节和节,章节开头的格式应如下:

在此处输入图片描述

在处理我的文档的过程中,此格式已丢失。现在\chapter{Foo}的格式与 完全相同\section{Foo}

我已将错误来源缩小到mypreamble.tex我包含在主文档文件中的那个文件。此部分代码中的某些内容导致了错误:

%----------------------------------------------------------------------------------------
%   PACKAGES
%----------------------------------------------------------------------------------------

\usepackage{longtable}
\usepackage{minted}
%\usepackage[backend=bibtex]{biblatex}
\usepackage{lmodern}    % standard latex math font
%\usepackage{cmbright}
%\renewcommand\rmdefault{hfoldsty}



\usepackage{todonotes}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ruled,vlined, linesnumbered]{algorithm2e} % algorithms
\usepackage{scrextend}  % addmargin command comes from here
\usepackage{aurical}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{amssymb}
\usepackage{colortbl}
%\usepackage{subcaption}    % TODO: doesn't cooperate with subfig
\usepackage{pgfplots}

% https://tex.stackexchange.com/questions/174186/todonotes-group-list-of-todos-by-section
\usepackage{tocloft,xpatch}




%----------------------------------------------------------------------------------------
% COMMANDS
%----------------------------------------------------------------------------------------

% formatting
\newcommand{\term}[1]{\textit{#1}}
\newcommand{\algo}[1]{\textsf{#1}}
\newcommand{\TODO}[1]{\todo[size=\small, inline]{#1}}

% math
\newcommand{\set}[1]{ \{ #1 \} }

% function definition
\newcommand{\funcdef}[2]
{
    \left\{
        \begin{array}{ll}
            #1 \\
            #2
        \end{array}
    \right.
}


\newcommand{\nwk}{\textsf{NetworKit}\xspace}


%----------------------------------------------------------------------------------------
%  ENVIRONMENTS
%----------------------------------------------------------------------------------------

\newenvironment{koan}
{\color{darkgray} \begin{addmargin}[6cm]{0cm} \begin{footnotesize}}
{\end{footnotesize} \end{addmargin} \bigskip }


%----------------------------------------------------------------------------------------
%  THEOREMS
%------------------------------------------ ----------------------------------------------

\theoremstyle{definition}
\newtheorem{definition}{Definition}

%----------------------------------------------------------------------------------------
%  CONFIG
%----------------------------------------------------------------------------------------

\graphicspath{ {graphics/} }
%\graphicspath{{../Graphics}}

% include needed for pseudocode includes
\input{Pseudocode/Distributed/pseudocodes_setup}

% include needed for TeX-generated plots
\input{graphics/Distributed/plots/plots_setup}

%----------------------------------------------------------------------------------------
%   Colors
%----------------------------------------------------------------------------------------


\definecolor{bg}{rgb}{0.985,0.985,0.985}

\newenvironment{code}[1]
                {
                \begin{minted}[mathescape,
                               linenos,
                               numbersep=5pt,
                               frame=lines,
                               framesep=2mm,
                               fontsize=\footnotesize,
                               bgcolor=codebg]{#1}
                }
                {\end{minted}}



%----------------------------------------------------------------------------------------
% List of ToDos
%----------------------------------------------------------------------------------------

% initial definitions for storing the section info (name and number)
\def\thissectiontitle{}
\def\thissectionnumber{}

\newtoggle{noTodos}

\makeatletter
% redefinition of \@sect so \section glbally stores its name and number
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}\relax}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
#6{%
\@hangfrom{\hskip #3\relax\@svsec}%
\interlinepenalty \@M #8\@@par}%
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
\else
\@xsect
\def\@svsechd{%
#6{\hskip #3\relax
\@svsec #8}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}}%
\fi
\@xsect{#5}%
\ifnum#2=1\relax
\global\def\thissectiontitle{#8}
\global\def\thissectionnumber{\thesection}
\fi%
}

\pretocmd{\section}{\global\toggletrue{noTodos}}{}{}

% the \todo command does the job: the first time it is used after a \section command,
% it writes the information of the section to the list of todos
\AtBeginDocument{%
  \xpretocmd{\todo}{%
    \iftoggle{noTodos}{
     \addtocontents{tdo}{\protect\contentsline {section}%
        {\protect\numberline{\thissectionnumber}{\thissectiontitle}}{}{} }
      \global\togglefalse{noTodos}
        }{}
    }{}{}%
  }
\makeatother

答案1

好吧,这有点愚蠢。在一个我没有写的包含文件深处有这个命令:

\let\chapter=\section 

删除它显然可以解决问题。

相关内容