移动 KOMA 页脚中的页码

移动 KOMA 页脚中的页码

如何将页码移动到距页面底部 0.75 英寸的位置?我选择使用 KOMA 类,而不是使用 fancyhdr。我已包含几个非标准页码的部分,我不希望将页码移高而影响这些部分。

梅威瑟:

\documentclass[
oneside,
12pt,
numbers=noenddot,
listof=entryprefix,
listof=totoc,
bibliography=totoc,
index=totoc,
footinclude,
footheight=.75in
]{scrbook}[2017/01/03]
%\usepackage{showframe} I don't see a footer with this. Why?

\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{margin=1in}

\usepackage[english]{babel}%For bibliography
\usepackage{lipsum}%Sample text generator
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{scrhack}

%Page Numbering
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\cfoot*{\pagemark}

\RedeclareSectionCommand[
beforeskip=-2.5\baselineskip plus  -\parskip ,
innerskip=0pt,
afterskip=.5\baselineskip plus 0\baselineskip minus 0\baselineskip,
font=\normalfont\bfseries
]{chapter}
\renewcommand\raggedchapter{\centering}
\renewcommand\chapterformat{\MakeUppercase{\chaptername} \thechapter:\ }
\renewcommand\chapterlinesformat[3]{#2\MakeUppercase{#3}}
\usepackage{xpatch}
\xpatchcmd{\addchaptertocentry}
{\addtocentrydefault{chapter}{#1}{#2}}
{\addtocentrydefault{chapter}{#1}{\protect\chaptertocentryformat{#2}}}
{}{\PatchFailed}
\newcommand\chaptertocentryformat[1]{#1}
\AfterTOCHead[toc]{\renewcommand\chaptertocentryformat[1]{\MakeUppercase{#1}}}
\addtokomafont{chapterentry}{\normalfont}

\newcommand\EndPageInToC{%
    \addtocontents{toc}{\RedeclareSectionCommand[tocpagenumberbox=\protect\EndPageBox]{chapter}}%
    \renewcommand\chapterpagestyle{empty}%
}
\newcommand\EndPageBox[1]{\makebox{END PAGE}}

\RedeclareSectionCommands[
font=\normalfont,
toclinefill=\hfill,
beforeskip=0\baselineskip plus  -\parskip ,
afterskip=.05\baselineskip  
]{section,subsection,subsubsection,paragraph,subparagraph}
%\renewcommand\sectionlinesformat[4]{#4}
%\renewcommand\sectioncatchphraseformat[4]{#4}

\DeclareTOCStyleEntry[
linefill=\hfill
]{tocline}{figure}
\DeclareTOCStyleEntry[
linefill=\hfill
]{tocline}{table}

\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{hyperref}

\renewcaptionname{english}{\contentsname}{Table of Contents}
\renewcaptionname{english}{\bibname}{References}

\setlength\parindent{.5in}

\begin{document}
    \begin{titlepage}
        A custom Title
    \end{titlepage}

    \addchap*{Dedication}
    \pagenumbering{gobble}
    \doublespacing
    \lipsum[1]  

    \addchap*{Acknowledgments}
    \pagenumbering{gobble}
    \doublespacing
    \lipsum[1]

    \frontmatter    
    \listoftables
    \listoffigures
    \tableofcontents

    \chapter{Abstract}
    \lipsum[1]
    \mainmatter
    \chapter{A Chapter}
    \lipsum[1]  
    \section{Some Section}
    \lipsum*
    \lipsum[1]

    %Final product will have this item. It is also before the About the Author chapter
    \bibliographystyle{plain}
    \bibliography{thesis-ref}

    \backmatter
    \EndPageInToC
    \chapter{About the Author}
    \lipsum[1]

\end{document}

答案1

您必须确保页眉和页脚中的双倍间距已禁用。因此,您可以使用:

\KOMAoptions{onpsinit={\linespread{1}\selectfont}}

在 MWE 中,geometry所有边距都设置为 1 英寸。因此 KOMA 选项footinclude不会产生任何影响。

footheight=.75in必须删除该选项。

添加

footskip=\dimexpr.25in+\dp\strutbox\relax

对于geometry选项,如果页码的基线应该距离页面底部 0.75 英寸。

在此处输入图片描述

代码:

\documentclass[
oneside,
12pt,
numbers=noenddot,
listof=entryprefix,
listof=totoc,
bibliography=totoc,
index=totoc,
%footinclude,% <- removed
%footheight=.75in% <- removed
]{scrbook}[2017/01/03]
\usepackage{showframe}% show the page layout
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{margin=1in,
  footskip=\dimexpr.25in+\dp\strutbox\relax% <- added
}

\usepackage[english]{babel}%For bibliography
\usepackage{lipsum}%Sample text generator
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{scrhack}

%Page Numbering
\usepackage[automark]{scrlayer-scrpage}
\KOMAoptions{onpsinit={\linespread{1}\selectfont}}% <- added
\clearpairofpagestyles
\cfoot*{\pagemark}

\RedeclareSectionCommand[
beforeskip=2.5\baselineskip plus \parskip,% <- changed
innerskip=0pt,
afterskip=.5\baselineskip,% <- changed
font=\normalfont\bfseries
]{chapter}
\renewcommand\raggedchapter{\centering}
\renewcommand\chapterformat{\MakeUppercase{\chaptername} \thechapter:\ }
\renewcommand\chapterlinesformat[3]{#2\MakeUppercase{#3}}
\usepackage{xpatch}
\xpatchcmd{\addchaptertocentry}
{\addtocentrydefault{chapter}{#1}{#2}}
{\addtocentrydefault{chapter}{#1}{\protect\chaptertocentryformat{#2}}}
{}{\PatchFailed}
\newcommand\chaptertocentryformat[1]{#1}
\AfterTOCHead[toc]{\renewcommand\chaptertocentryformat[1]{\MakeUppercase{#1}}}
\addtokomafont{chapterentry}{\normalfont}

\newcommand\EndPageInToC{%
    \addtocontents{toc}{\RedeclareSectionCommand[tocpagenumberbox=\protect\EndPageBox]{chapter}}%
    \renewcommand\chapterpagestyle{empty}%
}
\newcommand\EndPageBox[1]{\makebox{END PAGE}}

\RedeclareSectionCommands[
font=\normalfont,
toclinefill=\hfill,
beforeskip=0\baselineskip minus \parskip,% <- changed
afterskip=.05\baselineskip  
]{section,subsection,subsubsection,paragraph,subparagraph}
%\renewcommand\sectionlinesformat[4]{#4}
%\renewcommand\sectioncatchphraseformat[4]{#4}

\DeclareTOCStyleEntry[
linefill=\hfill
]{tocline}{figure}
\DeclareTOCStyleEntry[
linefill=\hfill
]{tocline}{table}

%\usepackage{indentfirst}% <- removed
\usepackage{setspace}
\usepackage[hypertexnames=false]{hyperref}

\renewcaptionname{english}{\contentsname}{Table of Contents}
\renewcaptionname{english}{\bibname}{References}

\setlength\parindent{.5in}

\begin{document}
    \begin{titlepage}
        A custom Title
    \end{titlepage}

    \addchap*{Dedication}
    \pagenumbering{gobble}
    \doublespacing
    \lipsum[1]  

    \addchap*{Acknowledgments}
    \pagenumbering{gobble}
    \doublespacing
    \lipsum[1]

    \frontmatter    
    \listoftables
    \listoffigures
    \tableofcontents

    \chapter{Abstract}
    \lipsum[1]
    \mainmatter
    \chapter{A Chapter}
    \lipsum[1]  
    \section{Some Section}
    \lipsum*
    \lipsum[1]

    %Final product will have this item. It is also before the About the Author chapter
    \bibliographystyle{plain}
    \bibliography{thesis-ref}

    \backmatter
    \EndPageInToC
    \chapter{About the Author}
    \lipsum[1]

\end{document}

注意,我已将beforeskip章节的级别改为正值。因为beforeskip其他章节的级别也是正值,所以无需加载包indentfirst

\usepackage{tikz}
\ofoot*{\tikz[remember picture,overlay]\draw[red](current page.south)--+(0,.75in);}

在序言中,您可以看到页码的基线位于页面底部上方 0.75 英寸处(运行两次即可看到红线):

在此处输入图片描述

相关内容