Remove gray chapter number boxes on chapter title page












0















I have successfully added a grey box (given minor revision) in the margin of each page with the number of the chapter using the code from "Show current chapter number on each page margin".
I'm trying to remove the chapter number boxes from the first page of every chapter, e.g. as discussed in "Edit box with current chapter number on each page margin".



However, in the latter post, I cannot find the piece of code responsible for this 'first page chapter' box deletion.
If tried by adding the makeatletter and makeatother parts, but see no changes in the output. also cleartooddpage[thispagestyle{empty}] does not work.



Below you can find my code. Any suggestions?



documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
linespread{1.1}
usepackage[
paperwidth=170mm,
paperheight=240mm,
top=2.5cm, bottom=3cm,
inner=30mm, outer=25mm,
heightrounded=true
]{geometry}

% Gray boxes for chapter numbering on pages
usepackage[contents={},opacity=1,scale=1,color=white]{background}
usepackage{tikzpagenodes}
usepackage{totcount}
usetikzlibrary{calc}

newififMaterial

newlengthLabelSize
setlengthLabelSize{2.5cm}
AtBeginDocument{%
regtotcounter{chapter}
%setlengthLabelSize{dimexprtextheight/totvalue{chapter}relax}
% Line above commented out as this line of code resulted in "results out of range"
ifdimLabelSize>2.5cmrelax
globalsetlengthLabelSize{2.5cm}
fi
}

