我怎样才能让 fancyhdr 相信我的标题高度为零?

我怎样才能让 fancyhdr 相信我的标题高度为零?

我将标题放在外边距中,这样它们就不会占用任何垂直空间。我本想使用 来实现这一点\vbox to 0pt{...},但fancyhdr没买。以下是错误消息:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
Make it at least 15.60004pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.

我不知道 15.60004pt 这个数字从何而来,也不知道如何以不占用任何垂直空间的方式编写标题。MWE 括起来;关键宏是\nrlefthead。(该示例并不简单,但将所有命名长度替换为文字长度会使其难以阅读。)

\documentclass[twoside]{book}

\newdimen\blockwidth
\newdimen\blockheight

\blockwidth=120mm
\blockheight=220mm

\usepackage{etex}

\usepackage[twoside,top=10mm,body={\blockwidth,\blockheight}]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL]{\nrlefthead}
\renewcommand\headrulewidth{0pt}

\newdimen\nrheaddrop
\nrheaddrop=1.5in

\newdimen\nrleftheadrightmargin
\setlength\nrleftheadrightmargin{-20mm}

\newdimen\myheadwidth
\setlength{\myheadwidth}{180pt}

\newcommand\nrlefthead{%
  \vbox to 0pt{\vspace*{\nrheaddrop}%
               \llap{\parbox{\myheadwidth}%
                         {\raggedright\noindent\itshape
                         \nouppercase{\leftmark}}%
                         \hspace*{\nrleftheadrightmargin}}%
               \vss}}


\renewcommand\chaptermark[1]{\markboth{#1}{}}


\usepackage{lipsum}

\begin{document}

\chapter{An innocuous title}

\lipsum[23-30]
\end{document}

答案1

\vbox如果您不知道的话,请避免。

\documentclass[twoside]{book}

\newdimen\blockwidth
\newdimen\blockheight

\blockwidth=120mm
\blockheight=220mm

\usepackage[twoside,top=10mm,body={\blockwidth,\blockheight}]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL]{\nrlefthead}
\renewcommand\headrulewidth{0pt}

\newdimen\nrheaddrop
\nrheaddrop=1.5in

\newdimen\nrleftheadrightmargin
\setlength\nrleftheadrightmargin{-20mm}

\newdimen\myheadwidth
\setlength{\myheadwidth}{180pt}

\newcommand\nrlefthead{%
  \parbox[t][0pt]{\textwidth}{%
    \vspace*{\nrheaddrop}%
    \llap{%
      \parbox[b]{\myheadwidth}{%
        \raggedright\noindent\itshape
        \nouppercase{\leftmark}%
      }%
      \hspace*{\nrleftheadrightmargin}%
    }%
  }%
}


\renewcommand\chaptermark[1]{\markboth{#1}{}}


\usepackage{lipsum}

\begin{document}

\chapter{An innocuous title}

\lipsum[23-50]
\end{document}

相关内容