![\fancyfoot 在章节和宏中不起作用](https://linux22.com/image/367283/%5Cfancyfoot%20%E5%9C%A8%E7%AB%A0%E8%8A%82%E5%92%8C%E5%AE%8F%E4%B8%AD%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我使用模板编写了一个文档,在其中找到了用于章节表单的宏。问题是如何在章节页面中获取我想要的 \fancyfoot。示例:
代码:
\documentclass[a4paper, 12pt]{report}
\usepackage[font=small]{caption}
\usepackage[labelformat = empty,position=top]{subcaption}
\usepackage{amsmath, amsthm}
\usepackage{showkeys}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{shorttoc}
\usepackage{mathtools,amssymb,amsthm}
\usepackage{makeidx}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{eso-pic}
\usepackage{frcursive}
\usepackage[dvips,lmargin=2.5cm,rmargin=2.5cm,tmargin=2.5cm,bmargin=2.5cm]{geometry}
\usepackage{tocloft}
\usepackage{titlesec}
\usepackage{fancybox}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{frcursive}
\usepackage{minitoc}
\usepackage[Style]{fncychap}
\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{\chaptername~}
\renewcommand{\cftchapaftersnum}{~-}
\renewcommand{\cftchapnumwidth}{7em}
\usepackage{lastpage}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{hyperref}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage{blindtext}
\usepackage[final]{pdfpages}
\usepackage{enumitem}
\usepackage{array,multirow,makecell}
%\setcellgapes{1pt}
%\makegapedcells
\usepackage[table]{xcolor}
\usepackage{float}
\renewcommand{\seyesDefault}{\color{blue}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}
\linespread{1.5}
\date{}
\sloppy
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\makeatletter
\newcounter {subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection .\@alph\c@subsubsubsection}
\newcommand\subsubsubsection{\@startsection{subsubsubsection}{4}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\newcommand*\l@subsubsubsection{\@dottedtocline{3}{10.0em}{4.1em}}
\newcommand*{\subsubsubsectionmark}[1]{}
\makeatother
%%%%%%%%%%%%%%%%%%%style%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill
\kern \z@}
\def\@makechapterhead#1{%
%\vspace*{50\p@}%
\vspace*{10\p@}%
%{\parindent \z@ \centering \reset@font \thickhrulefill\quad
{\parindent \z@ \centering \thickhrulefill\quad
\scshape \@chapapp{} \thechapter \quad \thickhrulefill
\par\nobreak
\vspace*{10\p@}%
\interlinepenalty\@M \hrule
\vspace*{10\p@}%
\Huge \bfseries #1\par\nobreak
\par
\vspace*{10\p@}%
\hrule
%\vskip 40\p@
\vskip 100\p@ }}
\def\@makeschapterhead#1{%
%\vspace*{50\p@}%
\vspace*{10\p@}%
%{\parindent \z@ \centering \reset@font \thickhrulefill
{\parindent \z@ \centering \thickhrulefill
\par\nobreak
\vspace*{10\p@}%
\interlinepenalty\@M \hrule
\vspace*{10\p@}%
\Huge \bfseries #1\par\nobreak
\par
\vspace*{10\p@}%
\hrule
%\vskip 40\p@
\vskip 100\p@ }}
\renewcommand{\footrulewidth}{1pt}
\fancyfoot[C]{\textit{- \thepage\ -}}
\fancyfoot[L]{Thèse de Doctorat}
\fancyfoot[R]{\footnotesize{Name of }}
\begin{document}
\input{Abstract.tex}
\end{document}
答案1
章节的第一页使用plain
页面样式,因此您必须重新定义它:
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\renewcommand{\footrulewidth}{1pt}
\fancyfoot[C]{\textit{- \thepage\ -}}
\fancyfoot[L]{Thèse de Doctorat}
\fancyfoot[R]{\footnotesize{Name of }}
}%
无关:您应该将其hyperref
作为最后一个包加载,只有极少数例外。此外,从 3.9 版开始,语言选项babel
应与 \ documentclass 一起加载,以便所有依赖语言的包都知道您文档的主要语言。
最后一点:如果您使用个人宏重新定义您的部分布局,则没有必要加载titlesec
。