Page LayoutHeader too long

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Kalle
Posts: 7
Joined: Tue Feb 09, 2010 7:00 pm

Header too long

Post by Kalle »

Hey everybody,
a friend of mine is writing her PhD-thesis and has problems with the document's header: the header is longer than the text. It's always exceeding on the right side.
I tried various approaches without any solution...The used document class is "scrreprt", the text two sided. The first solution was with the "fancyhdr"-package:
\fancyhead{}
\fancyfoot{}
\fancyhead[EL]{{\thepage}\hspace{1cm}\mbox{\leftmark}}
\fancyhead[OR]{{\leftmark}\hspace{1cm}\mbox{\thepage}}
\renewcommand{\chaptermark}[1]
{\markboth{#1}{}}

Then I tried the "scrpage2":
\usepackage[headsepline,automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\setheadsepline[text]{.4pt}
\lehead{\pagemark\hspace{1cm}\mbox{\leftmark} }
\rohead{\leftmark\hspace{1cm}\mbox{\pagemark} }

But without luck. Does anybody know what to do in order to resize the header to the text width?!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header too long

Post by localghost »

At first, please use the code environment to tag code as such. This keeps a post clear and legible. Secondly, only provide full examples which are compilable for everyone, called a minimal working example (MWE). Code snippets are useless.

Your friend may use the optional short form for the chapter title.

Code: Select all

\chapter[short form for list and header entry]{full chapter title for display}
Note that the short form is also listed in the ToC.

It is preferable to use the scrpage2 package when using a class from KOMA Script. But the described problem doesn't depend on that.


Best regards and welcome to the board
Thorsten
Kalle
Posts: 7
Joined: Tue Feb 09, 2010 7:00 pm

Re: Header too long

Post by Kalle »

Hey,
sorry for my mistakes. I am new here and did not know how to do that...
As for the answer, the problem is not that the chapter name is too long but the header itself. No matter how short the chapter name is the header always exceed the text block by roughly 1 cm on the right.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header too long

Post by localghost »

Kalle wrote:[...] As for the answer, the problem is not that the chapter name is too long but the header itself. No matter how short the chapter name is the header always exceed the text block by roughly 1 cm on the right.
As I already said, a MWE that shows the problem is required for specific help. I wonder where you got the code for the header from.
Kalle
Posts: 7
Joined: Tue Feb 09, 2010 7:00 pm

Header too long

Post by Kalle »

sorry..totally forgot to attache that:

Code: Select all

% ---------------------------------------------------------------------------------------------------------------------Vorspann
\documentclass[a4paper,12pt,twoside,abstracton,bibliography=totoc]{scrreprt}

\usepackage[ngerman,english,american]{babel}  % Sprachen
\usepackage[T1]{fontenc}   % Trennung
\usepackage[latin1]{inputenc} % Umlaute
\usepackage[ngerman, num]{isodate}
\hyphenation{NMDAR
		      NMDARs
		      tri-he-te-ro-meric
		      iono-tropic
		      non-selective}
%\monthyearsepgerman{\,}{\,}

%Seitenlayout
%\usepackage{fancyhdr} %Layout Kopfzeile
%\pagestyle{fancy} %eigenen Seitenstil aktivieren
%\fancyhead{} %Felder loeschen
%\fancyfoot{} %Felder loeschen
%\fancyhead[EL]{\thepage} %Kopfzeile linke Seite, gerade Seitenzahlen links aussen
%\fancyhead[ER]{\leftmark} %Kopfzeile linke Seite, Kapitel rechts innen
%\fancyhead[OR]{\thepage} %Kopfzeile rechte Seite, ungerade Seitenzahlen rechts aussen
%\fancyhead[OL]{\leftmark} %Kopfzeile rechte Seite, Kapitel links innen
%\fancyhead[EL]{{\thepage}\hspace{1cm}\mbox{\leftmark}} %linke Seite, gerade Seitenzahlen links aussen, Kapitel daneben
%\fancyhead[OR]{{\leftmark}\hspace{1cm}\mbox{\thepage}} %rechte Seite, ungerade Seitenzahlen rechts aussen, Kapitel daneben
%\renewcommand{\chaptermark}[1]%
%{\markboth{#1}{}}		%Kopfzeile: nur Kapitelueberschrift (Befehle unten klappen nicht)

%\renewcommand\chaptermark[1]{\markboth{\leftmark{#1}}{}} %nur Kapitelname wird angezeigt
%\renewcommand\chaptermark[1]{\markboth{\thechapter.~{#1}}{}} %nur Kapitelname wird angezeigt
%\renewcommand{\headrulewidth}{0.3pt} %Liniendicke
%\setlength{\headwidth}{0.9\textwidth}
%\fancypagestyle{plain}{%
%\fancyhf{}
%\fancyhead[EL]{\thepage}
%\fancyhead[OR]{\thepage}} %pagestyle plain umdefinieren, damit bei chapterseiten in Kopfzeile Seitenzahl steht 
%\renewcommand*{\chapterheadstartvskip}{\vspace*{-\topskip}} %kleinerer Abstand Kopfzeile-chapter
%\renewcommand*{\chapterheadendvskip}{\vspace*{-\topskip}} %kleinerer Abstand chapter-Text


\usepackage[headsepline,automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot %Kopf und Fußzeile löschen

\setheadsepline[text]{.4pt}

\lehead{\pagemark\hspace{1cm}\mbox{\leftmark} }
\rohead{\leftmark\hspace{1cm}\mbox{\pagemark} }


\usepackage{SIunits}
\usepackage[comma,sort&compress]{natbib} %Referenzen einfuegen ueber \citep{} (Autor, Jahr)
\bibpunct{(}{)}{;}{a}{,}{,} %Definition der Zitierweise
\usepackage{amsmath} %Matheformeln, Symbole:amsymb
\usepackage{dsfont} %schoenere Buchstaben bei Formeln
\usepackage{graphicx} %Graphiken als jpeg einbinden mit \includegraphics{}
\usepackage{float} %exakte Angabe derPositionierung von Tabellen und Graphiken in figure und table Umgebungen [H]
\usepackage{placeins}					% Floatbarrier, Bilder/Tabellen werden vor einem bestimmten Punkt eingefügt
\usepackage{sidecap}
\usepackage{rotating} %drehende Umgebung
\usepackage{multicol,longtable,rotate} %mehrspaltiger Text, mehrseitige Tabellen
\usepackage{lscape} %Querformat
\usepackage{geometry} %Beeinflussung von Seitenraendern
\usepackage{appendix} %neue Nummerierung etc. fuer Anhang
\usepackage[labelfont=bf, font=small,format=plain,labelformat=simple,justification=justified,singlelinecheck=false,figurewithin=none,tablewithin=none,figurename=Fig.]{caption}


\usepackage{setspace} %Umstellen von Zeilenabstaenden
\onehalfspacing %1.5 facher Zeilenabstand
\usepackage{hyperref} %erzeugt hyperlinks im pdf




%---------------------------------------------------------------------------------------------------------Beginn Dokument

\begin{document}

\input{Deckblatt}
\newpage

\input{titlepage}
\newpage

\thispagestyle{empty}
\null\newpage

\input{declaration}
\newpage

\thispagestyle{empty}
\null\newpage

\input{Zusammenfassung}
\newpage

\selectlanguage{american}

\input{summary}
\newpage


\input{tableofcontents}
\newpage

\pagenumbering{arabic}
\input{introduction}
\newpage

\input{results}
\newpage

\input{methods}
\newpage

\input{Abbreviations}

\bibliographystyle{jphysiol}

\bibliography{NMDAthesis}

\end{document}


User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header too long

Post by localghost »

That is not a MWE! Please follow carefully the instructions behind link I gave earlier.

It seems that the document language is German. In this case the language options for babel should be swapped.

Code: Select all

\usepackage[english,american,ngerman]{babel}  % Sprachen, die letzte ist Voreinstellung
Kalle
Posts: 7
Joined: Tue Feb 09, 2010 7:00 pm

Header too long

Post by Kalle »

Hopefully this qualifies as an MWE...

Code: Select all

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

\usepackage[ngerman,english,american]{babel}  
\usepackage[T1]{fontenc}  
\usepackage[latin1]{inputenc} 
\usepackage[ngerman, num]{isodate}

%Seitenlayout
%\usepackage{fancyhdr} 
%\pagestyle{fancy}
%\fancyhead{}
%\fancyfoot{}
%\fancyhead[EL]{{\thepage}\hspace{1cm}\mbox{\leftmark}}
%\fancyhead[OR]{{\leftmark}\hspace{1cm}\mbox{\thepage}}
%\renewcommand{\chaptermark}[1]
%{\markboth{#1}{}}

\usepackage[headsepline,automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot %Kopf und Fußzeile löschen

\setheadsepline[text]{.4pt}

\lehead{\pagemark\hspace{1cm}\mbox{\leftmark} }
\rohead{\leftmark\hspace{1cm}\mbox{\pagemark} }

\usepackage{geometry} 

\begin{document}

\chapter{Introduction}
\section{Signal transmission in the central nervous system}
 
 ...long text...
 
 \section{Ionotropic glutamate receptors}
 \subsection{Classification of ionotropic glutamate receptors}

...long text...

\subsection{Structure of ionotropic glutamate receptors}

...long text....

\chapter{Results}

...long text... 

\end{document}
And for the language: even though she is German (and me too...) the thesis is written in english
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header too long

Post by localghost »

Kalle wrote:And for the language: even though she is German (and me too...) the thesis is written in english
Seems that I was irritated by the names of the externals files.

Compiling your code I can't see any headers thus can't comprehend the problem. Therefore I can only guess. Perhaps deleting the \mbox in the header setting might solve the problem. This is all I can advice at the moment.

Supplement:
Finally I was able to locate the source of the problem. See code below.

Code: Select all

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

\usepackage[ngerman,english,american]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman, num]{isodate}
\usepackage{blindtext}

%Seitenlayout
%\usepackage{fancyhdr}
%\pagestyle{fancy}
%\fancyhead{}
%\fancyfoot{}
%\fancyhead[EL]{{\thepage}\hspace{1cm}\mbox{\leftmark}}
%\fancyhead[OR]{{\leftmark}\hspace{1cm}\mbox{\thepage}}
%\renewcommand{\chaptermark}[1]
%{\markboth{#1}{}}

\usepackage[headsepline,automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot %Kopf und Fußzeile löschen

%\setheadsepline[text]{.4pt}

\lehead{\pagemark\hspace{1cm}\mbox{\leftmark} }
\rohead{\leftmark\hspace{1cm}\mbox{\pagemark} }

\usepackage{geometry}

\begin{document}
\Blinddocument
\end{document}
The command for the line below the head is used wrongly. I guess you want to have the line at a certain thickness. So abandon the optional argument. Explained on page 135 of the KOMA Script manual (English version).
Kalle
Posts: 7
Joined: Tue Feb 09, 2010 7:00 pm

Re: Header too long

Post by Kalle »

Thank for your tip but that does not solve the problem..the header is still exceeding the text ( see attached pictures)
Attachments
Odd side
Odd side
picture2.jpg (40.17 KiB) Viewed 11331 times
Even side
Even side
picture1.jpg (48.03 KiB) Viewed 11331 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Header too long

Post by localghost »

I supplemented my last reply. See the explanations there.
Post Reply