控制页脚和正文之间的间隙

控制页脚和正文之间的间隙

因为这是 A6 尺寸,所以尝试最大化文本主体。但我还需要一个在其下方留有一定空间的页脚。我怎样才能缩小两者之间的差距?在此示例中,为了清楚起见,我怎样才能将页脚保留在其当前位置,但将“Nulla malesuada porttitor diam...”放在第 2 页而不是第 3 页?

\documentclass[a6paper]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[hmargin=1em, tmargin=2em ,bmargin=5.5em]{geometry}
\usepackage{lastpage}
\usepackage{lipsum} % Dummy Text
\usepackage{scrlayer-scrpage}
\usepackage{lastpage}
\usepackage{tabularx}
\usepackage{hyperref}

\renewcommand*\familydefault{\sfdefault}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

%\KOMAoptions{
%%This has no effect, why?<---
%  headsepline=false,
%  footsepline=false
%%--------------------------->  
%}
%\pagenumbering{gobble}
\pagestyle{scrheadings}
%Just a more flexible alternative to lofoot+roofoot
\cfoot{\begin{tabularx}
    {\textwidth}
    {@{}l@{}R@{}}
    Foo
    & \thepage/\pageref{LastPage}\end{tabularx}}

\begin{document}
\title{Lorem Ipsum}
\author{Dolor S. Amet}
\maketitle
\lipsum

\clearpage
\pagestyle{empty}

\vspace*{\fill}

\begin{center}Page with no header\end{center}

\vspace*{\fill}

\end{document}

射击

答案1

如果您不想更改整个文档,您可以\enlargethispage{value}在想要添加更多文本的页面上发出一个。

对于影响整个文档的更改,您可以依赖 的scrreprt内部计算。使用\setlength{footskip}{24pt}并将DIV因子设置为高值。例如,DIV=20给出您要求的分页符:

在此处输入图片描述

\documentclass[a6paper, DIV=20]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{lipsum} % Dummy Text
\usepackage{scrlayer-scrpage}
\usepackage{tabularx}
\usepackage{hyperref}

\setlength{\footskip}{24pt}
\renewcommand*\familydefault{\sfdefault}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

%\KOMAoptions{
%%This has no effect, why?<---
%  headsepline=false,
%  footsepline=false
%%--------------------------->  
%}
%\pagenumbering{gobble}
\pagestyle{scrheadings}
%Just a more flexible alternative to lofoot+roofoot
\cfoot{\begin{tabularx}
    {\textwidth}
    {@{}l@{}R@{}}
    Foo
    & \thepage/6\end{tabularx}}

\begin{document}
\title{Lorem Ipsum}
\author{Dolor S. Amet}
\maketitle
\lipsum

\clearpage
\pagestyle{empty}

\vspace*{\fill}

\begin{center}Page with no header\end{center}

\vspace*{\fill}

\end{document}

答案2

您可以通过以下方式减少bmargin和:\footskip\baselineskip

\documentclass[a6paper]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[hmargin=1em, tmargin=2em ,
  bmargin=\dimexpr5.5em-\baselineskip\relax% <- changed
]{geometry}
\addtolength{\footskip}{-\baselineskip}% <- added
\usepackage{lastpage}
\usepackage{lipsum} % Dummy Text
\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\usepackage{lastpage}
\usepackage{tabularx}
\usepackage{hyperref}

\renewcommand*\familydefault{\sfdefault}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

\cfoot{\begin{tabularx}
  {\textwidth}
  {@{}l@{}R@{}}
  Foo
  & \thepage/\pageref{LastPage}\end{tabularx}}

\begin{document}
\title{Lorem Ipsum}
\author{Dolor S. Amet}
\maketitle
\lipsum

\clearpage
\pagestyle{empty}
\vspace*{\fill}
\begin{center}Page with no footer\end{center}% header would be outside of the page ;-)
\vspace*{\fill}
\end{document}

结果:

在此处输入图片描述


补充说明:headseplinefootsepline分别是启用、禁用或调整页眉下方和页脚上方规则的宽度和高度的选项。默认情况下,页眉和页脚中没有规则,因此headsepline=falsefootsepline=false在您的示例中不起作用。

相关内容