.png)
Diese Frage wurde möglicherweise bereits gestellt, ich kann jedoch weder die Antwort finden noch darauf kommen.
Ich verwende diemuthesis
Vorlage zum Schreiben meiner Abschlussarbeit. Auf geraden Seiten wird der Kapiteltitel als „Kapitel x. Name des Kapitels“ angezeigt, auf ungeraden Seiten jedoch der Abschnittsname und die Abschnittsnummer.
Wie kann ich erreichen, dass mir auf ALLEN Seiten einfach „Kapitel x. Name des Kapitels“ angezeigt wird (plus Seitenzahl wie derzeit).
Ich vermute, dass dies mit Fancyhdr möglich ist, aber ich weiß nicht, wie das geht.
Bitte beachten Sie, dass ich ein doppelseitiges Dokument verwende.
Hoffe, jemand kann helfen!
Hier ist ein MWE:
\documentclass[11pt,PhD,twoside]{muthesis}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{todonotes}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{paralist}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{stackengine}
\usepackage[aboveskip=2pt]{subcaption} % aboveskipchanges spacing beten caption and figure
\usepackage{caption}
\captionsetup[subfigure] {justification=justified,singlelinecheck=false} %%% alignment of subfigure captions
\usepackage{pgfplotstable}
\usepackage[UKenglish]{datetime}
\usepackage{parskip}
\usepackage{booktabs}
\usepackage{colortbl}
\pgfplotstableset{col sep=comma}
\usepackage[none]{hyphenat}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{cite}
% for references\
\usepackage{natbib}
%\setlength{\bibhang}{5em}
%%%%%% Make font smaller
\renewcommand{\bibfont}{\normalfont\small}
%%% to sort out issues with urls
\usepackage[hyperindex,breaklinks]{hyperref}
\usepackage{cite}
\usepackage{graphics}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{booktabs}
\usepackage{url} % typeset URLs reasonably
\usepackage{listings}
%%%%%% section size
\usepackage[]{titlesec}
\titleformat{\section}
{\normalfont\fontsize{13}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\subsubsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsubsection}{1em}{}
%%%% Number of sections that are numbered increase
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
%%%%%%%%%%%%%%%
\begin{document}
\title{A thesis}
\author{AN Author}
\school{School of}
\faculty{Faculty}
\def\wordcount{57103}
\beforeabstract
\section*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\sloppy
\begin{spacing}{1.0}
\fontsize{12}{12}\normalfont
abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract
\end{spacing}
\afterabstract
\prefacesection{Acknowledgements}
I would like to thank......
\afterpreface
\chapter{Introduction}
\section{Background}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background2}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background3}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\end{document}
Antwort1
Ein paar Dinge:
Der einzige Grund, diese Klasse zu verwenden, besteht darin, dass Sie die darin implementierten institutionellen Anforderungen erfüllen müssen. Wenn dies der Fall ist, führt eine Änderung des Layouts dazu, dass Ihre Arbeit als unzulässig erachtet wird.
Wenn dies nicht der Fall ist, sollten Sie besser eine andere Klasse verwenden. Diese hier macht ganz deutlich, dass sie gegen die Regeln guter Typografie verstößt. Und das muss sie auch. Die institutionellen Anforderungen verlangen nach schlechter Typografie.
So wie es aussieht, wird Ihr Code nicht fehlerfrei kompiliert. Dies hängt eng mit dem nächsten Punkt zusammen.
Ihre Präambel ist ein einziges Durcheinander. Dadurch wird es schwieriger, Konsistenz sicherzustellen, die Wahrscheinlichkeit von Paketkonflikten wird erhöht, seltsame, mysteriöse Probleme sind fast sicher und es wird schwieriger, Probleme zu diagnostizieren, wenn sie unvermeidlich auftreten.
- Laden Sie ein Paket nicht mehr als einmal.
- Laden Sie insbesondere kein Paket mit unterschiedlichen Optionen.
- Laden Sie nicht mehrere Pakete, die dieselben Dokumentelemente auf unterschiedliche Weise formatieren, z. B.
enumitem
undparalist
;subcaption
undsubfig
. - Laden Sie keine überflüssigen Pakete, z. B. „
url
sowie“hyperref
;graphics
„sowie“graphicx
. - Achten Sie auf wichtige Bestellanforderungen, z. B.
hyperref
sollte eine verspätete Verladung erfolgen. - Verwenden Sie so viele Pakete wie Sie benötigen und nicht mehr als Sie brauchen.
Setzen Sie Ihre gesamte Abschlussarbeit nicht mit ,
\sloppy
es sei denn, Ihre Institution verlangt eine solche typografische Monstrosität ausdrücklich. (Das ist unwahrscheinlich: Ich habe nie gehört, dass sie dies verlangen, obwohl sie häufig typografische Monstrositäten anderer Art verlangen.)
Als Antwort auf die spezielle Frage: \afterpreface
Setzt den Seitenstil auf headings
. Durch Neudefinition dieses Befehls, um ihn auf zu setzen, fancy
werden fancyhdr
die Einstellungen wirksam:
Es folgt der vollständige Code mit einigen spezifischeren Anmerkungen. Ich habe versucht, Pakete mit ähnlicher Funktionalität zusammenzufassen, damit Sie leichter erkennen können, was Sie brauchen und was nicht. Wenn Sie nicht wissen, warum Sie ein Paket verwenden, kommentieren Sie es aus und prüfen Sie, ob dies Ihre Kompilierung unterbricht. Wenn nicht, können Sie wahrscheinlich darauf verzichten.
Ich habe jedoch fontenc
die T1
dringend empfohlene Schriftkodierung hinzugefügt, mit der Sie auch skalierbare Type1-Schriftarten erhalten.
\documentclass[11pt,PhD,twoside]{muthesis}
\usepackage[T1]{fontenc}% recommended
\usepackage{textcomp}
\usepackage{todonotes}
\usepackage{amsmath}
\usepackage{amstext}
% \usepackage{paralist}% enumitem provides similar functionality - stick to one interface
\usepackage{enumitem}
% tables
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}
% captions and floats
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage[aboveskip=2pt]{subcaption} % aboveskipchanges spacing beten caption and figure
\captionsetup[subfigure] {justification=justified,singlelinecheck=false} %%% alignment of subfigure captions
% \usepackage{subfig}% if you are using subcaption, don't try to use subfig, too - this way lies madness
\usepackage{stackengine}
% colour, graphics, diagrams
\PassOptionsToPackage{table}{xcolor}
\usepackage{graphicx}% don't load graphics as well - this covers it all already
\usepackage{pgfplotstable}
\pgfplotstableset{col sep=comma}
\usepackage[UKenglish]{datetime}
\usepackage{parskip}
\usepackage[none]{hyphenat}
\usepackage{lscape}
% for references
% \usepackage{cite}% do you really want this as well as natbib? they are likely to fight!
\usepackage{natbib}
%\setlength{\bibhang}{5em}
\renewcommand{\bibfont}{\normalfont\small}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{listings}
\usepackage[]{titlesec}
\usepackage{fancyhdr}
% to sort out issues with urls
% for latex
% \usepackage[hyperindex,breaklinks]{hyperref}% load late: loads url - no need to load separately
% for pdflatex, lualatex or xelatex
\usepackage[hyperindex]{hyperref}% load late: loads url - no need to load separately
\titleformat{\section}
{\normalfont\fontsize{13}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\subsubsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsubsection}{1em}{}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\def\afterpreface{\newpage
\pagestyle{fancy}}
\pagestyle{fancy}
\fancyhf{}
\renewcommand*\headrulewidth{0pt}
\fancyhf[leh,roh]{\thepage}
\fancyhf[loh,reh]{\slshape\leftmark}
\begin{document}
\title{A thesis}
\author{AN Author}
\school{School of}
\faculty{Faculty}
\def\wordcount{57103}
\beforeabstract
\section*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
% \sloppy% don't do this: It applies \sloppy to the rest of your document which is almost certainly not what you want
\begin{spacing}{1.0}
\fontsize{12}{12}\normalfont% is this a requirement? Because it will give you ugly output which is hard to read
abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract
\end{spacing}
\afterabstract
\prefacesection{Acknowledgements}
I would like to thank......
\afterpreface
\chapter{Introduction}
\section{Background}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background2}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background3}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\end{document}
Antwort2
Sie können jede Seite definieren, indem Sie jede Seite mit Optionen identifizieren, die die geraden und ungeraden Seitenzahlen sowie die Seite der Kopfzeile identifizieren, die Sie verwenden möchten. Dieses Format stammt aus einem Buch, an dem ich arbeite und bei dem die Kopfzeilen nach außen von den offenen Seiten verschoben werden.
\fancyhead{} % clear all header fields
\fancyhead[RO]{The Book Title} % [RO] here means Right/Odd numbered page
\fancyhead[LE]{\chaptername \ \thechapter} % {LE] here means Left/Even numbered page
Fügen Sie in Ihrem Fall \thepage ein, um Seitenzahlen dort einzufügen, wo Sie sie haben möchten.
\fancyhead{} % clear all header fields
\fancyhead[RO]{\chaptername \ \thechapter \ \thepage} % [RO] here means Right/Odd numbered page
\fancyhead[LE]{\chaptername \ \thechapter \ \thepage} % {LE] here means Left/Even numbered page