1

I've been using the classicthesis package for a project. It provides parts, chapters and sections for structuring the document, and a chapter beginning is supposed to be formatted like this:

enter image description here

In the course of working on my document, this formatting has been lost. Now \chapter{Foo} is formatted exactly like \section{Foo}.

I've narrowed the source of the error down to mypreamble.tex which I include in the main document file. Something in this section of code is causing the error:

%----------------------------------------------------------------------------------------
%   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
Rico
  • 6,097
clstaudt
  • 1,192
  • 2
  • 11
  • 27
  • 2
    Without an MWE it's hard to know for certain; could you post a small example of the code that reproduces this error? Also, check the options you passed to classicthesis: this sounds like you could have passed the nochapters option to the class, or some other class option that's doing this. – Arun Debray Dec 29 '15 at 17:07
  • How could I post an MWE here for this multi-file project? I'm checking for the nochapters option, but I can't identify a place where this option is passed. I certainly did not pass it on purpose. My classicthesis-config.tex contains the following line: \PassOptionsToPackage{eulerchapternumbers,listings,drafting, pdfspacing, subfig,beramono,eulermath,parts}{classicthesis} – clstaudt Dec 29 '15 at 17:18
  • I tried using those options with a very simple document, and chapters and sections look different, so it's not those options, and I just tested nochapters too, so it's not that; sorry I led you astray. Here is a guide to producing an MWE; in short, if you have lots of files and chapters, leave some of them out and see if the problem persists. If it does, try leaving more things out, and so on, until you have something small. – Arun Debray Dec 29 '15 at 17:34
  • I've checked every occurrence of nochapters and am pretty sure that it is not passed to the classicthesis package. If I do pass it, I get the same behavior: Chapters are treated as sections. I get the impression that I am somehow triggering a "bug" in the classicthesis package. – clstaudt Dec 29 '15 at 17:41
  • 1
    Yeah, I was wrong, and nochapters is not the issue. Without some example code, though, it'll be very hard to solve the problem. – Arun Debray Dec 29 '15 at 17:43
  • 3
    I'm voting to close this question as off-topic because the issue was due to erroneous input in a file. – egreg Dec 29 '15 at 18:10
  • @egreg I'm fine with deletion of the question too. – clstaudt Dec 29 '15 at 18:14
  • @clstaudt It doesn't mean it was a bad question, just that it is unlikely to help future readers. You can remove it yourself. – egreg Dec 29 '15 at 18:17

1 Answers1

1

Okay this was something stupid. Deep down in an included file which I didn't write there was this command:

\let\chapter=\section 

Removing this obviously fixed the problem.

clstaudt
  • 1,192
  • 2
  • 11
  • 27