newcommandAddLabels{%
Materialtrue%
AddEverypageHook{%
ifMaterial%
ifoddvalue{page} %
backgroundsetup{
angle=90, position={current page.east|-current page text area.north east},
vshift=8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
else
backgroundsetup{
angle=90, position={current page.west|-current page text area.north west},
vshift=-8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
fi
BgMaterial%
elserelaxfi}%
}


newcommandRemoveLabels{Materialfalse}









share|improve this question


















  • 2





    Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

    – Steven B. Segletes
    Jan 7 at 15:20
















0















I have successfully added a grey box (given minor revision) in the margin of each page with the number of the chapter using the code from "Show current chapter number on each page margin".
I'm trying to remove the chapter number boxes from the first page of every chapter, e.g. as discussed in "Edit box with current chapter number on each page margin".



However, in the latter post, I cannot find the piece of code responsible for this 'first page chapter' box deletion.
If tried by adding the makeatletter and makeatother parts, but see no changes in the output. also cleartooddpage[thispagestyle{empty}] does not work.



Below you can find my code. Any suggestions?



documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
linespread{1.1}
usepackage[
paperwidth=170mm,
paperheight=240mm,
top=2.5cm, bottom=3cm,
inner=30mm, outer=25mm,
heightrounded=true
]{geometry}

% Gray boxes for chapter numbering on pages
usepackage[contents={},opacity=1,scale=1,color=white]{background}
usepackage{tikzpagenodes}
usepackage{totcount}
usetikzlibrary{calc}

newififMaterial

newlengthLabelSize
setlengthLabelSize{2.5cm}
AtBeginDocument{%
regtotcounter{chapter}
%setlengthLabelSize{dimexprtextheight/totvalue{chapter}relax}
% Line above commented out as this line of code resulted in "results out of range"
ifdimLabelSize>2.5cmrelax
globalsetlengthLabelSize{2.5cm}
fi
}

newcommandAddLabels{%
Materialtrue%
AddEverypageHook{%
ifMaterial%
ifoddvalue{page} %
backgroundsetup{
angle=90, position={current page.east|-current page text area.north east},
vshift=8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
else
backgroundsetup{
angle=90, position={current page.west|-current page text area.north west},
vshift=-8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
fi
BgMaterial%
elserelaxfi}%
}


newcommandRemoveLabels{Materialfalse}









share|improve this question


















  • 2





    Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

    – Steven B. Segletes
    Jan 7 at 15:20














0












0








0








I have successfully added a grey box (given minor revision) in the margin of each page with the number of the chapter using the code from "Show current chapter number on each page margin".
I'm trying to remove the chapter number boxes from the first page of every chapter, e.g. as discussed in "Edit box with current chapter number on each page margin".



However, in the latter post, I cannot find the piece of code responsible for this 'first page chapter' box deletion.
If tried by adding the makeatletter and makeatother parts, but see no changes in the output. also cleartooddpage[thispagestyle{empty}] does not work.



Below you can find my code. Any suggestions?



documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
linespread{1.1}
usepackage[
paperwidth=170mm,
paperheight=240mm,
top=2.5cm, bottom=3cm,
inner=30mm, outer=25mm,
heightrounded=true
]{geometry}

% Gray boxes for chapter numbering on pages
usepackage[contents={},opacity=1,scale=1,color=white]{background}
usepackage{tikzpagenodes}
usepackage{totcount}
usetikzlibrary{calc}

newififMaterial

newlengthLabelSize
setlengthLabelSize{2.5cm}
AtBeginDocument{%
regtotcounter{chapter}
%setlengthLabelSize{dimexprtextheight/totvalue{chapter}relax}
% Line above commented out as this line of code resulted in "results out of range"
ifdimLabelSize>2.5cmrelax
globalsetlengthLabelSize{2.5cm}
fi
}

newcommandAddLabels{%
Materialtrue%
AddEverypageHook{%
ifMaterial%
ifoddvalue{page} %
backgroundsetup{
angle=90, position={current page.east|-current page text area.north east},
vshift=8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
else
backgroundsetup{
angle=90, position={current page.west|-current page text area.north west},
vshift=-8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
fi
BgMaterial%
elserelaxfi}%
}


newcommandRemoveLabels{Materialfalse}









share|improve this question














I have successfully added a grey box (given minor revision) in the margin of each page with the number of the chapter using the code from "Show current chapter number on each page margin".
I'm trying to remove the chapter number boxes from the first page of every chapter, e.g. as discussed in "Edit box with current chapter number on each page margin".



However, in the latter post, I cannot find the piece of code responsible for this 'first page chapter' box deletion.
If tried by adding the makeatletter and makeatother parts, but see no changes in the output. also cleartooddpage[thispagestyle{empty}] does not work.



Below you can find my code. Any suggestions?



documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
linespread{1.1}
usepackage[
paperwidth=170mm,
paperheight=240mm,
top=2.5cm, bottom=3cm,
inner=30mm, outer=25mm,
heightrounded=true
]{geometry}

% Gray boxes for chapter numbering on pages
usepackage[contents={},opacity=1,scale=1,color=white]{background}
usepackage{tikzpagenodes}
usepackage{totcount}
usetikzlibrary{calc}

newififMaterial

newlengthLabelSize
setlengthLabelSize{2.5cm}
AtBeginDocument{%
regtotcounter{chapter}
%setlengthLabelSize{dimexprtextheight/totvalue{chapter}relax}
% Line above commented out as this line of code resulted in "results out of range"
ifdimLabelSize>2.5cmrelax
globalsetlengthLabelSize{2.5cm}
fi
}

newcommandAddLabels{%
Materialtrue%
AddEverypageHook{%
ifMaterial%
ifoddvalue{page} %
backgroundsetup{
angle=90, position={current page.east|-current page text area.north east},
vshift=8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
else
backgroundsetup{
angle=90, position={current page.west|-current page text area.north west},
vshift=-8pt, hshift=-thechapter*LabelSize,
contents={%
tikznode[fill=gray!30,anchor=west,text width=LabelSize,
align=center,text height=15pt,text depth=10pt,font=largesffamily] {thechapter}; }%
}
fi
BgMaterial%
elserelaxfi}%
}


newcommandRemoveLabels{Materialfalse}






margins scrbook chapterthumb thumb-index






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 7 at 15:10









TGterpaTGterpa

11




11








  • 2





    Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

    – Steven B. Segletes
    Jan 7 at 15:20














  • 2





    Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

    – Steven B. Segletes
    Jan 7 at 15:20








2




2





Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

– Steven B. Segletes
Jan 7 at 15:20





Welcome to the site. Please make your code complete, rather than just a fragment. It should demonstrate the issue at hand.

– Steven B. Segletes
Jan 7 at 15:20










1 Answer
1






active

oldest

votes


















0














The following suggestion bases on an example in the appendix of the KOMA-Script book (German):



documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
linespread{1.1}
usepackage[
paperwidth=170mm,
paperheight=240mm,
top=2.5cm, bottom=3cm,
inner=30mm, outer=25mm,
heightrounded=true
]{geometry}

usepackage{graphicx}
usepackage{xcolor}
usepackage{scrlayer-scrpage}

% the following bases on an example in the KOMA-Script book:
newcommand*{firstchapterthumbskip}{.1paperheight}
newcommand*{lastchapterthumbskip}{firstchapterthumbskip}
newcommand*{chapterthumbheight}{2em}
newcommand*{chapterthumbwidth}{.1paperheight}
newcommand*{chapterthumbskip}{.1paperheight}
newcommand*{chapterthumbboxcolor}{gray!30}
newcommand*{chapterthumbcolor}{black}
newcommand*{chapterthumbformat}{thechapter}
newkomafont{chapterthumb}{normalfontLargesffamilycolor{chapterthumbcolor}}

makeatletter
newcommand*chapterthumb@box{%
parbox[c][chapterthumbheight][c]{chapterthumbwidth}{%
centeringusekomafont{chapterthumb}{chapterthumbformat}%
}%
}
newcommand*{chapterthumbbox}{%
if@mainmatter
ifnumvalue{chapter}>z@
ifnum value{chapterthumb}<z@
else
begingroup
protected@edefreserved@a{chapterthumbformat}%
ifxreserved@alastchapterthumbformatelse
stepcounter{chapterthumb}%
globalletlastchapterthumbformatreserved@a
fi
@tempcnta=numexpr
dimexpr
paperheight
-firstchapterthumbskip
-chapterthumbwidth
-lastchapterthumbskip
relax / dimexpr
chapterthumbskip
relax
+1
relax
ifnum value{chapterthumb}<@tempcnta
else
setcounter{chapterthumb}{0}%
fi
vspace*{%
dimexpr
firstchapterthumbskip
+ ( chapterthumbskip )
* value{chapterthumb}%
- baselineskip
relax
}par
setlength{fboxsep}{0pt}%
ifoddvalue{page}
hfill
makebox[0pt][r]{%
rotatebox[origin=tr]{90}{%
colorbox{chapterthumbboxcolor}{%
parbox[t][chapterthumbheight]{chapterthumbwidth}{%
chapterthumb@box
vskip3mm
}}}}%
else
hspace*{-3mm}%
makebox[0pt][l]{%
rotatebox[origin=tr]{90}{%
colorbox{chapterthumbboxcolor}{%
parbox{chapterthumbwidth}{%
vskip3mm
chapterthumb@box
}}}}%
fi
endgroup
fi
fi
fi
}
makeatother

newcounter{chapterthumb}
setcounter{chapterthumb}{10000}
newcommand*{lastchapterthumbformat}{relax}

DeclareNewLayer[%
background,%
outermargin,%
contents=chapterthumbbox
]{chapterthumb}

newcommand*EnableChapterthumb{%
IfLayerAtPageStyle{scrheadings}{chapterthumb}{}
{AddLayersToPageStyle{scrheadings}{chapterthumb}}%
}
newcommand*DisableChapterthumb{%
RemoveLayersFromPageStyle{scrheadings}{chapterthumb}%
}

EnableChapterthumb

usepackage{blindtext}% only for dummy text
begin{document}
tableofcontents
blinddocumentblinddocumentblinddocument
blinddocumentblinddocumentblinddocument
blinddocumentblinddocumentblinddocument
blinddocumentblinddocumentblinddocument
end{document}


Result:



enter image description here






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468984%2fremove-gray-chapter-number-boxes-on-chapter-title-page%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The following suggestion bases on an example in the appendix of the KOMA-Script book (German):



    documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
    linespread{1.1}
    usepackage[
    paperwidth=170mm,
    paperheight=240mm,
    top=2.5cm, bottom=3cm,
    inner=30mm, outer=25mm,
    heightrounded=true
    ]{geometry}

    usepackage{graphicx}
    usepackage{xcolor}
    usepackage{scrlayer-scrpage}

    % the following bases on an example in the KOMA-Script book:
    newcommand*{firstchapterthumbskip}{.1paperheight}
    newcommand*{lastchapterthumbskip}{firstchapterthumbskip}
    newcommand*{chapterthumbheight}{2em}
    newcommand*{chapterthumbwidth}{.1paperheight}
    newcommand*{chapterthumbskip}{.1paperheight}
    newcommand*{chapterthumbboxcolor}{gray!30}
    newcommand*{chapterthumbcolor}{black}
    newcommand*{chapterthumbformat}{thechapter}
    newkomafont{chapterthumb}{normalfontLargesffamilycolor{chapterthumbcolor}}

    makeatletter
    newcommand*chapterthumb@box{%
    parbox[c][chapterthumbheight][c]{chapterthumbwidth}{%
    centeringusekomafont{chapterthumb}{chapterthumbformat}%
    }%
    }
    newcommand*{chapterthumbbox}{%
    if@mainmatter
    ifnumvalue{chapter}>z@
    ifnum value{chapterthumb}<z@
    else
    begingroup
    protected@edefreserved@a{chapterthumbformat}%
    ifxreserved@alastchapterthumbformatelse
    stepcounter{chapterthumb}%
    globalletlastchapterthumbformatreserved@a
    fi
    @tempcnta=numexpr
    dimexpr
    paperheight
    -firstchapterthumbskip
    -chapterthumbwidth
    -lastchapterthumbskip
    relax / dimexpr
    chapterthumbskip
    relax
    +1
    relax
    ifnum value{chapterthumb}<@tempcnta
    else
    setcounter{chapterthumb}{0}%
    fi
    vspace*{%
    dimexpr
    firstchapterthumbskip
    + ( chapterthumbskip )
    * value{chapterthumb}%
    - baselineskip
    relax
    }par
    setlength{fboxsep}{0pt}%
    ifoddvalue{page}
    hfill
    makebox[0pt][r]{%
    rotatebox[origin=tr]{90}{%
    colorbox{chapterthumbboxcolor}{%
    parbox[t][chapterthumbheight]{chapterthumbwidth}{%
    chapterthumb@box
    vskip3mm
    }}}}%
    else
    hspace*{-3mm}%
    makebox[0pt][l]{%
    rotatebox[origin=tr]{90}{%
    colorbox{chapterthumbboxcolor}{%
    parbox{chapterthumbwidth}{%
    vskip3mm
    chapterthumb@box
    }}}}%
    fi
    endgroup
    fi
    fi
    fi
    }
    makeatother

    newcounter{chapterthumb}
    setcounter{chapterthumb}{10000}
    newcommand*{lastchapterthumbformat}{relax}

    DeclareNewLayer[%
    background,%
    outermargin,%
    contents=chapterthumbbox
    ]{chapterthumb}

    newcommand*EnableChapterthumb{%
    IfLayerAtPageStyle{scrheadings}{chapterthumb}{}
    {AddLayersToPageStyle{scrheadings}{chapterthumb}}%
    }
    newcommand*DisableChapterthumb{%
    RemoveLayersFromPageStyle{scrheadings}{chapterthumb}%
    }

    EnableChapterthumb

    usepackage{blindtext}% only for dummy text
    begin{document}
    tableofcontents
    blinddocumentblinddocumentblinddocument
    blinddocumentblinddocumentblinddocument
    blinddocumentblinddocumentblinddocument
    blinddocumentblinddocumentblinddocument
    end{document}


    Result:



    enter image description here






    share|improve this answer




























      0














      The following suggestion bases on an example in the appendix of the KOMA-Script book (German):



      documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
      linespread{1.1}
      usepackage[
      paperwidth=170mm,
      paperheight=240mm,
      top=2.5cm, bottom=3cm,
      inner=30mm, outer=25mm,
      heightrounded=true
      ]{geometry}

      usepackage{graphicx}
      usepackage{xcolor}
      usepackage{scrlayer-scrpage}

      % the following bases on an example in the KOMA-Script book:
      newcommand*{firstchapterthumbskip}{.1paperheight}
      newcommand*{lastchapterthumbskip}{firstchapterthumbskip}
      newcommand*{chapterthumbheight}{2em}
      newcommand*{chapterthumbwidth}{.1paperheight}
      newcommand*{chapterthumbskip}{.1paperheight}
      newcommand*{chapterthumbboxcolor}{gray!30}
      newcommand*{chapterthumbcolor}{black}
      newcommand*{chapterthumbformat}{thechapter}
      newkomafont{chapterthumb}{normalfontLargesffamilycolor{chapterthumbcolor}}

      makeatletter
      newcommand*chapterthumb@box{%
      parbox[c][chapterthumbheight][c]{chapterthumbwidth}{%
      centeringusekomafont{chapterthumb}{chapterthumbformat}%
      }%
      }
      newcommand*{chapterthumbbox}{%
      if@mainmatter
      ifnumvalue{chapter}>z@
      ifnum value{chapterthumb}<z@
      else
      begingroup
      protected@edefreserved@a{chapterthumbformat}%
      ifxreserved@alastchapterthumbformatelse
      stepcounter{chapterthumb}%
      globalletlastchapterthumbformatreserved@a
      fi
      @tempcnta=numexpr
      dimexpr
      paperheight
      -firstchapterthumbskip
      -chapterthumbwidth
      -lastchapterthumbskip
      relax / dimexpr
      chapterthumbskip
      relax
      +1
      relax
      ifnum value{chapterthumb}<@tempcnta
      else
      setcounter{chapterthumb}{0}%
      fi
      vspace*{%
      dimexpr
      firstchapterthumbskip
      + ( chapterthumbskip )
      * value{chapterthumb}%
      - baselineskip
      relax
      }par
      setlength{fboxsep}{0pt}%
      ifoddvalue{page}
      hfill
      makebox[0pt][r]{%
      rotatebox[origin=tr]{90}{%
      colorbox{chapterthumbboxcolor}{%
      parbox[t][chapterthumbheight]{chapterthumbwidth}{%
      chapterthumb@box
      vskip3mm
      }}}}%
      else
      hspace*{-3mm}%
      makebox[0pt][l]{%
      rotatebox[origin=tr]{90}{%
      colorbox{chapterthumbboxcolor}{%
      parbox{chapterthumbwidth}{%
      vskip3mm
      chapterthumb@box
      }}}}%
      fi
      endgroup
      fi
      fi
      fi
      }
      makeatother

      newcounter{chapterthumb}
      setcounter{chapterthumb}{10000}
      newcommand*{lastchapterthumbformat}{relax}

      DeclareNewLayer[%
      background,%
      outermargin,%
      contents=chapterthumbbox
      ]{chapterthumb}

      newcommand*EnableChapterthumb{%
      IfLayerAtPageStyle{scrheadings}{chapterthumb}{}
      {AddLayersToPageStyle{scrheadings}{chapterthumb}}%
      }
      newcommand*DisableChapterthumb{%
      RemoveLayersFromPageStyle{scrheadings}{chapterthumb}%
      }

      EnableChapterthumb

      usepackage{blindtext}% only for dummy text
      begin{document}
      tableofcontents
      blinddocumentblinddocumentblinddocument
      blinddocumentblinddocumentblinddocument
      blinddocumentblinddocumentblinddocument
      blinddocumentblinddocumentblinddocument
      end{document}


      Result:



      enter image description here






      share|improve this answer


























        0












        0








        0







        The following suggestion bases on an example in the appendix of the KOMA-Script book (German):



        documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
        linespread{1.1}
        usepackage[
        paperwidth=170mm,
        paperheight=240mm,
        top=2.5cm, bottom=3cm,
        inner=30mm, outer=25mm,
        heightrounded=true
        ]{geometry}

        usepackage{graphicx}
        usepackage{xcolor}
        usepackage{scrlayer-scrpage}

        % the following bases on an example in the KOMA-Script book:
        newcommand*{firstchapterthumbskip}{.1paperheight}
        newcommand*{lastchapterthumbskip}{firstchapterthumbskip}
        newcommand*{chapterthumbheight}{2em}
        newcommand*{chapterthumbwidth}{.1paperheight}
        newcommand*{chapterthumbskip}{.1paperheight}
        newcommand*{chapterthumbboxcolor}{gray!30}
        newcommand*{chapterthumbcolor}{black}
        newcommand*{chapterthumbformat}{thechapter}
        newkomafont{chapterthumb}{normalfontLargesffamilycolor{chapterthumbcolor}}

        makeatletter
        newcommand*chapterthumb@box{%
        parbox[c][chapterthumbheight][c]{chapterthumbwidth}{%
        centeringusekomafont{chapterthumb}{chapterthumbformat}%
        }%
        }
        newcommand*{chapterthumbbox}{%
        if@mainmatter
        ifnumvalue{chapter}>z@
        ifnum value{chapterthumb}<z@
        else
        begingroup
        protected@edefreserved@a{chapterthumbformat}%
        ifxreserved@alastchapterthumbformatelse
        stepcounter{chapterthumb}%
        globalletlastchapterthumbformatreserved@a
        fi
        @tempcnta=numexpr
        dimexpr
        paperheight
        -firstchapterthumbskip
        -chapterthumbwidth
        -lastchapterthumbskip
        relax / dimexpr
        chapterthumbskip
        relax
        +1
        relax
        ifnum value{chapterthumb}<@tempcnta
        else
        setcounter{chapterthumb}{0}%
        fi
        vspace*{%
        dimexpr
        firstchapterthumbskip
        + ( chapterthumbskip )
        * value{chapterthumb}%
        - baselineskip
        relax
        }par
        setlength{fboxsep}{0pt}%
        ifoddvalue{page}
        hfill
        makebox[0pt][r]{%
        rotatebox[origin=tr]{90}{%
        colorbox{chapterthumbboxcolor}{%
        parbox[t][chapterthumbheight]{chapterthumbwidth}{%
        chapterthumb@box
        vskip3mm
        }}}}%
        else
        hspace*{-3mm}%
        makebox[0pt][l]{%
        rotatebox[origin=tr]{90}{%
        colorbox{chapterthumbboxcolor}{%
        parbox{chapterthumbwidth}{%
        vskip3mm
        chapterthumb@box
        }}}}%
        fi
        endgroup
        fi
        fi
        fi
        }
        makeatother

        newcounter{chapterthumb}
        setcounter{chapterthumb}{10000}
        newcommand*{lastchapterthumbformat}{relax}

        DeclareNewLayer[%
        background,%
        outermargin,%
        contents=chapterthumbbox
        ]{chapterthumb}

        newcommand*EnableChapterthumb{%
        IfLayerAtPageStyle{scrheadings}{chapterthumb}{}
        {AddLayersToPageStyle{scrheadings}{chapterthumb}}%
        }
        newcommand*DisableChapterthumb{%
        RemoveLayersFromPageStyle{scrheadings}{chapterthumb}%
        }

        EnableChapterthumb

        usepackage{blindtext}% only for dummy text
        begin{document}
        tableofcontents
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        end{document}


        Result:



        enter image description here






        share|improve this answer













        The following suggestion bases on an example in the appendix of the KOMA-Script book (German):



        documentclass[10pt,twoside,parskip=half]{scrbook} % Document class for PhD manuscript
        linespread{1.1}
        usepackage[
        paperwidth=170mm,
        paperheight=240mm,
        top=2.5cm, bottom=3cm,
        inner=30mm, outer=25mm,
        heightrounded=true
        ]{geometry}

        usepackage{graphicx}
        usepackage{xcolor}
        usepackage{scrlayer-scrpage}

        % the following bases on an example in the KOMA-Script book:
        newcommand*{firstchapterthumbskip}{.1paperheight}
        newcommand*{lastchapterthumbskip}{firstchapterthumbskip}
        newcommand*{chapterthumbheight}{2em}
        newcommand*{chapterthumbwidth}{.1paperheight}
        newcommand*{chapterthumbskip}{.1paperheight}
        newcommand*{chapterthumbboxcolor}{gray!30}
        newcommand*{chapterthumbcolor}{black}
        newcommand*{chapterthumbformat}{thechapter}
        newkomafont{chapterthumb}{normalfontLargesffamilycolor{chapterthumbcolor}}

        makeatletter
        newcommand*chapterthumb@box{%
        parbox[c][chapterthumbheight][c]{chapterthumbwidth}{%
        centeringusekomafont{chapterthumb}{chapterthumbformat}%
        }%
        }
        newcommand*{chapterthumbbox}{%
        if@mainmatter
        ifnumvalue{chapter}>z@
        ifnum value{chapterthumb}<z@
        else
        begingroup
        protected@edefreserved@a{chapterthumbformat}%
        ifxreserved@alastchapterthumbformatelse
        stepcounter{chapterthumb}%
        globalletlastchapterthumbformatreserved@a
        fi
        @tempcnta=numexpr
        dimexpr
        paperheight
        -firstchapterthumbskip
        -chapterthumbwidth
        -lastchapterthumbskip
        relax / dimexpr
        chapterthumbskip
        relax
        +1
        relax
        ifnum value{chapterthumb}<@tempcnta
        else
        setcounter{chapterthumb}{0}%
        fi
        vspace*{%
        dimexpr
        firstchapterthumbskip
        + ( chapterthumbskip )
        * value{chapterthumb}%
        - baselineskip
        relax
        }par
        setlength{fboxsep}{0pt}%
        ifoddvalue{page}
        hfill
        makebox[0pt][r]{%
        rotatebox[origin=tr]{90}{%
        colorbox{chapterthumbboxcolor}{%
        parbox[t][chapterthumbheight]{chapterthumbwidth}{%
        chapterthumb@box
        vskip3mm
        }}}}%
        else
        hspace*{-3mm}%
        makebox[0pt][l]{%
        rotatebox[origin=tr]{90}{%
        colorbox{chapterthumbboxcolor}{%
        parbox{chapterthumbwidth}{%
        vskip3mm
        chapterthumb@box
        }}}}%
        fi
        endgroup
        fi
        fi
        fi
        }
        makeatother

        newcounter{chapterthumb}
        setcounter{chapterthumb}{10000}
        newcommand*{lastchapterthumbformat}{relax}

        DeclareNewLayer[%
        background,%
        outermargin,%
        contents=chapterthumbbox
        ]{chapterthumb}

        newcommand*EnableChapterthumb{%
        IfLayerAtPageStyle{scrheadings}{chapterthumb}{}
        {AddLayersToPageStyle{scrheadings}{chapterthumb}}%
        }
        newcommand*DisableChapterthumb{%
        RemoveLayersFromPageStyle{scrheadings}{chapterthumb}%
        }

        EnableChapterthumb

        usepackage{blindtext}% only for dummy text
        begin{document}
        tableofcontents
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        blinddocumentblinddocumentblinddocument
        end{document}


        Result:



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 8 at 17:33









        esddesdd

        58.7k34589




        58.7k34589






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468984%2fremove-gray-chapter-number-boxes-on-chapter-title-page%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?