Page LayoutFancyfooter only showing pages without chapter begin

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm

Fancyfooter only showing pages without chapter begin

Post by kulima »

Hello

I have the following problem.
I am trying to make Header/Footer with fancyhdr. The Problem is, where a new chapter begins normal page numbering is shown, on pages without a new chapter i get the fancyfooter. Here is a sample document illustrating my issue.
See page 3 pagenumber is "normal" in the middle.
Page 4 and 5 are "correct" to the right with "Page X"
Furthermore i would like the Header showing "1. blablubb" not "Chapter 1. blablubb"

Code: Select all

\documentclass[12pt]{scrreprt}
\usepackage{palatino,url}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{enumitem}
\hypersetup{
	colorlinks=true,
	linkcolor=blue
}
\usepackage{mdwlist}
\usepackage{listings}
\usepackage{fancyhdr}
\usepackage{blindtext}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\cfoot{}
\fancyhead[R]{\textit{\leftmark}}           % page number in "outer" position of footer line
%\fancyfoot[RO,LO]{Message of the day}
%\fancyhead[L]{\textit{Inventory } }
\fancyfoot[R]{\textit{Page } \textit{\thepage}}


%\usepackage{scrpage2}
%\usepackage{titlepic}
\setuptoc{toc}{totoc}
\cleardoublepage
\begin{document}
\begin{titlepage}
\addcontentsline{toc}{chapter}{Cover}
   \centering
   \vspace*{6cm}
   {\fontsize{1.4cm}{1em}\mdseries
        fsfsd   
    }
    
    
    1. August 2015
  
    
    
   \vfill
    v. 1.2
\end{titlepage}
\tableofcontents

\chapter{blablubb}
\blindtext[5]
\Blindtext[5]

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Fancyfooter only showing pages without chapter begin

Post by kaiserkarl13 »

The \chapter command includes \thispagestyle{plain} (try \show\chapter to see everything else it does); you can override with \thispagestyle{fancy} right below the chapter heading. Or you can redefine the \chapter command.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fancyfooter only showing pages without chapter begin

Post by Johannes_B »

fancyhdr and KOMA-script are not best friends, you get a lot of warnings in the log file.

I recommend to use scrlayer-scrpage instead. This package is from the same developer and comes with the same bundle. It is easy to use.


Karl is right, pages that start a chapter are usually set with pagestyle empty (there is this big chapter title, no use in repeating it in the header once more), with KOMA-script this is more precisely chapterpagestyle.
You can change it to \renewcommand{\chapterpagestyle}{scrheadings} once you load package scrlayer-scrpage.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm

Fancyfooter only showing pages without chapter begin

Post by kulima »

Thanks for the Input.
I used to warning filled easy method with \thispagestyle and defined my own \fancypagestyle{}{} for the chapter pages.
Only problem was/is that the first ToC and first Appendecis pages user their own pagestyle? i guess? and the numbering is the "normal" way and dont obay \thispagestyle
So i replaced the\fancyfoot[C]{\textit{Page: } \textit{\thepage}} with \fancyfoot[C]{\thepage}, at least its consistent now.
I wonder why simple things must be so hard sometimes. Documention feels kind of lackluster presentation wise. I have not found an overview with all commands/functions of a given package with all parameters and options with a short description like i am used to from javadoc or basically any other programming language.
400 pages of documentations for a package seems overkill to do simple things quickly.
My first experience with LaTeX has been great so far, only drawback is the horrible documentation style. Guess needs some time getting used to this, or i am looking in the wrong places, which is very possible.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fancyfooter only showing pages without chapter begin

Post by Johannes_B »

Here a solution with KOMA-script

Code: Select all

\documentclass[12pt,
plainheadsepline,
headsepline]{scrreprt}
\usepackage{blindtext}
\usepackage{lmodern}
\usepackage[automark,markcase=upper]{scrlayer-scrpage}
\clearpairofpagestyles
\renewcommand{\pagemark}{%
  {\usekomafont{pagenumber}{%
Page~\thepage}}
}

