[Tex/LaTex] Custom header in classicthesis

classicthesisheader-footer

I am trying to have custom header like this one. I am using classicthesis. I have used fancyhdr but it gives me error. I have also tried this link but no luck. Here is my code.

% **************************************************************************************************************
% A Classic Thesis Style
% An Homage to The Elements of Typographic Style
%
% Copyright (C) 2007 Andr� Miede http://www.miede.de
%
% If you like the style then I would appreciate a postcard. My address 
% can be found in the file ClassicThesis.pdf. A collection of the 
% postcards I received so far is available online at 
% http://postcards.miede.de
%
% License:
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; see the file COPYING.  If not, write to
% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
% **************************************************************************************************************
% Note:
%    * You must not use "u etc. in strings/commands that will be spaced out (use ü or real umlauts instead)
%    * Chapters must be marked with the \myChapter{Foo} command (sorry for the inconvenience at this point)
%    * New enumeration (small caps): \begin{aenumerate} \end{aenumerate}
%    * For margin notes: \graffito{}
%    * Do not use bold fonts in this style, it is designed around them
%    * Use tables as in the examples
%    * See classicthesis-ldpkg.sty for useful commands
% **************************************************************************************************************
% To Do:
%    * support a List of Listings that looks like the other lists
% **************************************************************************************************************
\documentclass[ %twoside,
                openright,titlepage,fleqn,%1headlines,% 
                pointlessnumbers,headinclude,BCOR5mm,%
                %10pt,a4paper,footinclude,cleardoubleempty,abstractoff % <--- obsolete, remove (todo)
                ]{scrreprt}
% ********************************************************************
% KOMA-Script setup (new, see commented line above)
% ********************************************************************
\KOMAoptions{%
    paper=letter,%
    fontsize=12pt,%
    cleardoublepage=empty,%
    footinclude=false,%
    abstract=false%
}



% ********************************************************************
% Development Stuff
% ********************************************************************
%\listfiles
%\usepackage[l2tabu, orthodox, abort]{nag}
%\usepackage[warning, all]{onlyamsmath}

\newcommand{\zerod}{0\textsc{d}\xspace}
\newcommand{\oned}{1\textsc{d}\xspace}

\newcommand{\degree}{\ensuremath{^\circ}}

\usepackage{multirow}
\usepackage{setspace}
\usepackage{lscape}
\usepackage{wrapfig}
\usepackage{enumitem}



% ********************************************************************
% Re-usable information
% ********************************************************************
\newcommand{\myTitle}{Integrating Comments in Video Tutorials\xspace}
\newcommand{\myDegree}{Master of Science\xspace}
\newcommand{\myName}{Samiul Alam Anik\xspace}
\newcommand{\myProf}{Dr. Andrea Bunt\xspace}
\newcommand{\myOtherProf}{Put name here\xspace}
\newcommand{\mySupervisor}{Put name here\xspace}
\newcommand{\myFaculty}{Put data here\xspace}
\newcommand{\myDepartment}{Department of Computer Science\xspace}
\newcommand{\myUni}{\protect{University of Manitoba}\xspace}
\newcommand{\myLocation}{Winnipeg, Manitoba, Canada\xspace}
%\newcommand{\myTime}{December 2011\xspace}
%\newcommand{\myVersion}{Version 1.0\xspace}
%*******************************************************
% Packages with options that might require adjustments
%*******************************************************
\usepackage[latin1]{inputenc} 
\usepackage[ngerman,american]{babel}           
\usepackage[square,numbers]{natbib} 
%*******************************************************
\usepackage{classicthesis-ldpkg} 
\usepackage{fancyhdr}

\fancyfoot{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\rightmark}


%*******************************************************
% Options for classicthesis.sty:
% tocaligned eulerchapternumbers drafting linedheaders listsseparated
% subfig nochapters beramono eulermath parts minionpro pdfspacing
\usepackage[eulerchapternumbers,%drafting, %eulermath,%pdfspacing,parts,%
            subfig,beramono]{classicthesis}
%*******************************************************            
%\usepackage[section,below]{placeins} <--- not everybody wants this
%\usepackage[all]{hypcap} <--- does not work with MiKTeX 2.6
% ********************************************************************
% Language/strings for backrefs (change here, thanks, Lorenzo)
%*******************************************************
%\renewcommand{\backrefnotcitedstring}{\relax}%(Not cited.)
%\renewcommand{\backrefcitedsinglestring}[1]{(Citato a pagina~#1.)}
%\renewcommand{\backrefcitedmultistring}[1]{(Citato alle pagine~#1.)}
%\renewcommand{\backreftwosep}{ e~}
%\renewcommand{\backreflastsep}{ e~}
% ********************************************************************
% Setup and Finetuning
%*******************************************************
\newlength{\abcd} % for ab..z string length calculation
\newcommand{\myfloatalign}{\centering} % how all the floats will be aligned
\setlength{\extrarowheight}{3pt} % increase table row height
\usepackage{titlesec}


\titlespacing*{\section} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}
\setlength{\parindent}{0pt}
\renewcommand{\bottomtitlespace}{0.25\textheight}

%69 char/line in 12pt palantino = 32pica = 360pt

%1:1.8 ratio results in height of 648
\areaset[5mm]{360pt}{723pt} % 648 + 33 head + 42 head \the\footskip

%1:1.618 ratio results in height of 582
%\areaset[5mm]{360pt}{657pt} % 582 + 33 head + 42 head \the\footskip

\setlength{\marginparwidth}{7em}%
\setlength{\marginparsep}{2em}%
\typearea[current]{last}





\usepackage[left=1.25in,
        right= 1.25in,
        top=1in,
        bottom=1in]{geometry}
%%% change description label to italics
\renewcommand{\descriptionlabel}[1]{\hspace*{\labelsep}\textit{#1}}   % spacedlowsmallcaps textit textsc 

% ********************************************************************
% Captions look and feel
%*******************************************************
\captionsetup{format=hang,font=small}
% ********************************************************************
% Where to look for graphics
%*******************************************************
%\graphicspath{{gfx/}{misc/}} % considered harmful according to l2tabu
% ********************************************************************
% Hyperreferences
%*******************************************************
\hypersetup{%
    colorlinks=true, linktocpage=true, pdfstartpage=1, pdfstartview=FitV,%
    breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
    plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
    hypertexnames=true, pdfhighlight=/O,%hyperfootnotes=true,%nesting=true,%frenchlinks,%
    urlcolor=webbrown, linkcolor=RoyalBlue, citecolor=webgreen, %pagecolor=RoyalBlue,%
    % uncomment the following line if you want to have black links (e.g., for printing)
    urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
    pdftitle={\myTitle},%
    pdfauthor={\textcopyright\ \myName, \myUni, \myDepartment},%
    pdfsubject={},%
    pdfkeywords={},%
    pdfcreator={pdfLaTeX},%
    pdfproducer={LaTeX with hyperref and classicthesis}%
}
%********************************************************************
% Hyphenation
%*******************************************************
%\hyphenation{put special hyphenation here}
\hyphenation{con-cern-ed}

% ********************************************************************
% GO!GO!GO! MOVE IT!
%*******************************************************

\begin{document}
\frenchspacing
\raggedbottom
\selectlanguage{american} % american ngerman
%\renewcommand*{\bibname}{new name}
%\setbibpreamble{}
\pagenumbering{roman}
\pagestyle{plain}
%********************************************************************
% Frontmatter
%*******************************************************
%\include{FrontBackmatter/Titlepage}
%\cleardoublepage\include{FrontBackmatter/Dedication}
%\cleardoublepage\include{FrontBackmatter/Abstract}
%\cleardoublepage\include{FrontBackmatter/Publication}
%\cleardoublepage\include{FrontBackmatter/Acknowledgments}
%\pagestyle{scrheadings}
%\cleardoublepage\include{FrontBackmatter/Contents}
%********************************************************************
% Mainmatter
%*******************************************************
\pagenumbering{arabic}
% use \cleardoublepage here to avoid problems with pdfbookmark
\doublespacing
%\onehalfspacing
% \include{Chapters/QualitativeAnalysis}

\include{Chapters/SystemDescription}

\singlespacing
% ********************************************************************
% Backmatter
%*******************************************************
\appendix
\include{Appendix/Appendix}

%********************************************************************
% Other Stuff in the Back
%*******************************************************
\bibliographystyle{plain}
\bibliography{Bibliography} \addcontentsline{toc}{chapter}{\bibname}




%\include{FrontBackmatter/Bibliography}
%\cleardoublepage\include{FrontBackMatter/Colophon}
%\cleardoublepage\include{FrontBackMatter/Declaration}
% ********************************************************************
% Game Over: Restart, Restore or Quit?
%*******************************************************
\end{document}

enter image description here

Best Answer

Note the following.

  • If you use geometry then all the \areaset stuff is pointless, as are the settings of both the class and classicthesis.
  • Neither titlesec nor fancyhdr is recommended for use with KOMA classes. Using them will break various features of the class and cooperating packages.
  • Setting the paragraph indent to zero is not recommended. If you absolutely must do this for some strange reason then use something like parskip but I cannot imagine this being suitable for a thesis.
  • I have no idea where to find classicthesis-ldpkg.

Here's a relatively simple example, derived from a simplified form of the MWE which demonstrates how to use KOMA's scrlayer-scrpage to set up headers and footers of the kind shown in the question.

\usepackage{scrlayer-scrpage}

Actually, the footers aren't shown, but I assume the page number ought not appear in the default place in addition to the header.

headsepline is used in the package options to get the line under the header. \addtokomafont{}{} is used to set the header in italic, rather than oblique, font.

\addtokomafont{pageheadfoot}{\itshape}

The scrheadings page style provided by scrlayer-scrpage is used to create the custom header.

\pagestyle{scrheadings}

Since we are using this option, we need to tell KOMA which sections should create 'marks'. In our case, we want chapters to do this.

\automark[chapter]{chapter}

The header itself is configured using the class and package commands for setting inner, outer and centre headers and footers.

\ihead{\headmark}

\headmark is easier than messing with \leftmark and \rightmark since all our headers are the same. This sets the inner head.

\chead{}

Marking the chapter sets the centre header, so let's get rid of it.

\ohead[\pagemark]{\pagemark}

\pagemark sets the page number in the outer head.

We don't want the centre footer.

\cfoot[]{}

We want to change the format of the chapter number which, by default is just a number, so we add the name of the chapter sections and the colon and space at the end.

\renewcommand*\chaptermarkformat{\chaptername{} \thechapter:\quad}

Here's the result:

Kantian headers

Complete code:

\documentclass[openright,titlepage,fleqn,pointlessnumbers,headinclude,headsepline,BCOR5mm]{scrreprt}
\KOMAoptions{%
    paper=letter,%
    fontsize=12pt,%
    cleardoublepage=empty,%
    footinclude=false,%
    abstract=false,%
}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage}
\areaset[5mm]{360pt}{723pt} % 648 + 33 head + 42 head \the\footskip
\setlength{\marginparwidth}{7em}%
\setlength{\marginparsep}{2em}%
\typearea[current]{last}
\automark[chapter]{chapter}
\ihead{\headmark}
\chead{}
\ohead[\pagemark]{\pagemark}
\cfoot[]{}
\renewcommand*\chaptermarkformat{\chaptername{} \thechapter:\quad}
\pagestyle{scrheadings}
\addtokomafont{pageheadfoot}{\itshape}
\usepackage{kantlipsum}

\begin{document}
\pagenumbering{arabic}
\chapter{Kant}
\kant[1-5]
\section{More Kant}
\kant[6-10]
\section{Yet More Kant}
\kant[11-15]
\chapter{Further Kant}
\kant[16-20]
\end{document}
Related Question