1

I'd like to have page numbers on the outer page border slightly bellow the center, and the current chapter title at the bottom but rotated 90 degrees counter-clockwise (i.e. to the left) such that it also sticks to the page outer border, i.e.

+--------------+--------------+
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|p             |             p|   p = page number
|              |              |
|C             |             C|   CT = chapter title, rotated
|T             |             T|        90 degrees counter-clockwise
+--------------+--------------+

Sure enough I could use in a similar way as mentioned here (and I'm already using tikz due to that very scenario), via

\node [anchor=west] at ([yshift=-0.5cm] current page.west){\pagemark}

and similarly use it to rotate the chapter title, but isn't there a better way that maybe also respects pagestyle, e.g. by defining a pagemargin similar to pageheader?

1 Answers1

4

Here is a suggestion using package scrlayer-scrpage to define a new page style:

\documentclass[
  %oneside
]{scrbook}
\usepackage[top=30mm,bottom=30mm,inner=25mm,outer=35mm]{geometry} 
\usepackage{blindtext}
\usepackage{rotating}
\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}

% new font element for the text in outermargin
\newkomafont{outermargin}{\scshape\Large}

% declare new layers for the outermargin
\DeclareNewLayer[
  foreground,
  outermargin,
  oddpage,
  contents={\rotatebox{90}{\parbox[b][\layerwidth][b]{\layerheight}{%
    \hspace*{.5cm}\parbox[b]{.35\layerheight}{\usekomafont{outermargin}\headmark}%
    \vspace*{.5cm}}}}
]{ChapterInOutermargin.odd}
\DeclareNewLayer[
  clone=ChapterInOutermargin.odd,
  evenpage,
  contents={\rotatebox{90}{\parbox[t][\layerwidth][t]{\layerheight}{%
    \vspace*{.5cm}%
    \hspace*{.5cm}\parbox[t]{.35\layerheight}{\usekomafont{outermargin}\headmark}}}}
]{ChapterInOutermargin.even}
\DeclareNewLayer[
  clone=ChapterInOutermargin.odd,
  contents={\parbox{\layerwidth}{\vspace*{.55\layerheight}%
      \hfill\usekomafont{outermargin}\pagemark\hspace*{.5cm}}}
  ]{PagenumberInOutermargin.odd}
\DeclareNewLayer[
  clone=ChapterInOutermargin.even,
  contents={\parbox{\layerwidth}{\vspace*{.55\layerheight}%
      \hspace*{.5cm}\usekomafont{outermargin}\pagemark\hfill}}
  ]{PagenumberInOutermargin.even}

% declare new page styles using the new layers
\DeclarePageStyleByLayers{outermargin}{%
  ChapterInOutermargin.odd,ChapterInOutermargin.even,%
  PagenumberInOutermargin.odd,PagenumberInOutermargin.even}
\DeclarePageStyleByLayers{plain.outermargin}{%
  PagenumberInOutermargin.odd,PagenumberInOutermargin.even}

% if page style plain should be an alias for plain.outermargin
\RedeclarePageStyleAlias{plain}{plain.outermargin}

% use the new page style
\pagestyle{outermargin}
% if chapter pages should use page style outermargin instead plain
\renewcommand*{\chapterpagestyle}{outermargin}

\begin{document}
\tableofcontents
\blinddocument
\end{document}

enter image description here

esdd
  • 85,675
  • Perfect, thanks. In case anyone's interested, one can of course use \usekomafont{pagenumber} in the respective layers to have a different font for pagenumbers, and \renewcommand*{\chaptermarkformat}{} to hide chapter numbers. edit Never mind \usekomafont{pagenumber}, that should be implicitly included in \pagemark - @esdd, shouldn't that be a \thepage instead to avoid using the pagenumber font? – Tobias Kienzler Nov 30 '15 at 07:13
  • 1
    I suggest to use \pagemark. Then you have to use \setkomafont or \addtokomafont only once to change the font of all page numbers. If you do not want to use a special pagenumber font insert \setkomafont{pagenumber}{} in your preamble. – esdd Nov 30 '15 at 12:58