Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using documentclass scrrept and fancyheader headlines.

The problem is that on every page where a new chapter starts, here are no headers. Only the page no is shown in the middle of the footer. But I would like to have the header on each page.

\documentclass[12pt, bibliography=totoc]{scrreprt}

\usepackage{ngerman}
\usepackage[T1]{fontenc}
\usepackage[isolatin]{inputenc}

\usepackage{graphicx}
\usepackage[german]{varioref}
\usepackage{moreverb}

\usepackage{lastpage}
\usepackage{fancyhdr}



\renewcommand{\baselinestretch}{1.5}
\setlength{\oddsidemargin}{0.8cm}
\setlength{\evensidemargin}{0.8cm}
\setlength{\textwidth}{14cm}
\setlength{\textheight}{23cm}
\setlength{\topmargin}{-0.8cm}
\setlength{\parindent}{0pt}

\begin{document}



\pagestyle{fancy}

\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,LO]{Thorsten Sohn, 1076041}

\fancyhead[CE,CO]{\thepage\ von \pageref{LastPage}}
share|improve this question
add comment

2 Answers 2

You should set your document margins with package geometry or typearea! And also do not set the baselinestretch explicitely, use package setspace:

\documentclass[12pt, twoside]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage[german]{varioref}
\usepackage{moreverb}
\usepackage{lastpage,lipsum}
%----------------------------------------   
\usepackage[total={14cm,23cm},top=0.8cm,includehead]{geometry}
\usepackage{setspace}\onehalfspacing

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,LO]{Thorsten Sohn, 1076041}
\fancyhead[CE,CO]{\thepage\ von \pageref{LastPage}}
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyhead[LE,LO]{Thorsten Sohn, 1076041}
  \fancyhead[CE,CO]{\thepage\ von \pageref{LastPage}}
}
%---------------------------------------- 
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

\begin{document}
\chapter{first}
\lipsum[1-6]
\end{document}
share|improve this answer
add comment

At the begining of a new chapter the plain page style is used by default. If you want headers on chapter pages also, you may have to redefine the pagestyle plain.

\documentclass[12pt, bibliography=totoc]{scrreprt}
\usepackage{ngerman}
\usepackage[T1]{fontenc}
\usepackage[isolatin]{inputenc}
\usepackage{graphicx}
\usepackage[german]{varioref}
\usepackage{moreverb}
\usepackage{lastpage,lipsum}
\usepackage{fancyhdr}
%----------------------------------------   
\renewcommand{\baselinestretch}{1.5}
\setlength{\oddsidemargin}{0.8cm}
\setlength{\evensidemargin}{0.8cm}
\setlength{\textwidth}{14cm}
\setlength{\textheight}{23cm}
\setlength{\topmargin}{-0.8cm}
\setlength{\parindent}{0pt}
%---------------------------------------- 
\begin{document}
%---------------------------------------- 
%Redefine pagestyle {plain}
\fancypagestyle{plain}{%
  %% Clear all headers and footers
  \fancyhf{}
  \fancyhead[LE,LO]{Thorsten Sohn, 1076041}

\fancyhead[CE,CO]{\thepage\ von \pageref{LastPage}}
}
%---------------------------------------- 
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,LO]{Thorsten Sohn, 1076041}
\fancyhead[CE,CO]{\thepage\ von \pageref{LastPage}}
%---------------------------------------- 
\chapter{first}
\lipsum[1-6]
%---------------------------------------- 
\end{document}

enter image description here

Since you are using koma script, it is advisable to use scrpage2 to design headers and footers. This gives almost all the benefits of fancyhdr and more flexible for use.

\documentclass[12pt, bibliography=totoc,plainheadsepline,plainheadtopline]{scrreprt}
%------------------------------------------------
\usepackage{ngerman}
\usepackage[T1]{fontenc}
\usepackage[isolatin]{inputenc}
%------------------------------------------------
\usepackage{graphicx}
\usepackage[german]{varioref}
\usepackage{moreverb}
\usepackage{lastpage,lipsum}
\usepackage{scrpage2}%<-----here
%------------------------------------------------
\renewcommand{\baselinestretch}{1.5}
\setlength{\oddsidemargin}{0.8cm}
\setlength{\evensidemargin}{0.8cm}
\setlength{\textwidth}{14cm}
\setlength{\textheight}{23cm}
\setlength{\topmargin}{-0.8cm}
\setlength{\parindent}{0pt}
%------------------------------------------------
\begin{document}
%------------------------------------------------
%% Clear all headers and footers
\clearscrheadings
\clearscrplain
\clearscrheadfoot
%------------------------------------------------
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%------------------------------------------------
\cehead[\thepage\ von \pageref{LastPage}]{\thepage\ von \pageref{LastPage}}
\cohead[\thepage\ von \pageref{LastPage}]{\thepage\ von \pageref{LastPage}}
\lehead[Thorsten Sohn, 1076041]{Thorsten Sohn, 1076041}
\lohead[Thorsten Sohn, 1076041]{Thorsten Sohn, 1076041}
\setheadwidth[0pt]{head}
\setheadtopline{2pt}
\setheadsepline{.4pt}
%------------------------------------------------
\pagestyle{scrheadings}
%------------------------------------------------
\chapter{First chapter}
\section{First section}
\lipsum[1-6]
%------------------------------------------------
\end{document}

enter image description here

Please refer to scrguien.pdf page number 110 chapter 4 and sections 4.1 with 4.1.1 for more details.

share|improve this answer
    
I’m very convinced, that Thorsten is a natural German language speaker. So for him scrguide.pdf is the better choice. ;-) There (manual for KOMA-Script 3.10) scrpage2 is described in chapter 5. –  Speravir Apr 3 '12 at 17:28
    
@ThorstenSohn: See my comment above. –  Speravir Apr 3 '12 at 17:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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