Cabeçalhos de tese em látex como mostrar apenas o nome do capítulo em todas as páginas (frente e verso)

Cabeçalhos de tese em látex como mostrar apenas o nome do capítulo em todas as páginas (frente e verso)

Esta pergunta pode já ter sido feita, mas não consigo encontrar a resposta ou descobrir isso.

estou usando omuthesismodelo para escrever minha tese. Isso fornece o título do capítulo nas páginas pares como "Capítulo x. Nome do capítulo", mas nas páginas ímpares fornece o nome e o número da seção.

Como posso fazer isso, basta fornecer o "Capítulo x. Nome do capítulo" em TODAS as páginas (mais o número da página como está atualmente).

Suspeito que isso possa ser feito com o fancyhdr, mas não sei como fazer isso.

Observe que estou usando um documento frente e verso.

Espero que alguém possa ajudar!

Aqui está um 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}

Responder1

Um par de coisas:

  • A única razão para usar esta classe é que você precisa satisfazer os requisitos institucionais que ela implementa. Se for esse o caso, a alteração do layout fará com que o seu trabalho seja considerado inadmissível.

  • Se este não for o caso, seria melhor usar uma classe diferente. Este é bastante explícito quanto ao fato de violar as regras da boa tipografia. Tem que ser. As exigências institucionais exigem uma tipografia pobre.

  • Do jeito que está, seu código não é compilado sem erros. Isto está intimamente ligado ao próximo ponto.

  • Seu preâmbulo é uma bagunça. Isso torna mais difícil garantir a consistência, aumenta as chances de conflitos de pacotes, torna quase certos problemas estranhos e misteriosos e torna mais difícil diagnosticar problemas quando eles ocorrem inevitavelmente.

    • Não carregue um pacote mais de uma vez.
    • Principalmente, não carregue um pacote com opções diferentes.
    • Não carregue vários pacotes projetados para formatar os mesmos elementos do documento de maneiras diferentes, por exemplo, enumiteme paralist; subcaptione subfig.
    • Não carregue pacotes supérfluos, por exemplo, urlassim como hyperref; graphicsassim como graphicx.
    • Preste atenção aos requisitos importantes do pedido, por exemplo, hyperrefdeve ser carregado com atraso.
    • Use quantos pacotes forem necessários e não mais do que o necessário.
  • Não escreva toda a sua tese, \sloppya menos que sua instituição exija explicitamente tal monstruosidade tipográfica. (Isso não é provável: nunca ouvi falar deles exigindo isso, embora frequentemente exijam monstruosidades tipográficas de outros tipos.)

Em resposta à pergunta específica, \afterprefacedefine o estilo da página como headings. Redefinir este comando para defini-lo fancypermite que fancyhdras configurações entrem em vigor:

propagação dupla

Segue código completo com algumas anotações mais específicas. Tentei agrupar pacotes que fornecem funcionalidades semelhantes para tornar mais fácil ver o que você precisa e o que não precisa. Se você não sabe por que está usando um pacote, comente e veja se isso prejudica sua compilação. Se não, você provavelmente poderá passar sem ele.

No entanto, adicionei fontencpara obter a T1codificação da fonte, que é altamente recomendada e também fornecerá fontes type1 escalonáveis.

\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}

Responder2

Você pode definir cada lado identificando cada lado com opções que identificam os números de página pares e ímpares, bem como o lado do cabeçalho que deseja usar. Este formato é de um livro em que estou trabalhando, que empurra os cabeçalhos para o 'fora' das páginas abertas.

\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

No seu caso, inclua \thepage para inserir os números das páginas onde desejar.

\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

informação relacionada