2

I am trying to reproduce this footer, that was made with fancyhdr, with KOMA script only, to avoid mixing them:

enter image description here

Here is the fancyhdr MWE:

\documentclass{scrbook}
\usepackage{blindtext}
%\usepackage[automark]{scrlayer-scrpage}
%\pagestyle{scrheadings}
\usepackage{xcolor}

\usepackage[                    % page layout modifications
    paper=a4paper,                  %   - use A4 paper size
    %scale={0.86,0.94},             %   - total body size (h,v)
    %scale={0.86,0.94},             %   - total body size (h,v)
    nohead,                         %   - no header
    includefoot,                    %   - include footer space
    includemp,                      %   - include side note space
    bindingoffset=0.5cm,            %   - binding correction
    top=2.25cm,                     %   - total body: top margin
    left=3.75cm,                    %   - total body: left margin (odd pages)
    right=0.75cm,                   %   - total body: right margin (odd pages)
    bottom=1.5cm,                   %   - total body: bottom margin
    marginparwidth=1.75cm,          %   - width for side note
    marginparsep=10pt,              %   - space between notes and body text (content)
    footskip=2cm,                   %   - footer skip size
]{geometry}

% own font definitions
\newcommand{\helv}{\fontfamily{phv}\fontsize{9}{11}\selectfont}
\newcommand{\book}{\fontfamily{pbk}\fontseries{m}\fontsize{11}{13}\selectfont}
\newcommand{\tgherosfont}{\fontfamily{qhv}\selectfont}

\addtokomafont{disposition}{\usefont{T1}{bch}{b}{n}\selectfont} % set font for ToC, LoT


\definecolor{ctcolormain}{cmyk}{0, 1, .8, .2}%
\definecolor{ctcoloraccessory}{cmyk}{0, 0, 0, .7}%
\definecolor{ctcolorblack}{gray}{0}
\definecolor{ctcolorgray}{gray}{.5}
\definecolor{ctcolorgraylight}{gray}{.8}

\colorlet{ctcolorfooterpage}{ctcolorblack}
\colorlet{ctcolorfooterline}{ctcolormain}
\colorlet{ctcolorfootermark}{ctcolorblack}
\colorlet{ctcolorfootertitle}{ctcolormain}