\ofoot*{\pagemark}
\ohead{\leftmark}

\setuptoc{toc}{totoc}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue
}
\begin{document}
\begin{titlepage}
\addcontentsline{toc}{chapter}{Cover}
\centering
\vspace*{6cm}
{\fontsize{1.4cm}{1em}\mdseries
fsfsd  
}


1. August 2015



\vfill
v. 1.2
\end{titlepage}
\tableofcontents

\chapter{blablubb}
\blindtext[5]
\Blindtext[5]

\end{document}


Addressing the documentation issue: There are many many many thousand code snippets on the internet, providing solutions for every little minor hack a user wants. Some of the advice is good, some is outdated and some was never ever a good idea. How would a beginner judge?
Markus Kohm decided to pack the most needed changes up in one bundle and so the KOMA-classes grew as enhancements of the standard classes. Every little ready to use feature has to be documented, how else would you know about its existence?
memoir has done a quite similar way; the doc has 600 pages.

Because there are so many features bundled with KOMA-script, the doc is huge. That is why i recommended skimming the table of contents. I haven't read the whole thing. But i know where to look stuff up.

LaTeX has extension packages by over 2000 different authors, everybody has its own style of documenting stuff.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm

Re: Fancyfooter only showing pages without chapter begin

Post by kulima »

Hm, that looks more cleaned up than my solution ;)
Chapter pages are missing pagenumbering though, i guess i can overwrite this with \thispagestyle
Will give it a try later, thanks.
So using fancyhdr is to be avoided?

Well i get why the documentation looks that way, does not make it much better.
I have not found a docpage telling me which functions are available witch a given package and which options are available for each function, that's basically all i need. Burying options and functions spread out within wall of texts is not working, for me at least.
A more methodical, unified approach would be nice.
UNIX manpages are written by hundreds of developers and all look the same, easy to navigate through, easy to find what you need, good overview about parameters.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fancyfooter only showing pages without chapter begin

Post by Johannes_B »

You can use fancyhdr with KOMA-script, but it is not recommended. You wouldn't use parts of another company to fix your car, if you have spare parts from your manufacturer laying around, right ;-)


My code should get the page numbers on chapter start pages, the little asterisk is ensuring that. I'll upload the pdf generated by my code above.



Doc: Many people are different. The average user doesn't understand LaTeX-documentation. This is for a lack of attitude though. They see LaTeX as this complicated system, whereas it is really simple once you have got a good start.
You want some sort of cheat sheet, i sometimes wish something like that myself. The KOMA documentation is really in partnership with a printed and published book. That's why it is so verbose.
Attachments
kulimaHeaderFooter.pdf
(93.17 KiB) Downloaded 412 times
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm

Fancyfooter only showing pages without chapter begin

Post by kulima »

Hmm looks different in "OPEN IN WRITELATEX"
But yeah that looks good. The only thing i want gone is the horizontal bar on the chapter pages but should be there on the other pages ;)
With fancyhdr i did it with an extra style and the \renewcommand{\headrulewidth}{0pt} inside the \fancypagestyle{bla} Block. Then applied the style after every chapter entry.

I don't find LaTeX overly complicated, its pretty much straight forward, just some special cases are a bit hmm ...need getting used to, let's put it like that.
Just wished the documentation was a little more userfriendly ;)

Anyhow, converted my invoiced from libreoffice templates to LaTeX. Pretty happy with the outcome.
But i have to say, i cheated a bit and downloaded a template and modified it to my needs ;)
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fancyfooter only showing pages without chapter begin

Post by Johannes_B »

Oh, templates ... feel free to share your hopes and expectations concerning templates with me via PM. I am very interested in that matter with respect to get newcommers started.


The rule on chapter starting pages is done by global option plainseprule. Commenting it out will remove the line.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply