1

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}
  • You are writing a thesis (final report). Let me guess, every section should start on a new page? How about using a documentclass that does what you want by default? It is called report and uses \chapters. – Johannes_B Jun 11 '16 at 11:39
  • But isn't report a Koma-class? I am a total newbie in Latex, so I really don't know. – Patty-B Jun 11 '16 at 11:42
  • 1
    article, report and book are standard classes. All of them have KOMA-equivalents (which you can use, but don't have to). I recommend to read LaTeX for complete novices to get a good start. – Johannes_B Jun 11 '16 at 11:46
  • I changed my document class and now there are some things different, which I will figure out, still I have problems with the question above, since the first pages of the chapter still look bad. Can you help? – Patty-B Jun 12 '16 at 11:08
  • What are you using now? Can you update the code example? – Johannes_B Jun 12 '16 at 14:07
4

An alternative package to fancyhdr is scrlayer-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.

\documentclass[a4paper,12pt,
%draft
]{report}

\usepackage[utf8]{inputenc} % utf8 reicht zu
\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% add a bit for the head
]{geometry}
\usepackage{lettrine}
\usepackage{indentfirst}
\usepackage{poetrytex}


% An alternative to fancyhdr
\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}
\usepackage{setspace}
\usepackage{epigraph}
\setlength\epigraphwidth{0.75\textwidth}
\setlength\epigraphrule{0pt}
\renewcommand{\epigraphsize}{\small}
\renewcommand{\afterepigraphskip}{12pt}
\usepackage[]{acronym}


\usepackage{blindtext}%
\usepackage{xcolor}%
\usepackage{hyperref}% at the end


\begin{document}
\listoffigures
\blinddocument
\begin{figure}
\caption{Wombat}
\end{figure}
\end{document}

I made a few other changes and marked them with a short comment.

  • If you don't need all the packages, comment them out (and eventually delete them). Keeps things sorted nicely. The longer the preamble, the more confusing it gets. – Johannes_B Jun 12 '16 at 15:21
  • Thanks a lot. Now – when I comment out the draft mode – it prints the section titles, but gives me these warnings: Package scrlayer Error: cannot define \newpagestyle'. } and Package scrlayer Error: cannot define \renewpagestyle'. } – Patty-B Jun 13 '16 at 9:34
  • What also happens is, that it only prints the section name of my List of Figures, but doesn't change the section's name, although I entered the \clearpage command after the page, where I print my List of Figures. – Patty-B Jun 13 '16 at 9:36
  • 2
    You need to load package scrlayer-scrpage before titlesec. For the other stuff, please update the question to show the issue. – Johannes_B Jun 13 '16 at 16:05
  • Ok, I did this. – Patty-B Jun 13 '16 at 16:24

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.