\usepackage{fancyhdr}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
    \markboth{%
        \footnotesize%
        {\color{ctcolorfootermark}\textbf{\chaptername\ \thechapter}}%
        \quad%
        \if%
            {\color{ctcolorfootertitle}\parbox[t]{.7\textwidth}{#1}}%
        \else%
            {\color{ctcolorfootertitle}#1}%
        \fi%
    }{}%
}
\renewcommand{\sectionmark}[1]{%
    \markright{%
        \footnotesize%
        {\color{ctcolorfootermark}\textbf{\thesection}}%
        \quad%
        {\color{ctcolorfootertitle}#1}%
    }%
}
%
\fancypagestyle{plain}{%
    \fancyhf{}
    \fancyfootoffset[OR]{1.85cm}
    \fancyfoot[OR]{%
        {\ }\tgherosfont%
        {\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
        \hspace*{10pt}\begin{minipage}[b]{1.5cm}%
            \color{ctcolorfooterpage}\normalsize\textbf{\thepage}%
        \end{minipage}%
    }
    \fancyfootoffset[EL]{1.85cm}
    \fancyfoot[EL]{%
        \tgherosfont%
        \begin{minipage}[b]{1.5cm}%
            \raggedleft\color{ctcolorfooterpage}\normalsize\textbf{\thepage}%
        \end{minipage}%
        \hspace*{10pt}{\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
    }
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
%
\fancypagestyle{maincontentstyle}{%
    \pagestyle{plain}
    \fancyhf{}
    \fancyfootoffset[OR]{1.85cm}
    \fancyfoot[OR]{%
        {\ }\tgherosfont\footnotesize%
        \rightmark%
        \hspace*{0.75cm}{\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
        \hspace*{10pt}\begin{minipage}[b]{1.5cm}%
            \color{ctcolorfooterpage}\normalsize\textbf{\thepage}%
        \end{minipage}%
    }
    \fancyfootoffset[EL]{1.85cm}
    \fancyfoot[EL]{%
        \tgherosfont\footnotesize%
        \begin{minipage}[b]{1.5cm}%
            \raggedleft\color{ctcolorfooterpage}\normalsize\textbf{\thepage}%
        \end{minipage}%
        \footnotesize%
        \hspace*{10pt}{\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
        \hspace*{0.75cm}\leftmark%
    }
}

\begin{document}
\pagestyle{maincontentstyle}
\blinddocument
\pagestyle{plain}
\blinddocument
\end{document}

I am reading the KOMA manual part for scrlayer-scrpage but its quite overwhelming and I cant get it to work.

1 Answer 1

2

Here is a suggestion using scrlayer-scrpage:

\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{xcolor}

\usepackage[                    % page layout modifications
    paper=a4paper,                  %   - use A4 paper size
    %scale={0.86,0.94},             %   - total body size (h,v)
    %scale={0.86,0.94},             %   - total body size (h,v)
    nohead,                         %   - no header
    includefoot,                    %   - include footer space
    includemp,                      %   - include side note space
    bindingoffset=0.5cm,            %   - binding correction
    top=2.25cm,                     %   - total body: top margin
    left=3.75cm,                    %   - total body: left margin (odd pages)
    right=0.75cm,                   %   - total body: right margin (odd pages)
    bottom=1.5cm,                   %   - total body: bottom margin
    marginparwidth=1.75cm,          %   - width for side note
    marginparsep=10pt,              %   - space between notes and body text (content)
    footskip=2cm,                   %   - footer skip size
]{geometry}

% own font definitions
\newcommand{\helv}{\fontfamily{phv}\fontsize{9}{11}\selectfont}
\newcommand{\book}{\fontfamily{pbk}\fontseries{m}\fontsize{11}{13}\selectfont}
\newcommand{\tgherosfont}{\fontfamily{qhv}\selectfont}

\addtokomafont{disposition}{\usefont{T1}{bch}{b}{n}\selectfont} % set font for ToC, LoT

\definecolor{ctcolormain}{cmyk}{0, 1, .8, .2}%
\definecolor{ctcoloraccessory}{cmyk}{0, 0, 0, .7}%
\definecolor{ctcolorblack}{gray}{0}
\definecolor{ctcolorgray}{gray}{.5}
\definecolor{ctcolorgraylight}{gray}{.8}

\colorlet{ctcolorfooterpage}{ctcolorblack}
\colorlet{ctcolorfooterline}{ctcolormain}
\colorlet{ctcolorfootermark}{ctcolorblack}
\colorlet{ctcolorfootertitle}{ctcolormain}

\usepackage[automark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\lefoot{\hspace*{.75cm}\headmark}
\rofoot{\headmark\hspace*{.75cm}}

\newcommand*\pagenumberrule{%
  {\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
}
\DeclareNewLayer[
  foreground,
  oddpage,
  foot,
  contents={%
    \hfill
    \makebox[0pt][l]{%
      \pagenumberrule
      \hspace*{10pt}%
      \pagemark
    }%
  }
]{pagenumber.odd}
\DeclareNewLayer[
  foreground,
  evenpage,
  foot,
  contents={%
    \makebox[0pt][r]{%
      \pagemark
      \hspace*{10pt}%
      \pagenumberrule
    }%
  }
]{pagenumber.even}
\AddLayersToPageStyle{scrheadings}{pagenumber.odd,pagenumber.even}
\AddLayersToPageStyle{plain.scrheadings}{pagenumber.odd,pagenumber.even}

\setkomafont{pageheadfoot}{\color{ctcolorfootertitle}\tgherosfont\footnotesize}
\newkomafont{marknumber}{\color{ctcolorfootermark}\bfseries}
\setkomafont{pagenumber}{\color{ctcolorfooterpage}\tgherosfont\normalsize\bfseries}
\renewcommand\chaptermarkformat{{\usekomafont{marknumber}\chaptername\ \thechapter}\quad}
\renewcommand\sectionmarkformat{{\usekomafont{marknumber}\thesection}\quad}

\begin{document}
\blinddocument
\clearpage
\pagestyle{plain}
\blinddocument
\end{document}

enter image description here

But there will be warnings regarding the small head height. You can ignore these warnings or you can remove nohead from the options of package geometry.

Or you can use package scrlayer and define your own layer page styles without header layers:

\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{xcolor}

\usepackage[                    % page layout modifications
    paper=a4paper,                  %   - use A4 paper size
    %scale={0.86,0.94},             %   - total body size (h,v)
    %scale={0.86,0.94},             %   - total body size (h,v)
    nohead,                         %   - no header
    includefoot,                    %   - include footer space
    includemp,                      %   - include side note space
    bindingoffset=0.5cm,            %   - binding correction
    top=2.25cm,                     %   - total body: top margin
    left=3.75cm,                    %   - total body: left margin (odd pages)
    right=0.75cm,                   %   - total body: right margin (odd pages)
    bottom=1.5cm,                   %   - total body: bottom margin
    marginparwidth=1.75cm,          %   - width for side note
    marginparsep=10pt,              %   - space between notes and body text (content)
    footskip=2cm,                   %   - footer skip size
]{geometry}

 %own font definitions
\newcommand{\helv}{\fontfamily{phv}\fontsize{9}{11}\selectfont}
\newcommand{\book}{\fontfamily{pbk}\fontseries{m}\fontsize{11}{13}\selectfont}
\newcommand{\tgherosfont}{\fontfamily{qhv}\selectfont}

\addtokomafont{disposition}{\usefont{T1}{bch}{b}{n}\selectfont} % set font for ToC, LoT

\definecolor{ctcolormain}{cmyk}{0, 1, .8, .2}%
\definecolor{ctcoloraccessory}{cmyk}{0, 0, 0, .7}%
\definecolor{ctcolorblack}{gray}{0}
\definecolor{ctcolorgray}{gray}{.5}
\definecolor{ctcolorgraylight}{gray}{.8}

\colorlet{ctcolorfooterpage}{ctcolorblack}
\colorlet{ctcolorfooterline}{ctcolormain}
\colorlet{ctcolorfootermark}{ctcolorblack}
\colorlet{ctcolorfootertitle}{ctcolormain}

\usepackage[automark]{scrlayer}% sets pagestyle scrheadings automatically

\newcommand*\pagenumberrule{%
  {\color{ctcolorfooterline}\rule[-90pt]{1.25pt}{100pt}}%
}
\DeclareNewLayer[
  foreground,
  oddpage,
  foot,
  contents={%
    \hfill
    \makebox[0pt][l]{%
      \pagenumberrule
      \hspace*{10pt}%
      \pagemark
    }%
  }
]{pagenumber.odd}
\DeclareNewLayer[
  clone=pagenumber.odd,
  contents={{\usekomafont{pageheadfoot}\hfill\headmark\hspace*{.75cm}}}%
]{headmark.odd}
\DeclareNewLayer[
  foreground,
  evenpage,
  foot,
  contents={%
    \makebox[0pt][r]{%
      \pagemark
      \hspace*{10pt}%
      \pagenumberrule
    }%
  }
]{pagenumber.even}
\DeclareNewLayer[
  clone=pagenumber.even,
  contents={{\usekomafont{pageheadfoot}\hspace*{.75cm}\headmark\hfill}}%
]{headmark.even}
\DeclarePageStyleByLayers{maincontentstyle}{%
  pagenumber.odd,pagenumber.even,%
  headmark.odd,headmark.even%
}
\DeclarePageStyleByLayers{plain}{%
  pagenumber.odd,pagenumber.even%
}

\setkomafont{pageheadfoot}{\color{ctcolorfootertitle}\tgherosfont\footnotesize}
\newkomafont{marknumber}{\color{ctcolorfootermark}\bfseries}
\setkomafont{pagenumber}{\color{ctcolorfooterpage}\tgherosfont\normalsize\bfseries}
\renewcommand\chaptermarkformat{{\usekomafont{marknumber}\chaptername\ \thechapter}\quad}
\renewcommand\sectionmarkformat{{\usekomafont{marknumber}\thesection}\quad}

\begin{document}
\pagestyle{maincontentstyle}
\blinddocument
\clearpage
\pagestyle{plain}
\blinddocument
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .