1

I would like to generate something like the pictures below. I already got the blue line and the numbering. Now i would like to also show the chapter name on the left pages, and the section name of the latest section on the right page.

I already tried to use \leftmark in the page numbering. But then it will be on the wrong side of the line.

How can i do this? Any hints are welcome :)

Thanks to all who will contribute :)

enter image description here enter image description here

--- Edit

Here is the minimal code which shows, how i made the actual design:

\documentclass[twoside=true,a4paper,1.5pt,titlepage=on,]{scrreprt}

\usepackage{fancyhdr}
\usepackage{xcolor}
\definecolor{chaptercolor}{rgb}{0.36,0.73,0.82}

\fancypagestyle{plain}{%
    \fancyhf{}
    \fancyfootoffset[OR]{1.85cm}
    \fancyfoot[OR]{%
        {\ }%\tgherosfont%
        {\color{chaptercolor}\rule[-90pt]{0.8mm}{100pt}}%
        \hspace*{10pt}\begin{minipage}[b]{1.5cm}%
            \color{chaptercolor}\normalsize\textbf{\thepage}%
        \end{minipage}%
    }
    \fancyfootoffset[EL]{1.85cm}
    \fancyfoot[EL]{%
        %\tgherosfont%
        \begin{minipage}[b]{1.5cm}%
            \raggedleft\color{chaptercolor}\normalsize\textbf{\thepage \leftmark}%
        \end{minipage}%
        \hspace*{10pt}{\color{chaptercolor}\rule[-90pt]{0.8mm}{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{chaptercolor}\normalsize\textbf{\thepage  }%
        \end{minipage}%
    }
    \fancyfootoffset[EL]{1.85cm}
    \fancyfoot[EL]{%
        \tgherosfont\footnotesize%
        \begin{minipage}[b]{1.5cm}%
            \raggedleft\color{chaptercolor}\normalsize\textbf{\thepage }%
        \end{minipage}%
        \footnotesize%
        \hspace*{10pt}{\color{chaptercolor}\rule[-90pt]{1.25pt}{100pt}}%
        \hspace*{0.75cm}\leftmark%
    }
}

\pagestyle{fancy}
\fancyhf{}
\fancyfootoffset[OR]{1.85cm}
\fancyfoot[OR]{%
    {\ }%\tgherosfont%
    {\color{chaptercolor}\rule[-90pt]{0.8mm}{100pt}}%
    \hspace*{10pt}\begin{minipage}[b]{1.5cm}%
        \color{chaptercolor}\normalsize\textbf{\thepage}%
    \end{minipage}%
}
\fancyfootoffset[EL]{1.85cm}
\fancyfoot[EL]{%
    %\tgherosfont%
    \begin{minipage}[b]{1.5cm}%
        \raggedleft\color{chaptercolor}\normalsize\textbf{\thepage}%
    \end{minipage}%
    \hspace*{10pt}{\color{chaptercolor}\rule[-90pt]{0.8mm}{100pt}}%
}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}


\usepackage{blindtext}

\begin{document}

    \tableofcontents

    \Blinddocument


\end{document}
  • 1
    Please add a MWE showing how you get the blue line and the page number. A possible answer depends on the package used for header and footer (fancyhdr, titleps, scrlayer-scrpage, ...) and maybe it depends on the document class too. – esdd May 17 at 14:22
  • @esdd im Sorry, you are right. I have added the code – C. Hediger May 17 at 14:33
1

Note that it is not recommended to use fancyhdr together with a KOMA-Script class. So here is a suggestion using scrlayer-scrpage (part of the KOMA-Script bundle):

\documentclass[
  twoside=true,
  %a4paper,% default
  %%1.5pt,% unknown option!
  titlepage=on
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage{xcolor}
\definecolor{chaptercolor}{rgb}{0.36,0.73,0.82}

\colorlet{ctcolorchapterline}{chaptercolor}
\colorlet{ctcolorchapternum}{chaptercolor}
\colorlet{ctcolorfooterline}{chaptercolor}
\colorlet{ctsectiontitles}{chaptercolor}
\colorlet{ctcolorfootertitle}{chaptercolor}
\colorlet{ctcolorfootermark}{black}


\usepackage[automark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\lefoot*{\hspace{10pt}\leftmark}
\rofoot*{\rightbotmark\hspace{10pt}}
%\rofoot*{\ifstr{\rightmark}{}{\rightbotmark}{\rightmark}\hspace{10pt}}% alternative

\addtokomafont{pagefoot}{\normalfont\usekomafont{disposition}\color{ctcolorfootertitle}}
\renewcommand\chaptermarkformat{\textcolor{ctcolorfootermark}{\chapapp~\thechapter\autodot\enskip}}
\renewcommand\sectionmarkformat{\textcolor{ctcolorfootermark}{\thesection\autodot\enskip}}

\AddLayersToPageStyle{scrheadings}{pagenumber.odd,pagenumber.even}
\AddLayersToPageStyle{plain.scrheadings}{pagenumber.odd,pagenumber.even}
\DeclareNewLayer[
  foreground,
  oddpage,
  foot,
  contents={%
    \hfill
    \makebox[0pt][l]{%
      \pagenumberrule
      \hspace*{10pt}%
      \pagemark
    }%
  }
]{pagenumber.odd}
\DeclareNewLayer[
  clone=pagenumber.odd,
  evenpage,
  contents={%
    \makebox[0pt][r]{%
      \pagemark
      \hspace*{10pt}%
      \pagenumberrule
    }%
  }
]{pagenumber.even}
\newcommand*\pagenumberrule{%
  {\color{ctcolorfooterline}\rule[\dimexpr-10cm+\ht\strutbox\relax]{1.25pt}{10cm}}%
}
\addtokomafont{pagenumber}{\usekomafont{disposition}}

\begin{document}
\tableofcontents
\Blinddocument
\end{document}

Result:

enter image description here

  • Woow!!! You are so awsome :) Thanks so much!!! It works. But i got an error: Package scrlayer Error: cannot define `\newpagestyle'. } But the pdf still renders... strange – C. Hediger May 17 at 15:01
  • Do you load package titleps too? Note that you can use only one of the packages scrlayer-scrpage, fancyhdr, titleps, scrpage2. – esdd May 17 at 15:05
  • No, i only load: mdframed, listings, calc, csquotes, inputenc, prahicx, geometry, caption, etoolbox, titlesec, hyperref, fontspec, scrlayer-scrpage. By the way, it does not work for page 1 and 2. Only from page 3... on – C. Hediger May 17 at 15:07
  • Do not use package titlesec together with a KOMA-Script class ... Use the KOMA-Script features to adjust the layout of the sectioning commands. – esdd May 17 at 15:17
  • Ok, i would like to switch titlesec to an alternative. the problem is, that im quite new to latex and i dont know how i could switch my code to something other – C. Hediger May 17 at 15:18

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.