I used the code provided by Gonzalo here
Chapter Title in rotated vertical box at the margin
The problem I have are:
-
I am using
\part
s also to divide my document and the box appear in the part page too which I don't want; -
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
Best Answer
The following works for your MWE with respect to the first problem:
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 usescrbook
or a standard class withclassicthesis
,geometry
etc. If you stick toscrbook
, use Koma Script's facilities to manage page layout, headings etc. If you want to usegeometry
,titlesec
etc., usebook
, for example, so that you don't have competing ways of doing things making for confusion. (Note that in that case, you need to useifthen
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:scrbook
is warning you about the use oftitlesec
and explaining that using it will break stuff:scrbook
is also unhappy here:If you prefer to stick with
scrbook
, you can usexpatch
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 ofclassicthesis
: