1

I'm trying to find our,why my fancyhdr is not working on every page. Could someone pls give me a hint.

merci in advance A

\documentclass[
a4paper,
 openany,%removes blank pages between chapters
11pt,% The default document font size, options: 11pt
]{book}% The class file specifying the document structure
\usepackage[T1]{fontenc}%zeigt umlaute richtig an
\usepackage[default,light,bold]{sourceserifpro}%Source Serif Pro Light
\usepackage[utf8]{inputenc}%erlaubt Umlaute
\usepackage[margin=1in,headsep=2in]{geometry}% provides an interface to page dimensions like setting margins
\usepackage{amsmath}% these packages allow much of the mathematical formatting
\usepackage{amssymb}% these packages allow much of the mathematical formatting
\usepackage{hyphenat}%can dis­able all hy­phen­ation or en­able hy­phen­ation of non-al­pha­bet­ics or monospaced fonts
\usepackage{fancyhdr}%provides an easy way to place text on the top and/or bottom of every page
\usepackage[ngerman,british,USenglish]{babel} %lädt die deutsche Sprache
\usepackage{graphicx}% lets you determine how to import external graphics 
\usepackage{multicol}%de­fines a mul­ti­cols en­vi­ron­ment which type­sets text in mul­ti­ple columns
\usepackage{booktabs}%fancy tables
\usepackage{array}%ex­tends the op­tions for col­umn for­mats, and pro­vides "pro­grammable" for­mat spec­i­fi­ca­tions
\usepackage{xcolor}%pro­vides easy driver-in­de­pen­dent ac­cess to sev­eral kinds of color tints, shades, tones, and mixes of ar­bi­trary col­ors
\usepackage{caption}%allows to cus­tomise the cap­tions in float­ing en­vi­ron­ments like fig­ure and ta­ble
 \usepackage{minitoc}
