0

With the help of this forum i could create a nice logo for my chapter header. I want to replace the Chapter header in the classicthesis template with this. almost everything else is very nice in the template i think. Unfortunately i can nor recreate a MWE that reproduces all of my errors. I was scolded last time to supply a MWE so i tried to create one that at least reproduces my 6 basic problems with this endeavor which i think are all interconnected. I compile with xelatex!

  1. I need to have the possibility to use normal and numberless chapter headers. I defined them in the header and later define :

    \newcommand\mylayout{
    \titlespacing*{\chapter}{-106pt}{40pt}{30pt}
    \titlespacing*{name=\chapter,numberless}{-106pt}{56pt}{30pt}
    }
    

In the document i need to call \mylayout. This seems stupid. Is it possible to globally overwrite classicthesis chapter headers i.e. \titleformat{\chapter} and \titlespacing without changing the sty file?

  1. I want the chapter headers to be all uppercase and the first letter to be bigger. In the classic thesis template i think that the following lines achieve what i want..... However if i change my example above either nothing happens or the code doesn´t work anymore.

    \titleformat{\section}[display]  
    {\relax}{\textsc{\MakeTextLowercase{\thesection}\qquad#1}}{1em}{\spacedlowsmallcaps }
    

Basically i want the same behavior for my Chapter headers as i do for my section headings but i want the text to be in bigger capital letters and the First one should be bigger than all the others in the Chapter header.

  1. Currently all my \section headers/names as they are defined in the classic thesis sty file disappear and only the \section number is visible.
  2. The height of the Chapter names are not right. they should obviously be centered with the "custom box" ( i will link to the corresponding thread). I need to compile very often until the positions of the Chapter names and numbers do not move anymore? What is not reproduced in the MWE is the fact that in my real document only the first chapter is at the specified height all the following chapters have an additional offset.
  3. For the TOC and the Bib i actualy do not want the special box. Currently i created a % DIRTY WORKAROUND TO REMOVE BOX FOR TOC that is marked in the text. Is threre a way to simply create an additional custom command to create a Chapter header without the box?

  4. Currently i get the following error:

    Package scrlayer Error: cannot define `\newpagestyle'. }
    

I think this is due to the position of \usepackage[explicit]{titlesec} If i change the position of it the complete code fails. One particular problem seems to be the \setlength{\textwidth}....... pieces. But i need the document with exactly those dimensions!

Here is the "MWE". It is quite long but if i exclude some of the stuff i do not reproduce the actual problem. The title page for example changes the behavior:

            %!TEX TS-program = xelatex
            \documentclass[
            twoside,
                a4paper,
                footinclude=true,
                headinclude=true
            ]{scrbook}
            \KOMAoptions{fontsize=11pt}
            \usepackage{lipsum}
            \usepackage[explicit]{titlesec} % If use titlesec here, i get: Package scrlayer Error: cannot define `\newpagestyle'. }
            \usepackage[
            dottedtoc,
            floatperchapter,
            parts
            ]{classicthesis}
            %\usepackage[explicit]{titlesec} % if i use titlesec here everything is messed up
            \setlength{\textwidth}{146.8mm} 
            \setlength{\oddsidemargin}{11.6mm} 
            \setlength{\evensidemargin}{0.8mm} 
            \setlength{\topmargin}{-2.2mm} 
            \setlength{\textheight}{221.9mm} 
            \setlength{\headheight}{14pt}

            \usepackage{tikz}
            \usetikzlibrary{external}
            \usetikzlibrary{calc}
            \usepackage{xcolor}
            \usepackage{color}
            \usetikzlibrary{intersections}

            \newcommand{\mytemplatecolor}{black}
            \newcommand{\mylogocolor}{white}
            \newcommand{\mychapterlabelcolor}{white}
            \newcommand{\mychapterboxcolortoc}{white}
            \newcommand{\mychapterboxcolor}{\mytemplatecolor}

            % FANCY CHAPTER HEADERS

            \newsavebox{\logo}
            \savebox{\logo}{%
                    \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
                    \path[draw=\mylogocolor,fill=\mylogocolor,line join=miter,line cap=round,miter
                    limit=4.00,nonzero rule,dash phase=3.000pt,line width=0.000pt]
                    (178.4915,651.0411) .. controls (178.0358,651.0411) and (177.5801,651.0411) ..
                    (177.1244,651.0411) .. controls (177.1244,652.6787) and (177.1244,654.3163) ..
                    (177.1244,655.9539) .. controls (177.5801,655.9539) and (178.0358,655.9539) ..
                    (178.4915,655.9539) .. controls (178.4915,654.3163) and (178.4915,652.6787) ..
                    (178.4915,651.0411) -- cycle;
                    \path[xscale=-1.000,yscale=1.000,draw=\mylogocolor,fill=\mylogocolor,line join=miter,line
                    cap=round,miter limit=4.00,nonzero rule,dash phase=3.000pt,line
                    width=0.000pt,rounded corners=0.0000cm] (-182.0794,658.5070) rectangle
                    (-177.1244,660.6401);
                    \path[xscale=-1.000,yscale=1.000,draw=\mylogocolor,fill=\mylogocolor,line join=miter,line
                    cap=round,nonzero rule,dash phase=3.000pt,line width=0.000pt,rounded
                    corners=0.0000cm] (-280.8165,679.2454) rectangle (-193.6939,684.6964);
                    \path[xscale=-1.000,yscale=1.000,fill=\mylogocolor,nonzero rule,rounded
                    corners=0.0000cm] (-280.8165,694.2955) rectangle (-177.1245,696.3244);
                    \path[xscale=-1.000,yscale=1.000,draw=\mylogocolor,fill=\mylogocolor,line join=miter,line
                    cap=round,miter limit=4.00,nonzero rule,dash phase=3.000pt,line
                    width=0.000pt,rounded corners=0.0000cm] (-280.8165,716.4833) rectangle
                    (-177.1245,721.9073);
                    \path[xscale=-1.000,yscale=1.000,draw=\mylogocolor,fill=\mylogocolor,line join=miter,line
                    cap=round,nonzero rule,dash phase=3.000pt,line width=0.000pt,rounded
                    corners=0.0000cm] (-185.6345,669.1724) rectangle (-177.1244,673.9126);
                    \end{tikzpicture}}


             %  titlesec with option explicit is needed here
            % Chapter
             \newcommand*\chapterlabel{}
            \titleformat{\chapter}[display]  
            {\Huge\bfseries\sffamily\color{\mytemplatecolor}}
            {\gdef\chapterlabel{\thechapter\ }}    
            {0pt} % separation between label and chapter-title
            {\begin{tikzpicture}[remember picture,overlay]
                    \node[yshift=-8cm,xshift=0cm] at (current page.north west)
                    {\begin{tikzpicture}[remember picture, overlay]
                            \path[name path=mainbox,fill=\mytemplatecolor,\mytemplatecolor] (0,0)        rectangle (35.5mm,15mm);% mainbox
                            \node[line width=0pt, above right=0mm, draw=none, inner sep=0pt] at (0,0) {\resizebox{!}{15mm}{\usebox{\logo}}};
                            \node[anchor=north east,yshift=-7.2cm,xshift=34mm,minimum height=30mm,inner sep=0mm] at (current page.north west)
                            {\parbox[top][30mm][t]{15mm}{\raggedleft $\phantom{\textrm{l}}$\color{white}\chapterlabel}};  
                            \node[anchor=north west,yshift=-7.2cm,xshift=37mm,text     width=\textwidth,minimum height=30mm,inner sep=0mm] at (current page.north west)
                            {\parbox[top][30mm][t]{\textwidth}{\color{\mytemplatecolor}#1}};
                            \end{tikzpicture}
                    };
                    \gdef\chapterlabel{} % code before the title body
            \end{tikzpicture}
            }
            \titleformat{name=\chapter,numberless}[display]
            {\Huge\bfseries\sffamily\color{\mytemplatecolor}}
            {\gdef\chapterlabel{\thechapter\ }}  
            {0pt} % separation between label and chapter-title
            {\begin{tikzpicture}[remember picture,overlay]
            \node[yshift=-8cm,xshift=0cm] at (current page.north west)
            {\begin{tikzpicture}[remember picture, overlay]
                    \path[name path=mainbox,fill=\mychapterboxcolor,\mychapterboxcolor] (0,0)        rectangle (35.5mm,15mm);% mainbox
                    \node[line width=0pt, above right=0mm, draw=none, inner sep=0pt] at (0,0) {\resizebox{!}{15mm}{\usebox{\logo}}};
                    \node[anchor=north east,yshift=-7.2cm,xshift=34mm,minimum height=30mm,inner sep=0mm] at (current page.north west)
                    {\parbox[top][30mm][t]{15mm}{\raggedleft $\phantom{\textrm{l}}$}
                    };
                    \node[anchor=north west,yshift=-7.2cm,xshift=37mm,text     width=\textwidth,minimum height=30mm,inner sep=0mm] at (current page.north west)
                    {\parbox[top][30mm][t]{\textwidth}{\color{\mychapterboxcolor}#1}};
                    %{\parbox[top][30mm][t]{\textwidth}{\color{white}#1}};
                    \end{tikzpicture}
            };
            \gdef\chapterlabel{} % code before the title body
            \end{tikzpicture}
            }


            \newcommand\mylayout{
            \titlespacing*{\chapter}{-106pt}{40pt}{30pt}
            \titlespacing*{name=\chapter,numberless}{-106pt}{56pt}{30pt}
            }



            % FANCY CHAPTER HEADERS END!

            \begin{document}
            \mylayout
            \frontmatter
            \begin{titlepage}
                    % if you want the titlepage to be centered, uncomment and fine-tune the line below (KOMA classes environment)
                    %\begin{addmargin}[-1cm]{-3cm}
                    \begin{center}
                            \large
                            \begingroup
                            \spacedlowsmallcaps{A Thesis}
                            \endgroup
                            \hfill
                            \vfill
                            \begingroup
                            A dissertation submitted to the\\
                            \spacedlowsmallcaps{Institute of riding Lighnings}
                            \endgroup
                            \vfill
                            \begingroup
                            for the degree of\\
                            \spacedlowsmallcaps{Master of puppets}
                            \endgroup
                            \vfill
                            \begingroup
                            accepted on the recommendation of\\
                            Prof.\ Dr.\ Lars U.\\
                            Prof.\ Dr.\ James H., co-examiner\\
                            Prof.\ Dr.\ Kirk H., co-examiner
                            \endgroup
                            \vfill
                    \end{center}     
            \end{titlepage}

            % DIRTY WORKAROUND TO REMOVE BOX FOR TOC 
            \begingroup
            \renewcommand*{\contentsname}{Table of contents}%
            \renewcommand*\chapterlabel{}
            \titleformat{name=\chapter,numberless}[display]  
            {\Huge\bfseries\sffamily\color{\mytemplatecolor}}
            {\gdef\chapterlabel{\thechapter\ }}         
            {0pt} % separation between label and chapter-title
            {\begin{tikzpicture}[remember picture,overlay]
                    \node[yshift=-8cm,xshift=0cm] at (current page.north west)
                    {\begin{tikzpicture}[remember picture, overlay]
                            \path[name path=mainbox,fill=\mychapterboxcolortoc,\mychapterboxcolortoc] (0,0)        rectangle (35.5mm,15mm);% mainbox
                            \node[line width=0pt, above right=0mm, draw=none, inner sep=0pt] at (0,0) {\resizebox{!}{15mm}{\usebox{\logo}}};
                            \node[anchor=north east,yshift=-7.2cm,xshift=34mm,minimum height=30mm,inner sep=0mm] at (current page.north west)
                            {\parbox[top][30mm][t]{15mm}{\raggedleft $\phantom{\textrm{l}}$}
                            };  
                            \node[anchor=north west,yshift=-7.2cm,xshift=37mm,text     width=\textwidth,minimum height=30mm,inner sep=0mm] at (current page.north west)
                            {\parbox[top][30mm][t]{\textwidth}{\color{\mychapterboxcolor}#1}};
                            %{\parbox[top][30mm][t]{\textwidth}{\color{white}#1}};
                            \end{tikzpicture}
                    };
                    \gdef\chapterlabel{} % code before the title body
            \end{tikzpicture}
            }
            \titlespacing{name=\chapter,numberless}{-106pt}{140pt}{-160pt}

            \tableofcontents
            \addcontentsline{toc}{chapter}{Table of contents}
            \cleardoublepage
            \phantomsection
            \addcontentsline{toc}{chapter}{List of figures} 
            \listoffigures\thispagestyle{plain}
            \endgroup
            % DIRTY WORKAROUND TO REMOVE BOX FOR TOC END!
            \mainmatter
            \mylayout
            \chapter{Methods}
            \lipsum[1]
            \section{section names are gone}
            Somehow the section names disappear?
            \par
            \lipsum[1]
            \section{section names are gone too}
            \lipsum[2]
            \lipsum[1]
            \chapter{More Results}
            \lipsum[1]
            \lipsum[2]
            \chapter{Even More Results}
            \lipsum[1]
            \section{section names are gone}
            Somehow the section names disappear?
            \par
            \lipsum[1]
            \section{section names are gone too}
            \lipsum[2]
            \lipsum[1]
            \chapter*{Numberless Results}
            \lipsum[1]
            \end{document}

Here is the link to one solution and my original Ticks question Solution section with first letter big capital Ticks question

  • 1
    One of the problems with classicthesis is that is is based on the KOMA class, but uses titlesec, and titlesec is more or less incompatible with KOMA. Also, this is a lot of questions to ask at one time. – Alan Munn Jul 31 '17 at 22:00
  • Regarding point 1: what prevents you from simply making the \titlespacing declarations in the preamble, without wrapping them inside the \mylayout macro? – Michael Palmer Jul 31 '17 at 22:40
  • Another question: If you want to redesign the chapter and section headings so extensively, what exactly does classicthesis do for you that makes you want to put up with it? It might be easier to just ditch it. You are already using titlesec. Add in the geometry and fancyhdr packages as well as some font packages, and you can get pretty much any appearance you want. Alternatively, try the KOMA or memoir classes. – Michael Palmer Jul 31 '17 at 22:47
  • I wouldn't use classicthesis here – Johannes_B Aug 1 '17 at 6:03
  • I understand that this are a lot of questions but if i really thought they are connected. I would happily ditch classic thesis, but i do not know how to recreate what it offers me and many documents in my work-group are written using it. For example: I like how equations look. I like the standard font the section headers etc.. and the overall look. I wouldn´t really know how to recreate all of this. Is there no way to simply change the Chapter headers globally and create the three cases ( normal with box, numberless with box, no box at all) i discribed above? – NorrinRadd Aug 1 '17 at 7:21
0

Many things happening. One thing at a time, though.

There is a way to add a picture to classicthesis chapter headings.

Because the classicthesis package already calls titlesec internally, there is no need to call it again (and also we need to keep intact everything else classicthesis is doing with titlesec).

There are two \titleformats in classicthesis for chapters, one for lined headings, the other not.

Probably the best place to insert a chapter logo/picture (a "device") using\titleformat would be at the end of its <after-code> parameter,

generically:

\titleformat{\chapter}[display]
    {<format>}
    {<label>}
    {<sep>}
    {<before-code>}
    [<after-code>]

and, because it is a TikZ picture, we will adjust its position relative to its anchor point with the usual yshift= xshift=, to get:

Chapter with logo

(I replaced the original complex logo code with a much simpler, and working, random example from the TikZ questions on this site (with colours added, so it looks reminiscent of a cubic crystal structure), and I also removed all the page layout adjustments to get a cleaner testbed. Adjust them all back again as required.)

Because the two chapter styles have different layouts, the tikz yshift= xshift= will be different for each of them. We'll just use one chapter style as demonstration.

We'll store the tikz picture in a macro,\chaptikz, which will be fed one parameter, the text current, for the page anchor, when on the current page at the actual time when the chapter is being typeset and the page is being assembled.

\newcommand\chaptikz[1]{
      \begin{tikzpicture}[remember picture,overlay]
       \node
        at (#1 page.north west) {A};
    \usebox{\logo}
      \end{tikzpicture}%
  }

The command will be used like this:

\chaptikz{current}

Now, to not print the logo image for un-numbered \chapter*s, we will need a new IF of some sort, to act as a switch. There are various ways of doing this. A rudimentary way is literally with a newif.

\newif\ifmystar

Using the IF can be like this:

\ifmystar\else{\chaptikz{current}}\fi

If the star is on (it is a starred chapter (or toc)), do nothing, \else do our logo.

Logo-on with a \mystarfalse, and logo-off with a \mystartrue.

        \mystartrue
        \chapter*{Numberless Results}
        \mystarfalse

no logo starred chapter

Also, the table of contents, and the list of figures, are chapter-like objects, so it would be handy to switch off the logo for them too.

\mystartrue
            \tableofcontents
            \listoffigures
\mystarfalse

The titleformat code ends up as:

    \titleformat{\chapter}[display]%
    {\relax}%
    {\mbox{}\oldmarginpar{\vspace*{-3\baselineskip}\color{CTsemi}\chapterNumber\thechapter}}{0pt}%
    {\raggedright\spacedallcaps}%
[\normalsize\vspace*{.8\baselineskip}\titlerule\ifmystar\else{\chaptikz{current}}\fi]%

MWE

 %!TEX TS-program = xelatex
            \documentclass[
            twoside,
                a4paper,
                footinclude=true,
                headinclude=true
            ]{scrbook}
            \KOMAoptions{fontsize=11pt}
            \usepackage{lipsum}
%            \usepackage[explicit]{titlesec} % If use titlesec here, i get: Package scrlayer Error: cannot define `\newpagestyle'. }
            \usepackage[
            dottedtoc,
            floatperchapter,
            parts,
%            linedheaders,
            ]{classicthesis}

            \usepackage{tikz}
            \usetikzlibrary{external}
            \usetikzlibrary{calc}
            \usepackage{xcolor}
            \usetikzlibrary{intersections}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}

            \newcommand{\mytemplatecolor}{blue}
            \newcommand{\mylogocolor}{yellow!32}
            \newcommand{\mychapterlabelcolor}{green}
            \newcommand{\mychapterboxcolortoc}{violet}
            \newcommand{\mychapterboxcolor}{\mytemplatecolor}

            \newsavebox{\logo}
            \savebox{\logo}{%
 \begin{tikzpicture}[scale=0.8,remember picture,overlay,yshift=5.5em,xshift=16em]
\tikzstyle{v}=[circle, minimum size=2mm,inner sep=0pt,draw,violet,fill=yellow]
\foreach \i in {1,...,8}
\foreach \j in {1,...,3}
\node[v]
(G-\i-\j) at (\i,\j) {};
\foreach \i in {1,...,8}
\foreach \j/\o in {1/2,2/3}
\draw[->, green]
(G-\i-\j) -- (G-\i-\o);
\foreach \i/\n in
{1/2,2/3,3/4,4/5,5/6,6/7,7/8}
\foreach \j/\o in {1/2,2/3} {
\draw[->,blue,thick] (G-\i-\j) -- (G-\n-\o);
\draw[->,red] (G-\n-\j) -- (G-\i-\o);
}
\end{tikzpicture}
}




\newcommand\chaptikz[1]{
             \begin{tikzpicture}[remember picture,overlay]
                    \node
                     at (#1 page.north west) {A};
                        \usebox{\logo}
            \end{tikzpicture}%
            }

%%\titleformat{<command>}[<shape>]
%   {<format>}
%   {<label>}
%   {<sep>}
%   {<before-code>}
%   [<after-code>]

%lined headers:
%    \titleformat{\chapter}[display]%
%    {\relax}%
%    {\raggedleft{\color{CTsemi}\chapterNumber\thechapter} \\ }%
%    {0pt}%
%    {\titlerule\vspace*{.9\baselineskip}\raggedright\spacedallcaps}%
%    [\normalsize\vspace*{.8\baselineskip}\titlerule\chaptikz{current}]%

\newif\ifmystar
\mystarfalse

    \titleformat{\chapter}[display]%
    {\relax}{\mbox{}\oldmarginpar{\vspace*{-3\baselineskip}\color{CTsemi}\chapterNumber\thechapter}}{0pt}%
    {\raggedright\spacedallcaps}[\normalsize\vspace*{.8\baselineskip}\titlerule\ifmystar\else{\chaptikz{current}}\fi]%


            \begin{document}
            \frontmatter
            \begin{titlepage}
                    \begin{center}
                            \large
                            \begingroup
                            \spacedlowsmallcaps{A Thesis}
                            \endgroup
                            \hfill
                            \vfill
                            \begingroup
                            A dissertation submitted to the\\
                            \spacedlowsmallcaps{Institute of Riding Lightning}
                            \endgroup
                            \vfill
                            \begingroup
                            for the degree of\\
                            \spacedlowsmallcaps{MP -- Master of Puppets}
                            \endgroup
                            \vfill
                            \begingroup
                            accepted on the recommendation of\\
                            Prof.\ Dr.\ XXX.\\
                            Prof.\ Dr.\ YYY., co-examiner\\
                            Prof.\ Dr.\ ZZZ H., co-examiner
                            \endgroup
                            \vfill
                    \end{center}     
            \end{titlepage}



\mystartrue
            \tableofcontents
            \listoffigures
\mystarfalse
            \mainmatter
            \chapter{Methods}
             qwerty
%             \chaptikz{current}
 <<<<<<<<<<<<<<<<<<<<
           \section{Section}
            Somehow the section names are section names.
            \par
            \lipsum[1]
            \section{Another Section}
            \lipsum[2]
            \lipsum[1]
            \chapter{More Results}
            \lipsum[1]
            \lipsum[2]
            \chapter{Even More Results}
            \lipsum[1]
            \mystartrue
            \chapter*{Numberless Results}
            \ifmystar{tr}\else{F}\fi \\ \lipsum[1]
            \mystarfalse
            \chapter{And Conclusion}
            \lipsum[1]            
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.