为什么 \chapter 会阻塞页脚?

为什么 \chapter 会阻塞页脚?

为什么我在文档中添加章节时不显示脚注?

该代码有效:

\documentclass[10pt,french]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[hidelinks]{hyperref}
\usepackage{tikz,pgf} %package used for drawing
\usepackage{color}
    \setlength{\parindent}{0pt}
    \usetikzlibrary{calc}
\usepackage{lmodern}% http://ctan.org/pkg/lm
    \usetikzlibrary{backgrounds}
\usepackage{cite}
\usepackage{fancyhdr}
\pagestyle{fancy}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\sffamily
\section{Section}
\end{document}

这个不起作用:

\documentclass[10pt,french]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[hidelinks]{hyperref}
\usepackage{tikz,pgf} %package used for drawing
\usepackage{color}
    \setlength{\parindent}{0pt}
    \usetikzlibrary{calc}
\usepackage{lmodern}% http://ctan.org/pkg/lm
    \usetikzlibrary{backgrounds}
\usepackage{cite}
\usepackage{fancyhdr}
\pagestyle{fancy}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\sffamily
\chapter{Not working}%just added this line
\section{Section}
\end{document}

答案1

章节页面plain默认使用页面样式。包fancyhdr不会plain自动重新定义。您可以使用以下任一方式\fancypagestyle{plain}{...}重新定义普通样式:

\documentclass{report}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{a fancy page}
\newcommand*\fancyrulewidth{.4pt}
\renewcommand*\headrulewidth{\fancyrulewidth}
\renewcommand*\footrulewidth{\fancyrulewidth}

\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[R]{\thepage}
  \fancyfoot[L]{a plain page}% different settings for plain pages
  \renewcommand*\headrulewidth{\fancyrulewidth}
  \renewcommand*\footrulewidth{\fancyrulewidth}
}

\begin{document}
\chapter{Not working}
\section{Section}
\clearpage
\section{Another section}
\end{document}

结果:

在此处输入图片描述

或者您可以使用页面样式fancyplain

\documentclass{report}

\usepackage{fancyhdr}
\pagestyle{fancyplain}% redefines the plain style too
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{\fancyplain{a plain page}{a fancy page}}% <- example for different settings for plain and fancy pages

\newcommand*\fancyrulewidth{.4pt}
\renewcommand*\headrulewidth{\fancyrulewidth}
\renewcommand*\footrulewidth{\fancyrulewidth}
\renewcommand*\plainheadrulewidth{\fancyrulewidth}
\renewcommand*\plainfootrulewidth{\fancyrulewidth}

\begin{document}
\chapter{Not working}
\section{Section}
\clearpage
\section{Another section}
\end{document}

结果和上面一样。

相关内容