.png)
이 질문은 이미 요청되었을 수도 있지만 답변을 찾거나 알아낼 수 없는 것 같습니다.
나는muthesis
내 논문을 작성하기 위한 템플릿입니다. 이는 짝수 페이지의 장 제목을 "Chapter x. Name of Chapter"로 제공하지만 홀수 페이지에는 섹션 이름과 번호를 제공합니다.
어떻게 하면 모든 페이지에 "Chapter x. 장 이름"(현재 페이지 번호 포함)만 제공할 수 있나요?
나는 이것이 fancyhdr을 사용하여 수행될 수 있다고 생각하지만 이를 수행하는 방법을 모르겠습니다.
저는 양면 문서를 사용하고 있습니다.
누군가가 도울 수 있기를 바랍니다!
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}
답변1
몇 가지 사항:
이 클래스를 사용하는 유일한 이유는 이 클래스가 구현하는 기관 요구 사항을 충족해야 한다는 것입니다. 이 경우 레이아웃을 변경하면 귀하의 작업이 허용되지 않는 것으로 간주됩니다.
그렇지 않은 경우에는 다른 클래스를 사용하는 것이 훨씬 더 좋습니다. 이것은 좋은 타이포그래피 규칙을 위반한다는 사실을 매우 명백하게 보여줍니다. 그래야 합니다. 제도적 요구 사항은 잘못된 타이포그래피를 요구합니다.
현재로서는 코드가 오류 없이 컴파일되지 않습니다. 이는 다음 포인트와 밀접하게 연결됩니다.
당신의 서문은 엉망입니다. 이로 인해 일관성을 보장하기가 더 어려워지고, 패키지가 충돌할 가능성이 높아지고, 이상하고 알 수 없는 문제가 거의 확실해지며, 문제가 불가피하게 발생할 경우 진단하기가 더 어려워집니다.
- 패키지를 두 번 이상 로드하지 마세요.
- 특히, 옵션이 다른 패키지를 로드하지 마세요.
- 동일한 문서 요소를 다른 방식으로 형식화하도록 설계된 여러 패키지를 로드하지 마십시오(예:
enumitem
및paralist
).subcaption
그리고subfig
. url
예 를 들어 불필요한 패키지를 로드하지 마십시오hyperref
.graphics
게다가graphicx
.- 중요한 주문 요구 사항(예:
hyperref
늦게 로드되어야 함)에 주의를 기울이십시오. - 필요한 만큼의 패키지를 사용하고 필요한 것 이상을 사용하지 마십시오.
\sloppy
귀하의 기관에서 그러한 인쇄상의 괴물을 명시적으로 요구하지 않는 한 전체 논문을 조판하지 마십시오 . (그렇지 않을 것 같습니다. 다른 종류의 인쇄상의 괴물이 자주 필요함에도 불구하고 이것을 요구한다는 이야기를 들어본 적이 없습니다.)
특정 질문에 대한 답변으로 \afterpreface
페이지 스타일을 로 설정합니다 headings
. 이 명령을 재정의하여 설정을 적용하면 다음과 fancy
같습니다 fancyhdr
.
좀 더 구체적인 주석이 포함된 전체 코드는 다음과 같습니다. 나는 필요한 것과 필요하지 않은 것을 더 쉽게 확인할 수 있도록 유사한 기능을 제공하는 패키지를 그룹화하려고 노력했습니다. 패키지를 사용하는 이유를 모르는 경우 주석 처리하여 컴파일이 중단되는지 확인하세요. 그렇지 않다면 아마도 그것 없이도 할 수 있을 것입니다.
fontenc
그러나 저는 적극 권장되는 글꼴 인코딩을 얻기 위해 추가했으며 T1
확장 가능한 type1 글꼴도 얻을 수 있습니다.
\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}
답변2
사용하려는 헤더의 측면은 물론 짝수 및 홀수 페이지 번호를 식별하는 옵션으로 각 측면을 식별하여 각 측면을 정의할 수 있습니다. 이 형식은 열린 페이지의 '외부'에 헤더를 푸시하는 작업 중인 책에서 가져온 것입니다.
\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
귀하의 경우에는 원하는 곳에 페이지 번호를 삽입하려면 \thepage를 포함시키십시오.
\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