\usepackage{setspace} % setting of linespacing
\usepackage{multirow}%provides a construction for table cells that span more than one row of the table
\usepackage{upquote}%mod­i­fies the be­haviour of ver­ba­tim*and \verb* to print in the “` and ' way”, fixes the " and '
\usepackage{vmargin}% provides macros for setting document margin
\usepackage{acronym}  %intoc = nomcl auch im toc anzeigen
\usepackage[automake, nopostdot]{glossaries}
 \makeglossaries


\setglossarystyle{listgroup}


\newglossaryentry{latex}
{
  name=latex,
 description={Is a mark up language specially suited for 
scientific documents}
}

\newglossaryentry{maths}
{
        name=mathematics,
        description={Mathematics is what mathematicians do}
}


\linespread{1.0} % sets the inter-line spacing in a document



\clearpage
\setlength{\headsep}{1pt}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancyhead[LE,RO]{\leftmark}

\fancyhead[RE,LO]{\documentnumber~Rev.~\currentrevision}
\fancyfoot[LE,RO]{\thepage}% LeftEven,RightOdd
\fancyfoot[LO,CE]{A.Rose}% LeftOdd, CenterEven
\fancyfoot[CO,RE]{\today} % CenterOdd,RightEven
}

\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter.\ #1}{}}

\def \currentrevision{A}
\def \documentnumber{\bfseries Baselining-001}




\begin{document}

\begin{titlepage}
\begin{center}
\vspace{1cm}
% \includegraphics[scale = 0.15]{enclogo.png}   \\[1.0cm] % energicos logo
 \vspace{2cm}

\line(1,0){400}\\[1mm]
\huge{\textbf{Baselining mittels Retrograder Ermittlung von Heizlasten über diskrete Betriebsstunden}}\\[3mm]

\end{center}
\end{titlepage}
\dominitoc
\tableofcontents
%\setcounter{page}{1}}

\newpage

\chapter*{List of Symbols}
\begin{doublespace}
\begin{longtable}{>{\centering\arraybackslash}p{3cm} p{11cm}}\toprule
\textbf{Symbol} & \textbf{Erläuterung} \\\midrule
${Q_{Tag}}$&  Warmwasserbedarf in kWh je Tag (Durchschnitt)\\
${Q_{Periode}}$ &  Anteil Base\\
$\beta$ &  Warmwasserbedarf in kWh je Jahr (historischer gemessener Wert)\\
${D_{Periode}}$ & Service Fee/ Dienstleistungsgebühr\\
${\dot{Q}}_{WW}$ &  Speicherwärmemenge\\
$z$ &  Spitzenlast  für  die Warmwasserbereitstellung (Leistung in Bedarfszeitraum)\\
$Q$ &  maximale Leistung des Wärmeerzeugers)\\
${z_{norm}}$ & Referenzzeitraum ist immer eine Stunde (${z_{norm}}$ = 1 h aka 60 min)\\
$z_{Auheiz}$ & Warmwasservorrangbetriebszeit \\
$Q$  & größte Wärmebedarf zur Warmwassererzeugung (nach Warmwasserprofil z.B. am Morgen mit 22 kWh)\\
${\dot{Q}}_{WW}$ &  Spitzenlast  für  die Warmwasserbereitstellung (Leistung in Bedarfszeitraum)\\
${\dot{Q}}_{WEA}$ &  maximale Leistung des Wärmeerzeugers)\\
$\frac{z}{z_{norm}}$ & Zeitraum Bedarfzeit für Spitzenbedarf Warmwasser zu 1 Stunde\\
${z_{norm}}$ & Referenzzeitraum ist immer eine Stunde (${z_{norm}}$ = 1 h aka 60 min)\\
$Q$ &  Speicherwärmemenge\\
${\dot{Q}}_{WW}$ &  Spitzenlast  für  die Warmwasserbereitstellung (Leistung in Bedarfszeitraum)\\
${\dot{Q}}_{WEA}$ &  maximale Leistung des Wärmeerzeugers)\\
$\frac{z}{z_{norm}}$ & Zeitraum Bedarfzeit für Spitzenbedarf Warmwasser zu 1 Stunde\\
${z_{norm}}$ & Referenzzeitraum ist immer eine Stunde (${z_{norm}}$ = 1 h aka 60 min)\\
$Q$ &  Speicherwärmemenge\\
${\dot{Q}}_{WW}$ &  Spitzenlast  für  die Warmwasserbereitstellung (Leistung in Bedarfszeitraum)\\
${\dot{Q}}_{WEA}$ &  maximale Leistung des Wärmeerzeugers)\\
$\frac{z}{z_{norm}}$ & Zeitraum Bedarfzeit für Spitzenbedarf Warmwasser zu 1 Stunde\\
${z_{norm}}$ & Referenzzeitraum ist immer eine Stunde (${z_{norm}}$ = 1 h aka 60 min)\\
${\dot{Q}}_{WW}$ &  Spitzenlast  für  die Warmwasserbereitstellung (Leistung in Bedarfszeitraum)\\
$\frac{z}{z_{norm}}$ & Zeitraum Bedarfzeit für Spitzenbedarf Warmwasser zu 1 Stunde\\
\bottomrule
\end{longtable}
\end{doublespace}
\captionof{table}{List of Symbols}\label{tbl:nicetablelesstable}


\chapter*{Abkürzungsverzeichnis}
\begin{acronym}[SEPSEP]%SEPSEP gibt den Absatz
\acro{z}[Z]{Zellen}
\acro{mh}[MH]{Maus}
\end{acronym}

\newpage
\listoffigures % Prints the list of figures

\newpage

\listoftables % Prints the list of tables

\newpage


\printglossaries

\newpage


\chapter{Prämissen des Modells}
\minitoc

\newpage
\section{Grundannahmen zum Modell diskrete Betriebsstunden}\label{modell-diskrete-betriebsstunden}


\begin{itemize}
\item
  hierbei wird immer auf die bisherigen gemessenen Verbrauchswerte
  abgestellt

\end{itemize}

The \Gls{latex} typesetting markup language is specially suitable 
for documents that include \gls{maths}. 


\section{Prämissen/ Annahmen des Modells}\label{i.-pruxe4missen-annahmen-des-modells}
\subsection{Raumheizung}

  \begin{itemize}
  \item
    es wird angenommen, dass der Wärmeerzeuger auf die maximale Heizlast
    für das Gebäude ausgelegt ist, das heißt in der Stunde in der die
    \end{itemize}


\subsection{Prämissen Warmwasserbereitung}

  \begin{itemize}
  \item
    dabei wird davon ausgegangen, daß die Warmwasserbereitung in
  \end{itemize}

\newpage

    \begin{itemize}
    \item
      unterbricht während der Trinkwassererwärmung, d. h. während der
      Aufheizung des Warmwasserspeichers, die Raumbeheizung
   \end{itemize}

\subsection{ PrämissenHydraulischer Abgleich}

  \begin{itemize}
  \item
    das System ist hydraulisch abgeglichen
  \end{itemize}


\end{document}
14
  • 2
    Make a minimal compilable example demonstrating your problem. And don't ask two question at once. Apr 12, 2018 at 13:53
  • 2
    Welcome ! Please follow Ulrike Fischer's advice to provide a MWE. See minimal working example (MWE) to see how to do it properly
    – BambOo
    Apr 12, 2018 at 13:59
  • 1
    How is that minimal? float, xfrac, multicol, soul etc has nothing to do with the headers/fancyhdr
    – daleif
    Apr 12, 2018 at 14:04
  • 2
    still not minimal, but have you checked tex.stackexchange.com/questions/116950/… and tex.stackexchange.com/questions/267792/…? plain is not used for all the pages, some are empty...
    – Rmano
    Apr 12, 2018 at 14:18
  • 2
    I bet 100 € that you don't need \usepackage{eurosym} to show a problem with the headers. Apr 12, 2018 at 14:36

1 Answer 1

3

The problem is straightforward: you have redefined the pagestyle plain, but plain is not used on most pages. For most pages the style used is headings, although the best thing to do is to define myheadings and set \pagestyle{myheadings}

\fancypagestyle{myheadings}{%
\fancyhf{}
  \renewcommand{\headrulewidth}{0.5pt}
  \renewcommand{\footrulewidth}{0pt}
  \addtolength{\headheight}{0.5pt}
  \fancyhead[LE,RO]{\leftmark}
  \fancyhead[RE,LO]{WHAT I WANT TO SEE}}

\pagestyle{myheadings}

You will probably want to put your footer stuff back in there too. I took it out, pedantically, because your complaint was about headings.

Now a MINIMAL example is not "anything it needs to make my document compile" but simply "anything I need to reproduce this problem using as few packages as possible". For future record, you can demonstrate your problem using only the code below. You could have got there, as I did, by removing packages and recompiling. I realise it's not always easy to guess what the issue is, but if you have more than a few packages you don't have an MWE.

\documentclass[a4paper,openany,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{}
  \renewcommand{\headrulewidth}{0.5pt}
  \renewcommand{\footrulewidth}{0pt}
  \addtolength{\headheight}{0.5pt}
  \fancyhead[LE,RO]{\leftmark}
  \fancyhead[RE,LO]{WHAT I WANT TO SEE}}


\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter.\ #1}{}}

\begin{document}

\chapter{Prämissen des Modells}

Header is correct on this page.

\newpage

\section{Grundannahmen zum Modell diskrete Betriebsstunden}

And wrong on this one.
\end{document}

(That's 73 words/262 characters, where you had 889/6852. And in fact one could get rid of both fontenc and inputenc by making one other change!)

7
  • +1 for the code golf aspect of your answer :) You could save some more characters by making the chapter and section titles shorter :) Apr 12, 2018 at 16:36
  • 1
    Also a4paper and 11pt are not necessary for the "minimal working answer" :) Apr 12, 2018 at 16:38
  • Dear Paul, thank you very much. I will definitely reduce the characters to a min in the future, sorry I'm still a beginner, so I'm still getting used to the rules here. But as said, totally understand your point. as for the solution: it only works half for me. I used your code and swapped it against mine but for the first pages (toc, List of figures etc.) no header is showing. Do you have any idea, why would that be? merci
    – aerioeus
    Apr 12, 2018 at 16:40
  • Dear Paul, adding to my earlier commment, when I try to set the pagestyle after a \newpage and hence add \thispagestyle{myheadings} nothing happens. Do you have any idea, what the reason could be? merci in advance A
    – aerioeus
    Apr 12, 2018 at 16:54
  • 1
    So long as you are sure you don't want ever to have a different header and footer on the first page of a chapter, you are OK simply defining plain and setting the headings to it. IMO, generally, it looks better to leave chapter openings plain. But you are in charge and there's no technical reason that I know of to object to it. Apr 12, 2018 at 20:58

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.