# Pagenumbers / Headers with vertical lines style

I'm just writing my thesis and this board has proven very very helpful with a lot of issues I've had with Latex, thank you :) I'm almost done now and would like to make my thesis visually appealing. I specifically want my numbers to have a vertical line in front of them (hard to describe) - very much likes this | 21

I added some pictures (sorry they are the wrong way around) This pictures originates from this page: http://www.kfiles.de/latex.php#Seitenlayout, which actually has code on it, but it doesn't work for me as I have never used hboxes or anything and it seems to require a lot of adjustement :(

I'm using the scrreport class and only need my pagenumbering to be on the right site of the page, same goes for the header.

Hope somebody can help, it would make me really happy if I could actually get this style into my thesis :)

Here is a suggestion based on the goLaTeX solution by Noch so einer (see Seitenzahlen/Kapitel mit Vertikalen Linien). But the following example works for twosided documents too and there is no vertical rule in the header if a chapter or section is unnumbered.

\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{microtype}
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\renewcommand*{\chaptermark}[1]{%
\markboth{%
\makebox[0pt][r]{%
\ifnumbered{chapter}{%
\chaptermarkformat% Kapitelnummer
\enskip% Abstand
\rule[-\dp\strutbox]{2pt}{\baselineskip}% Linie
\hspace*{\marginparsep}% Abstand
}{}%
}%
#1% Text
}{%
#1%Text
\makebox[0pt][l]{%
\hspace*{\marginparsep}% Abstand
\ifnumbered{chapter}{%
\rule[-\dp\strutbox]{2pt}{\baselineskip}% Linie
\enskip% Abstand
\chaptermarkformat% Kapitelnummer
}{}%
}%
}%
}
\renewcommand*{\sectionmark}[1]{%
\markright{%
#1%Text
\makebox[0pt][l]{%
\ifnumbered{section}{%
\hspace{\marginparsep}% Abstand
\rule[-\dp\strutbox]{2pt}{\baselineskip}% Linie
\enskip% Abstand
\sectionmarkformat% Abschnittsnummer
}{}%
}%
}%
}
\rofoot*{%
\makebox[0pt][l]{%
\hspace{\marginparsep}%
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{2pt}{2\baselineskip}%
}%
\enskip
\pagemark
}%
}
\lefoot*{%
\makebox[0pt][r]{%
\pagemark
\enskip
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{2pt}{2\baselineskip}%
}%
\hspace{\marginparsep}%
}%
}