2

I would like to add colour chapter thumb to my code

\documentclass[headsepline,BCOR=10mm,11pt,twoside,openright,cleardoublepage=empty,bibliography=totoc,numbers=noenddot]{scrbook}

\usepackage[activate=.{true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage[paperwidth=17cm,paperheight=24cm,top=2.5cm,bottom=2.5cm,inner=2.0cm,outer=1.5cm]{geometry} 

\usepackage[numbers,comma,square,sort&compress]{natbib}
\usepackage[format=plain,singlelinecheck=false,font={footnotesize,sl},labelfont=bf]{caption}


\makeatletter
\newcommand{\thickhline}{    
\noalign {\ifnum 0=`}\fi \hrule height 1pt
\futurelet \reserved@a \@xhline
}
\makeatother
\newcolumntype{C}[1]{>.{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\let\svthefootnote\thefootnote
%\textheight 1in
\newcommand\blankfootnote[1]{%
 \let\thefootnote\relax\footnotetext{#1}%
\let\thefootnote\svthefootnote%
}
\begin{document}
\input{chapters 1}
 \input{chapters 1}
 \input{chapters 1}
 \input{chapters 1}
\input{chapters 8}
\end{document}

and I just want the side colour box identifying every chapter for the first four chapters; example I don't want it for the eighth one! (I would like that for every chapter the box will move page by page) it's very hard I know, hope we'll find a solution!

EDIT: I would like to have a chapter mark in the margin of every page of different colour, that would be visible when the book it's close. different colours for different chapters, but not for every chapter! I tried to add :

 \usepackage{tikzpagenodes}
  \usepackage{everypage}
  \usepackage{lipsum}
   \usepackage{etoolbox}
   \newtoggle{skippage}
   \togglefalse{skippage}
    \makeatletter
    \patchcmd{\cleardoubleoddstandardpage}%
    {\hbox {}\newpage}%
    {\hbox {}\toggletrue{skippage}\newpage\togglefalse{skippage}}%
    {}{}
    \makeatother
    \AddEverypageHook{%
     \ifnum\value{chapter}<8
    \nottoggle{skippage}{%
   \begin{tikzpicture}[remember picture,overlay]
    \node[fill=blue,text=white] at ([yshift=100pt]current page   marginpar area.center) {\resizebox{!}{1cm}{\thechapter}};
     \end{tikzpicture}% label
     }{}
      \fi
      } b

but it doesn't work, as I could see from your screenshot and yours it is not very close to the margin of the page

2

If I understand correctly you want a chapter mark in the margin of every page, but no marks after a certain chapter. The following MWE uses the tikzpagenodes package to draw the chapter marks and not the chapterthumbs package, because tikzpagenodes seems more robust and easy to use. The solution builds on Positioning of the chapter number in the margin note space. Furthermore the everypage package is used to add the mark to every page. This is conditional on the chapter number using \ifnum\value{chapter}<8, i.e., only print something if the chapter number is less than eight. A possible downside of this approach is that the empty even page at the end of a chapter is also numbered. To prevent this the internal \cleardoubleoddstandardpage macro is patched to set a toggle every time that such an empty page is used, and to print the chapter mark only when this toggle is false.


Edit: a different color for each chapter and more into the margin (left margin for even pages and right margin for odd pages). This uses \colorseries from the xcolor package, if you want to use other colors then you can check the xcolor documentation for alternatives (page 34).

MWE:

\documentclass[headsepline,BCOR=10mm,11pt,twoside,openright,cleardoublepage=empty,bibliography=totoc,numbers=noenddot]{scrbook}
\usepackage{xcolor}
\usepackage{tikzpagenodes}
\definecolorseries{chcolor}{rgb}{grad}[rgb]{.95,.85,.55}{3,11,17}
\resetcolorseries{chcolor}
\usepackage{everypage}
\usepackage{lipsum}
\usepackage{etoolbox}
\newtoggle{skippage}
\togglefalse{skippage}
\makeatletter
\patchcmd{\cleardoubleoddstandardpage}%
{\hbox {}\newpage}%
{\hbox {}\toggletrue{skippage}\newpage\togglefalse{skippage}}%
{}{}
\makeatother
\AddEverypageHook{%
\ifnum\value{chapter}<8
\nottoggle{skippage}{%
\ifnumodd{\thepage}{\def\xsft{45pt}}{\def\xsft{-45pt}}
\begin{tikzpicture}[remember picture,overlay]
\node[fill={chcolor!![\thechapter]},text=white] at ([yshift=100pt,xshift=\xsft]current page marginpar area.center) {\resizebox{!}{1cm}{\thechapter}};
\end{tikzpicture}% label
}{}
\fi
}
\begin{document}
\chapter{First chapter}
\lipsum[1-8]
\chapter{Second chapter}
\lipsum[1-3]
\chapter{Third chapter}
\chapter{Fourth chapter}
\chapter{Fifth chapter}
\chapter{Sixth chapter}
\lipsum[1-6]
\chapter{Seventh chapter}
\chapter{Eighth chapter}
\lipsum[1-3]
\end{document}

Result:

enter image description here

  • I would like to have a chapter mark in the margin of every page of different colour, that would be visible when the book it's close. different colours for different chapters, but not for every chapter! I tried to add : – io_gucci Sep 19 '19 at 8:01
  • @io_gucci see edit. – Marijn Sep 19 '19 at 12:57
  • hi Marijn, thanks so much for your comment, it is exactly how I would like to have and I insert everything in my document and it compile but it doesn't no show up the coloured box.. I cannot understand why – io_gucci Sep 20 '19 at 8:22
  • Could you try to run the code as I have provided in this answer? Paste the answer code into a new document and run that (i.e., don't insert it in your 'real' document). If the code in the answer works but your real document does not work then there is something else in the document that creates a problem. If the answer also doesn't work then there is probably a problem with package versions, the compiler you use, etc. – Marijn Sep 20 '19 at 13:15

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.