Page numbers vertically centered in the outer page margin
You can use the background
package; a little exampe:
\documentclass[twoside]{scrbook}
\usepackage{background}
\usepackage{ifthen}
\usepackage{lipsum}
\SetBgContents{}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgScale{3}
\makeatletter
\AddEverypageHook{%
\ifthenelse{\isodd{\value{page}}}%
{\SetBgPosition{1.05\textwidth,-.5\textheight}}
{\SetBgPosition{0.3,-.5\textheight}}
\SetBgContents{-\thepage-}
\bg@material%
}
\makeatother
\pagestyle{empty}
\begin{document}
\lipsum[1-30]
\end{document}
Another solution with only KOMA-Script tools (and some low level trickery):
\usepackage{scrpage2}
\pagestyle{scrheadings}
\setlength{\footskip}{0pt}
\rofoot[\centerpageno{o}]{\centerpageno{o}}
\lefoot[\centerpageno{e}]{\centerpageno{e}}
\def\centerpageno#1{\leavevmode
\vbox to 0pt{
\vss
\hbox to 0pt{\Huge\normalfont
\if#1o\kern 2em\else\hss\fi\thepage
\if#1o\hss\else\kern2em\fi}
\vskip.5\textheight
\vskip\baselineskip}}
I use the normal footer, putting into it a zero height box that contains a zero width box that is raised to the center of the text block; in it the page number is typeset shifted on the right or on the left depending if we are in an odd or even page.
You could also use KOMA-Script package scrlayer-scrpage
. It is the successor of the deprecated package scrpage2
.
scrlayer-scrpage
uses layer to declare pagestyles. So you can declare a new layer for the pagenumber in the outer margin and add this layer to pagestyle scrheadings
and plain.scrheadings
. Note that after loading scrlayer-scrpage
pagestyle scrheadings
is set and pagestyle plain
is redefined as an aliaspagestyle for plain.scrheadings
.
\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\headmark}
\DeclareNewLayer[
background,
outermargin,
height=\textheight,
voffset=1in+\voffset+\topmargin+\headheight+\headsep,
contents={%
\vfill
\ifodd\value{page}\hspace*{.4\layerwidth}\else\hfill\fi
\pagemark
\ifodd\value{page}\else\hspace*{.4\layerwidth}\fi
\vfill
}
]{outermargin.pagenumber}
\AddLayersToPageStyle{scrheadings}{outermargin.pagenumber}
\AddLayersToPageStyle{plain.scrheadings}{outermargin.pagenumber}
\addtokomafont{pagenumber}{\Huge}
\usepackage{blindtext}% <- only for dummy text
\begin{document}
\chapter{Fruits}
\section{Bananas}
\Blindtext[20]
\end{document}
results in