[Tex/LaTex] Unwanted title box on first page of a part

boxeschaptersmarginsparts

I used the code provided by Gonzalo here

Chapter Title in rotated vertical box at the margin

The problem I have are:

  1. I am using \parts also to divide my document and the box appear in the part page too which I don't want;

  2. When I compile I got a series of overfull warnings
    Overfull \hbox (7.58957pt too wide) has occurred while \output is active
    [][]\T1/mdbch/m/fsc/24.88 5[]
    []

I am using a b5 layout. Here is a version that can be reproduced

\documentclass[openright,titlepage,numbers=enddot,headinclude=true,footinclude=true,fontsize=10pt,paper=b5,10pt,headinclude, footinclude=true]{scrbook}

\usepackage[parts,linedheaders,pdfspacing,dottedtoc,eulerchapternumbers,manychapters,listings]{classicthesis}
\usepackage[b5paper,layout=b5paper]{geometry}

\usepackage{lipsum}
\usepackage{background}
\usetikzlibrary{calc}
\usepackage{ifthen}

% background common settings
\SetBgScale{1}
\SetBgAngle{0}
\SetBgOpacity{1}
\SetBgContents{}

% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}

\newcounter{chapNum}

% the list of colors to be used (add more if needed)
%\newcommand\BoxColor{%
  %\ifcase\thechapshift blue!30\or red!30\or olive!30\or magenta!30\else yellow!30\fi}
 %\ifcase\thechapshift black!80 \else black!80 \fi}
% the main command; the mandatory argument sets the color of the vertical box
\makeatletter
\newcommand\ChapFrame{%
\AddEverypageHook{%
\ifthenelse{\isodd{\thepage}}
{\SetBgContents{%
  \begin{tikzpicture}[overlay,remember picture]
  \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north east] 
  at ($ (current page.north east) + (-0.0cm,-2*\thechapshift cm) $) 
  {{\parbox[c][1.0cm][t]{0.2cm}{%
    \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}}%
}
{\SetBgContents{%
  \begin{tikzpicture}[overlay,remember picture]
  \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north west] 
  at ($ (current page.north west) + (+0.0cm,-2*\thechapshift cm) $) 
  {{\parbox[c][1.0cm][t]{0.2cm}{%
    \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}}
}
\bg@material}%
  \stepcounter{chapshift}
  \stepcounter{chapNum}
}
\makeatother

\begin{document}
\part{Pluto}
\chapter{Topolino}
\ChapFrame
\lipsum
\chapter{Minnie}
\ChapFrame
\lipsum
\part{Pippo}
\chapter{Gambadilegno}
\ChapFrame
\lipsum

\end{document}

I don't want the box in the part pages

enter image description here

Best Answer

The following works for your MWE with respect to the first problem:

\documentclass[openright,titlepage,numbers=enddot,headinclude=true,footinclude=true,fontsize=10pt,paper=b5]{scrbook}

\usepackage[parts,linedheaders,pdfspacing,dottedtoc,eulerchapternumbers,manychapters,listings]{classicthesis}
\usepackage[b5paper]{geometry}

\usepackage{lipsum}
\usepackage{tikz,everypage}
\usetikzlibrary{calc}

\newcounter{chapshift}
\addtocounter{chapshift}{-1}

\newcounter{chapNum}

\newcommand*\MyOddChapFrame{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north east]
    at ($ (current page.north east) + (-0.0cm,-2*\thechapshift cm) $)
    {{\parbox[c][1.0cm][t]{0.2cm}{%
          \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}%
}
\newcommand*\MyEvenChapFrame{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north west]
    at ($ (current page.north west) + (+0.0cm,-2*\thechapshift cm) $)
    {{\parbox[c][1.0cm][t]{0.2cm}{%
          \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}%
}
\makeatletter
\newcommand\ChapFrame{%
  \let\MyOddFrame\MyOddChapFrame
  \let\MyEvenFrame\MyEvenChapFrame
  \AddEverypageHook{%
    \ifthispageodd
    {\MyOddFrame}
    {\MyEvenFrame}
  }%
  \stepcounter{chapshift}
  \stepcounter{chapNum}
}
\titleformat{\part}[display]{%
  \normalfont\centering\large}{%
  \thispagestyle{empty}\partname~\MakeTextUppercase{\thepart}}{1em}{%
  \color{Maroon}\spacedallcaps}[\bigskip\normalfont\normalsize\color{Black}\begin{quote}\ct@parttext\end{quote}\global\let\MyOddFrame\relax\global\let\MyEvenFrame\relax]
\makeatother

\begin{document}
  \part{Pluto}
  \chapter{Topolino}
  \ChapFrame
  \lipsum
  \chapter{Minnie}
  \ChapFrame
  \lipsum
  \part{Pippo}
  \chapter{Gambadilegno}
  \ChapFrame
  \lipsum

\end{document}

no number for parts

I have not investigated the second problem because I think it would be much better to rethink your approach. If you look at the output, you will see that complaints about over/under full boxes are only some of the warnings you get. In addition, you are getting lots of warnings from scrbook because you are trampling heavily over its attempts to lay out your pages. I think you should decide whether you want to use scrbook or a standard class with classicthesis, geometry etc. If you stick to scrbook, use Koma Script's facilities to manage page layout, headings etc. If you want to use geometry, titlesec etc., use book, for example, so that you don't have competing ways of doing things making for confusion. (Note that in that case, you need to use ifthen and change the code back to the original for checking whether you are on an odd page.)

Here is a sample of the messages you should be looking at. typearea is complaining that you've made the page bigger than the paper:

Package typearea Warning: page content and margins higher than paper.
(typearea)                This may result in page footer out of paper.
(typearea)                You should decrease DIV, decrease foot height,
(typearea)                or decreate height of text area.

scrbook is warning you about the use of titlesec and explaining that using it will break stuff:

Class scrbook Warning: Usage of package `titlesec' together
(scrbook)              with a KOMA-Script class is not recommended.
(scrbook)              I'd suggest to use the package only
(scrbook)              if you really need it, because it breaks several
(scrbook)              KOMA-Script features, i.e., option `headings' and
(scrbook)              the extended optional argument of the section
(scrbook)              commands .
(scrbook)              Nevertheless, using requested
(scrbook)              package `titlesec' on input line 373.

scrbook is also unhappy here:

Class scrbook Warning: \float@addtolists detected!
(scrbook)              Implementation of \float@addtolist became
(scrbook)              deprecated in KOMA-Script v3.01 2008/11/14 and
(scrbook)              has been replaced by more several more flexible
(scrbook)              features of package `tocbasic`.
(scrbook)              Since Version 3.12 support for deprecated
(scrbook)              \float@addtolist interface has been
(scrbook)              restricted to only some of the KOMA-Script
(scrbook)              features and been removed from others.
(scrbook)              Loading of package `scrhack' may help to
(scrbook)              avoid this warning, if you are using a
(scrbook)              a package that still implements the
(scrbook)              deprecated \float@addtolist interface .

If you prefer to stick with scrbook, you can use xpatch to patch the \part command to control the display of the thumb tabs. I've also included a few examples of commands to configure the fonts etc. See the class documentation for the options you'd want to emulate the relevant aspects of classicthesis:

\documentclass[openright,titlepage,numbers=enddot,fontsize=10pt,paper=b5]{scrbook}

\usepackage{lipsum}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,everypage,xpatch}
\usetikzlibrary{calc}

\newcounter{chapshift}
\addtocounter{chapshift}{-1}

\newcounter{chapNum}

\newcommand*\MyOddChapFrame{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north east]
    at ($ (current page.north east) + (-0.0cm,-2*\thechapshift cm) $)
    {{\parbox[c][1.0cm][t]{0.2cm}{%
          \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}%
}
\newcommand*\MyEvenChapFrame{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[fill=black!80,inner sep=0pt,rectangle,text width=1.3cm,
    text height=1.4cm,align=center,anchor=north west]
    at ($ (current page.north west) + (+0.0cm,-2*\thechapshift cm) $)
    {{\parbox[c][1.0cm][t]{0.2cm}{%
          \Huge\textcolor{white}{\scshape\thechapNum}}}};
  \end{tikzpicture}%
}
\makeatletter
\newcommand\ChapFrame{%
  \let\MyOddFrame\MyOddChapFrame
  \let\MyEvenFrame\MyEvenChapFrame
  \AddEverypageHook{%
    \ifthispageodd
    {\MyOddFrame}
    {\MyEvenFrame}
  }%
  \stepcounter{chapshift}
  \stepcounter{chapNum}
}
\xpatchcmd{\part}{\thispagestyle{\partpagestyle}}{\thispagestyle{\partpagestyle}\global\let\MyOddFrame\relax\global\let\MyEvenFrame\relax}{\typeout{Successfully patched part code.}}{\typeout{Oh, dear! Failed to patch part code.}}
\makeatother
\pagestyle{headings}
\renewcommand*\partpagestyle{empty}
\renewcommand*\chapterpagestyle{plain}
\setkomafont{part}{\normalfont\large\color{Maroon}}
\setkomafont{partnumber}{\normalfont\large}
\setkomafont{chapter}{\normalfont\normalsize\bfseries}

\begin{document}
  \part{Pluto}
  \chapter{Topolino}
  \ChapFrame
  \lipsum
  \chapter{Minnie}
  \ChapFrame
  \lipsum
  \part{Pippo}
  \chapter{Gambadilegno}
  \ChapFrame
  \lipsum

\end{document}
Related Question