1

I'm trying to put the page number aligned with the last baseline on a page. With no luck. Is it possible? Or how can I put page number on the bottom of the outer margin?

enter image description here

This is very similar case, but it's vertically centered.

\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
  }

Page numbers vertically centered in the outer page margin

Sebastiano
  • 54,118
ReRunner
  • 471

2 Answers2

1

Just remove the last \vfill from the \DeclareNewLayer code in esdd's answer:

\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}

You can use the MWE in the linked answer to test it.

wimi
  • 1,968
  • 8
  • 17
1

Here is a suggestion that works for onesided and twosided documents:

\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\headmark}

\DeclareNewLayer[
  background,
  oneside,
  outermargin,
  height=\textheight,
  voffset=1in+\voffset+\topmargin+\headheight+\headsep,
  contents={%
    \parbox[b][\layerheight][b]{\layerwidth}
      {\hspace*{.4\layerwidth}\pagemark}%
  }
]{outermargin.pagenumber.oneside}
\DeclareNewLayer[
  clone=outermargin.pagenumber.oneside,
  twoside,
  oddpage
]{outermargin.pagenumber.odd}
\DeclareNewLayer[
  clone=outermargin.pagenumber.odd,
  evenpage,
  contents={%
    \parbox[b][\layerheight][b]{\layerwidth}
      {\hfill\pagemark\hspace*{.4\layerwidth}}%
  }
]{outermargin.pagenumber.even}
\AddLayersToPageStyle{scrheadings}{%
  outermargin.pagenumber.oneside,%
  outermargin.pagenumber.odd,%
  outermargin.pagenumber.even%
}
\AddLayersToPageStyle{plain.scrheadings}{%
  outermargin.pagenumber.oneside,%
  outermargin.pagenumber.odd,%
  outermargin.pagenumber.even%
}


\usepackage{showframe}% <- only for showing the page layout
\usepackage{blindtext}% <- only for dummy text
\begin{document}
\chapter{Fruits}
\section{Bananas}
\Blindtext[20]
\end{document}

Result:

enter image description here

Or with option oneside for scrbook:

enter image description here

esdd
  • 85,675