fmarotta / kaobook

A LaTeX class for books, reports or theses based on https://github.com/kenohori/thesis and https://github.com/Tufte-LaTeX/tufte-latex.
https://github.com/fmarotta/kaobook
LaTeX Project Public License v1.3c
858 stars 184 forks source link

Add custom part name to header using kaobook template in LaTeX #269

Open DanielWicz opened 1 year ago

DanielWicz commented 1 year ago

I am using the kaobook template for my document in LaTeX, and I would like to add the custom part name to the header. By default, the header only shows the chapter name. How can I modify the kaobook template to include the part name in the header, and how can I update it when using the \addpart command ?

I see that kaobook defines headers in the kao.sty as:

% Header style with chapter number, chapter title, and page in the header (used throughout the document)
\renewpagestyle{scrheadings}{%
    {\smash{\hspace{-\headmarginparwidth}\hspace{-\headmarginparsep}\makebox[\headtotal][l]{%
        \makebox[7\hscale][r]{\thepage}%
        \makebox[3\hscale]{}\rule[-1mm]{0.5pt}{19\vscale-1mm}\makebox[3\hscale]{}%
        \makebox[\headtextwidth][l]{\leftmark}}}}%
    {\smash{\makebox[0pt][l]{\makebox[\headtotal][r]{%
        \makebox[\headtextwidth][r]{\hfill\rightmark}%
        \makebox[3\hscale]{}\rule[-1mm]{0.5pt}{19\vscale-1mm}\makebox[3\hscale]{}%
        \makebox[7\hscale][l]{\thepage}}}}}%
    {\smash{\makebox[0pt][l]{\makebox[\headtotal][r]{%
        \makebox[\headtextwidth][r]{\hfill\rightmark}%
        \makebox[3\hscale]{}\rule[-1mm]{0.5pt}{19\vscale-1mm}\makebox[3\hscale]{}%
        \makebox[7\hscale][l]{\thepage}}}}}%
}{%
    {}%
    {}%
    {}%
}

How to modify it, so that part can be displayed in the header ?