页脚内间距 (fancyhdr)

页脚内间距 (fancyhdr)

我如何才能精确地创建以下空间/距离? 在此处输入图片描述

Margin from bottom to footerrule: 22mm
Distance from footerule to text: 5mm
Distance from Footerrule to top of footertext: 7mm

当前状态: 在此处输入图片描述

梅威瑟:

\documentclass[14pt,oneside,a4paper]{article}
\usepackage[
  a4paper,
  left = 16mm,
  right = 16mm,
  textwidth = 178mm,
  top = 20mm,
  bottom= 22mm, % 22m lower bound + 5mm footer to text
  % headheight=17pt, % as per the warning by fancyhdr
  % includehead,
  % includefoot,
  heightrounded, % to avoid spurious underfull messages
  headheight=0mm,%
  headsep=0mm,%
]{geometry}
\usepackage[english]{babel}
\usepackage{blindtext}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Necessary packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\renewcommand\familydefault{\sfdefault}
\usepackage{ngerman}
\usepackage[scaled]{uarial}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{xcolor}
\usepackage{ifthen}
\setlength{\parindent}{0em}
\setlength{\parskip}{0em}
% \renewcommand{\baselinestretch}{0.0}
\usepackage{enumitem}
\usepackage[geometry]{ifsym}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header and Footer Format
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \let\footruleskip\undefined %undefine footruleskip
\usepackage{fancyhdr}
\usepackage{calc}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.25mm}
\renewcommand{\footrule}{\hbox to\headwidth{\color{black}\leaders\hrule height \footrulewidth\hfill}}
\renewcommand{\footruleskip}{5mm} % 7
\setlength{\footskip}{5mm + 0.25mm + 7mm + 2.5mm}
\pagestyle{fancy}
\fancyhf{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Custom Footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fancyfoot[L]{
  % \vfill
  \textbf{
      {\fontsize{9}{14}\selectfont SOME TITLE}
  }
}
\fancyfoot[R]{
  % \vfill
  \makebox[86mm][r]{%
       {\fontsize{9}{14}\selectfont Contact: [email protected]}
    \hfill
       {\fontsize{9}{14}\selectfont www.example.com}
  }%
}


\begin{document}
\Blinddocument
\end{document}

答案1

我通过以下代码实现了我的要求。

定义footskipgeometry因为7mm + 1em我需要7mm空间和一行文本。

\usepackage[%
  a4paper,%
  left = 16mm,%
  right = 16mm,%
  textwidth = 178mm,%
  top = 20mm,%
  bottom= 22mm,%
  heightrounded,% to avoid spurious underfull messages
  headheight=0mm,%
  headsep=0mm,%
  footskip=7mm+8pt,%
  % showframe
]{geometry}

之后,我修改了我的fancyhdr设置,如下所示:

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.25mm}
\renewcommand{\footruleskip}{7mm}
\makeatletter
\patchcmd{\footrule}
  {\if@fancyplain}
  {\color{gray}\if@fancyplain}
  {}
  {}
\makeatother
\pagestyle{fancy}
\fancyhf{}

我在和正文5mm之间添加了附加内容,并在每页的最后一个元素中添加了一个额外内容(在我的情况下始终是相同的元素)。footrule\vspace{5mm}

相关内容