0

Is There any way to add the following items :

  • My name
  • name of my university
  • Date of class
  • Name of class
  • Name of my professor
  • Logo

to each page of Book

\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}
  • Yes, there are way, but please be more specific what you want to put where and where does the text come from (do some of the data change etc.). – TeXnician Dec 17 '17 at 18:25
  • any suggestion will be acceptable. – Educ Dec 17 '17 at 18:27
  • The commands of fancyhdr package allow you to set variable content of headers and footers. You can first define something such as \newcommand\dateofclass[1]{put class date here} then use \dateofclass within the \fancyhead and \fancyfoot commands. – user139954 Dec 17 '17 at 18:39
  • @RobtAll Could you write your suggestion as an answer – Educ Dec 17 '17 at 18:42
1

The commands of fancyhdr package allow you to set variable content of headers and footers. This can even be done dynamically, changing from place to place within a book.

For example:

\newcommand\dateofclass{put class date here}
\fancyhead[position]{\dateofclass}

If the document contains several different dates, you may:

\renewcommand\dateofclass{another class date}

at any time, and the new date will be applied from that point onward, until you change it again.

You may even do this when you have multiple page styles (that is, more than just defining `fancyhead' as a page style).

  • when i complied it gives me some error besides where are the other elements My name name of my university Date of class Name of class Name of my professor Logo – Educ Dec 17 '17 at 18:52
  • @Educ Have a look at the code for novel document class (you may need to download it). In file novel-HeadFootStyles.sty this is implemented, and it works for text and (small) images. The file will be in (texmf)/tex/lualatex/novel. That particular code is for a large book, where individual chapters might have headings that depend upon chapter title and author, but it can be extended at will. – user139954 Dec 17 '17 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.