有没有办法添加以下项目:
- 我的名字
- 我的大学名称
- 上课日期
- 班级名称
- 我的教授的名字
- 标识
到书的每一页
\documentclass[12pt]{book}
\usepackage{amsmath,mathtools}
\usepackage{fancyhdr}
\usepackage{textcase}
\usepackage{emptypage}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[Lenny]{fncychap} % Lenny, Conny ,Bjarne, Rejne, Glenn, Sonny
\usepackage[margin=1in,a4paper]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{xpatch}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{fancybox}
\usepackage{pifont}
\usepackage{enumitem}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\ChapterShift
\newlength\PageShift
\newlength\StripeWd
% the verticle shift for the chapter title from the upper border of the page
\setlength\ChapterShift{1.5cm}
% the vertical shift for the page number from the lower border of the page
\setlength\PageShift{1.5cm}
% the width of the vertical stripe
\setlength\StripeWd{1.5cm}
% the color of the stripe
\colorlet{StripeColor}{gray!60}
% the font for chapter title in the stripe
\def\ChapterFont{\color{white}\LARGE\sffamily}
% the font for page number in the stripe
\def\PageFont{\color{white}\LARGE\bfseries}
\pagestyle{fancy}
\renewcommand\chaptermark[1]{\markboth{\MakeTextUppercase{#1}}{}}
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyhead[OR]{%
\begin{tikzpicture}[remember picture,overlay]
\fill[StripeColor]
(current page.north east)
rectangle
([xshift=-\StripeWd]current page.south east);
\node[
inner sep=0pt,
anchor=north west,
font=\ChapterFont,
rotate=-90
]
at ([xshift=-0.4\StripeWd,yshift=-\ChapterShift]current page.north east)
{\leftmark};
\node[
inner sep=0pt,
anchor=north,
font=\PageFont,
]
at ([xshift=-0.5\StripeWd,yshift=\PageShift]current page.south east)
{\thepage};
\end{tikzpicture}%
}
\fancyhead[EL]{%
\begin{tikzpicture}[remember picture,overlay]
\fill[StripeColor]
(current page.north west)
rectangle
([xshift=\StripeWd]current page.south west);
\node[
inner sep=0pt,
anchor=south east,
font=\ChapterFont,
rotate=90
]
at ([xshift=0.6\StripeWd,yshift=-\ChapterShift]current page.north west)
{\leftmark};
\node[
inner sep=0pt,
anchor=north,
font=\PageFont,
]
at ([xshift=0.5\StripeWd,yshift=\PageShift]current page.south west)
{\thepage};
\end{tikzpicture}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ù
\definecolor{myblue}{RGB}{0,0,122}
\newcommand\DoPToC{%
\startcontents[chapters]
\printcontents[chapters]{}{1}{\noindent{\color{myblue}\rule{\textwidth}{1.5pt}}\par\medskip}%
\noindent{\color{myblue}\rule{\textwidth}{1.5pt}}}
\setlength\epigraphrule{0pt}
\renewcommand\textflush{flushright}
\renewcommand\epigraphsize{\normalsize\itshape}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\maxtocdepth{subsection}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\begin{document}
\chapter{Class of 12/17/2017 }
\epigraph{Created by Mohcine}{}
\DoPToC
\section{1}
\lipsum
\section{2}
\lipsum
\end{document}
答案1
包中的命令fancyhdr
允许您设置页眉和页脚的可变内容。这甚至可以动态地完成,在一本书中随位置而变化。
例如:
\newcommand\dateofclass{put class date here}
\fancyhead[position]{\dateofclass}
如果文档包含多个不同的日期,您可以:
\renewcommand\dateofclass{another class date}
任何时候,新的日期将从那时起应用,直到您再次更改它。
当您有多个页面样式时您甚至可以这样做(也就是说,不仅仅是将“fancyhead”定义为页面样式)。