我试图将页码与页面的最后一条基线对齐。但没成功。可以吗?或者我如何将页码放在外边距的底部?
这是一个非常类似的情况,但它是垂直居中的。
\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
}
答案1
\vfill
只需从\DeclareNewLayer
代码中删除最后一个即可esdd 的回答:
\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}
您可以使用链接答案中的 MWE 来测试它。
答案2
以下是适用于单面和双面文档的建议:
\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}
结果:
或者选择oneside
:scrbook