At the moment, I am trying to enhance the layout of my thesis. I want to include a header, in which the subsection title is on the right side. But it should only appear at the pages that do not start a new section. So e.g., if the introduction starts at page 2, the subsection title should first appear at page 3 and so on.
For page 2, I choose \pagestyle{plain}
, for the rest of the document \pagestyle{fancy}
. Now the document either prints the subsection title at every page or at non at all. How can I solve this problem? (Code-Update)
\documentclass[a4paper,12pt,draft]{report}
\usepackage{ucs}
\usepackage[utf8x]{inputenc} % Eingabekodierung: UTF-8
\usepackage[T1]{fontenc} % ordentliche Trennung
\usepackage[french,USenglish,UKenglish,ngerman]{babel}
\usepackage{blindtext}
\usepackage{lmodern} % ordentliche Schriften
\usepackage[babel,style=swiss,maxlevel=3,threshold=3]{csquotes}
\usepackage{extsizes}
\usepackage{graphicx}
\usepackage{float}
\usepackage[top=2.5cm,bottom=3.5cm,left=2.5cm,right=4cm]{geometry}
\usepackage{hyperref}
\usepackage{lettrine}
\usepackage{indentfirst}
\usepackage{poetrytex}
\usepackage{titlesec}
\titlespacing{\chapter}{0pt}{24pt}{12pt}
\titlespacing{\section}{0pt}{24pt}{12pt}
\titlespacing{\subsection}{0pt}{24pt}{12pt}
\usepackage{setspace}
\usepackage{epigraph}
\setlength\epigraphwidth{0.75\textwidth}
\setlength\epigraphrule{0pt}
\renewcommand{\epigraphsize}{\small}
\renewcommand{\afterepigraphskip}{12pt}
\usepackage[]{acronym}
\usepackage{hyperhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\renewcommand{\headrulewidth}{0pt}
\rhead{\rightmark}
\lhead{}
\rfoot{\thepage}
\pagestyle{plain}
\fancyhf{}
\rfoot{\thepage}
% \pagestyle{fancyplain}
% \renewcommand{\headrulewidth}{0pt}
% \fancyhf{}
% \rhead{\rightmark}
% \lhead{}
% \rfoot{\thepage}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
...
\end{document}
In my document, I am using chapters and sections now. Yet, what I still didn't manage is to print the section titles at the top right and to omit them on the first page of each chapter. Another problem is, that the page number prints on the center bottom of every first page of a chapter.
Another Code-Update
So, this is how my code looks now, there is one last issue to solve: When I compile my document, it only sets the title of the first section in the header, but not the subsequent ones, so there is always the same section's name. Another tiny question for me is, what the \textheight=250pt
does, because when I use it, the first page of each chapter only contains the chapter's title, and a few lines of text. Then, when I look at the titlesec
part, I see this:
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{\chaptertitlename\thechapter}{14pt}{\Large}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesection}{14pt}{\large}
What exactly does [display] mean and why do I have do write 14pt and \Large
in curvy brackets? My goal here is to print the chapter name in my normal font in size 14pt.
This is my whole code:
\documentclass[a4paper,12pt]{report}
\usepackage{ucs}
\usepackage[utf8x]{inputenc} % Eingabekodierung: UTF-8
\usepackage[T1]{fontenc} % ordentliche Trennung
\usepackage[french,USenglish,UKenglish,ngerman]{babel}
\usepackage{blindtext}
\usepackage{lmodern} % ordentliche Schriften
\usepackage[babel,style=swiss,maxlevel=3,threshold=3]{csquotes}
\usepackage{extsizes}
\usepackage{graphicx}
\usepackage{float}
\usepackage[top=2.5cm,bottom=3.5cm,left=2.5cm,right=4cm,headheight=14.5pt]{geometry}
%\usepackage{fancyhdr}
\usepackage{lettrine}
\usepackage{indentfirst}
\usepackage{poetrytex}
\usepackage{setspace}
\usepackage{epigraph}
\setlength\epigraphwidth{0.75\textwidth}
\setlength\epigraphrule{0pt}
\renewcommand{\epigraphsize}{\footnotesize}
\renewcommand{\beforeepigraphskip}{12pt}
\renewcommand{\afterepigraphskip}{12pt}
\usepackage[]{acronym}
\usepackage{hyperref}
\makeatletter %sorgt dafür, dass die Fußnoten am linken Rand nicht überstehen, sondern mit dem Horizontalstrich gemeinsam schließen.
\renewcommand{\@makefntext}[1]{
\parindent 1em%
\noindent\normalfont\@thefnmark~#1
}
\makeatother
% \textheight=\vfill% just for the example
\usepackage[markcase=ignoreupper]{scrlayer-scrpage}
\clearpairofpagestyles
\automark[section]{section}
\ohead{\headmark}
\ofoot*{\pagemark}
\usepackage{titlesec}
\titlespacing{\chapter}{0pt}{24pt}{12pt} % damit wird der Abstand vor und nach Kapiteln und (Sub-)Sections geregelt
\titlespacing{\section}{0pt}{24pt}{12pt}
\titlespacing{\subsection}{0pt}{24pt}{12pt}
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{\chaptertitlename\thechapter}{14pt}{\Large}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesection}{14pt}{\large}
\usepackage{hyperref}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ok, here's my MWE
\documentclass[a4paper12pt]{article}
\usepackage[utf8x]{inputenc} % Eingabekodierung: UTF-8
\usepackage[T1]{fontenc} % ordentliche Trennung
\usepackage[french,USenglish,UKenglish,ngerman]{babel}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{relsize}
\usepackage{acronym}
\usepackage[top=2.5cm,bottom=3.5cm,left=2.5cm,right=4cm,headheight=14.5pt,footnotesep=1cm]{geometry}
\usepackage[markcase=ignoreupper]{scrlayer-scrpage}
\clearpairofpagestyles
\automark[section]{section}
\ohead{\headmark}
\ofoot*{\pagemark}
\usepackage{titlesec}
\titlespacing{\chapter}{0pt}{24pt}{12pt}
\titlespacing{\section}{0pt}{24pt}{12pt}
\titlespacing{\subsection}{0pt}{24pt}{12pt}
\titleformat{\chapter}[display] % why here display and why not with \subsection?
{\normalfont\Large\bfseries}
{\chaptertitlename\thechapter}{14pt}{\Large}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesection}{14pt}{\large}
\begin{document}
\thispagestyle{empty}
\newgeometry{top=2.5cm,bottom=3.5cm,left=2.5cm,right=4cm}
\restoregeometry
{\large \tableofcontents}
\clearpage
\newpage
% \thispagestyle{fancyplain}
\pagenumbering{roman}
\setcounter{page}{2}
\phantomsection
\subsection*{}
\addcontentsline{toc}{section}{Abbildungsverzeichnis}
\listoffigures
% \printacronyms{Abkürzungsverzeichnis} mit dem Acro-Package vertraut machen und dann das Abkürzungsverzeichnis schreiben
\phantomsection
\subsection*{Abkürzungsverzeichnis}
\addcontentsline{toc}{section}{Abkürzungsverzeichnis}
\begin{acronym}[Dahlhaus, GS10abc]
\acro{Hello World}[Hello World]{Hello World}
\end{acronym}
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%The problem lies somewhere here, after the above page with my list of figures, it only prints the List of Figures in the header, but not the subsequent sections' names.
% \pagestyle{fancy}
% \thispagestyle{fancyplain}
\phantomsection
\chapter{Einleitung}
\addcontentsline{toc}{chapter}{Einleitung}
\onehalfspacing
\pagenumbering{arabic}
\setcounter{page}{3}
\section{Hello}
\section{World}
\end{document}
Best Answer
An alternative package to
fancyhdr
isscrlayer-scrpage
. It can do what you want. Though i have to admit, i have no idea why you want the section titles in the header.I made a few other changes and marked them with a short comment.