当章节名称成功出现在左上角时,没有显示页码,也没有显示章节名称

当章节名称成功出现在左上角时,没有显示页码,也没有显示章节名称

我正在撰写硕士论文报告,并试图将章节名称放在页面的左上角,将章节名称放在页面的右上角,将页码放在页面的底部中央。在更改页面几何形状和页面设置包第 n 次之后,我能够将章节名称放在页面的左上角,但现在我无法将页码或章节名称放在右侧。有什么办法可以解决这个问题吗?我通常只会发布我的页面几何形状和页面设置包,但现在为了方便您,我还发布了我的整个根文档。请帮忙。这是我正在使用的根文档。

\documentclass[twoside=false,12pt]{scrbook}    
 %twoside=false--->both pages look the  same
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{~}


%%GRAPHICS PACKAGES
%%----------------------------------------------------------------------
%%----------------------------------------------------------------------
\usepackage{graphicx}               %needed for the insertion of graphics, 
remove draft for final script.
\graphicspath{{./Images/}}            %needed for choosing the image path
\usepackage{subcaption}         %needed for allowing captioning of images
\setcapindent{0cm}                   %indents the caption borders to zero
\usepackage{float}                           %allows using [H] for images
\usepackage[font={small}]{caption} %image captions in different fonts
%\usepackage{float}
%\floatstyle{boxed} 
%\restylefloat{figure}          %defines a border for all the float images
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

%%PAGE GEOMETRY and PAGE SETUP, as in header/footer/footnote
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------
\usepackage[a4paper, bindingoffset=6mm]{geometry} 
\usepackage{fancyhdr}
\pagestyle{fancy}
%%\fancyhead{}
%%\lhead{Chapter \thechapter}
%%\rhead{}
%\renewcommand{\sectionmark}[1]{% 
%   \markboth{\thesection\quad #1}{}}
%\fancyhead{}
%\fancyhead[L]{\leftmark}
%\fancyfoot{}
%\fancyfoot[C]{\thepage}
\fancyfoot[C]{\thepage}
\cfoot{\thepage}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\fancyhf{}
\fancyhead[RE]{\chaptername~\thesection}
\fancyhead[LO]{\leftmark}
\fancyhead[LE,RO]{}
\setlength{\headheight}{15.2pt}
%\usepackage[
%automark,
%autooneside=false 
%]{scrlayer-scrpage}
%\pagestyle{scrheadings}
%\ohead{Nitish Agarwal}
%\ihead{Deployment and use of a WSN for situation detection}
%\ofoot{Master Thesis, TU Chemnitz, Embedded Systems, 2017}{}
%\ifoot[]{\thepage}
%\lhead{}
%\rhead{}
%\title{The logic behind reciprocal lattice spaces}
%\author{Chitran Ghosal}
%\date{\today}
\usepackage[bottom]{footmisc}                         %creates footnotes
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

%MATHEMATICAL PACKAGES
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------
\usepackage{amsmath,esint}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{tcolorbox}
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

%%BIBLIOGRAPHY PACKAGES
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------
%\usepackage[square, numbers]{natbib}
%\usepackage[nottoc]{tocbibind}
\usepackage[backend=bibtex,
natbib=true,
style=numeric-comp,                                 %% ursprünglicher 
Bibliothekstyle
firstinits=true,                                    %% Vornamen werden als 
Initialen Dargestellt
maxnames=10,                                            %% ab n Auroten wird 
'et al.' verwendet
doi=false,                                          %% DOI wird / wird nicht 
in Referenzen angezeigt
url=false,                                          %% URL der Quelle wird / 
wird nicht in Referenzen angezeigt
isbn=false,                                         %% ISBN wird / wird 
nicht angezeigt
sorting=none,                                       %% Quellen werden 
entsprechend ihrer ersten Verwendung im Text sortiert
]{biblatex}

\addbibresource{references.bib}             %% Einbinden des gewünschten 
Literaturverzeichnises

\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}         
%% 'und andere' wird zu 'et al.'
\DeclareFieldFormat[article]{title}{\mkbibemph{"#1"}\addcomma}  %% Format 
des Artikeltitels (kursiv und in " ")
\DeclareFieldFormat[article]{journaltitle}{{#1}\addcomma}       %% Format 
des Journalnamens
\DeclareNameAlias{default}{last-first}                          %% 
Autorenangabe in Form Nachname, Vorname
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}\isdot}      %% 
Laufnummer der Ausgabe des Journals fettgedruckt
\DeclareFieldFormat[article]{number}{\mkbibbold{#1}}            %% 
Nummerierung des Artikels in der entsprechenden Ausgabe auch fettgedruckt
\DeclareFieldFormat[article]{pages}{{#1}\addcomma}              %% "S." vor 
Seitenangabe für Atikel wird nicht ausgegeben
\DeclareFieldFormat[book]{title}{\mkbibemph{"#1"}\addcomma}     %% Format 
des Buchtitels (kursiv und in " ")

\renewcommand*{\labelnamepunct}{\addcolon\addspace}             %% Einfügen 
eines Doppelpunktes nach den Autoren
\renewcommand*{\multinamedelim}{\addsemicolon\space}            %% Autoren 
durch Semikolon getrennt
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}                  %% Nachnamen 
der Autoren in Kapitälchen

\renewbibmacro*{in:}{}                                          %% "in: " 
vor Journal wird nicht ausgegeben
\renewbibmacro*{journal+issuetitle}{                            %% entfernt 
Jahresangabe nach Laufnummer, da diese am Ende stehen soll (© J. Lidzba =P)
\usebibmacro{journal}%                                      %% siehe 
nächster Eintrag
\setunit*{\addspace}%                                       %%  v
\iffieldundef{series}                                       %%  v
{}                                                          %%  v
{\newunit
    \printfield{series}%
    \setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{note+pages}{                                    %% Ausgabe 
Jahr am Ende angefügt, in Klammern gesetzt (© J. Lidzba =P)
\printfield{note}%
\setunit{\bibpagespunct}%
\printfield{pages}%
\addspace
\printfield[parens]{year}%
\newunit}

%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

%%PHYSICS AND CHEMISTRY PACKAGES
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------
\usepackage{siunitx}      %allows the use of degrees, angstrom...etc
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}   %chemistry typesetting
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\usepackage{braket}      %simplifies the use of the bra-ket notation
\newcommand*{\hham}{\hat{\mathcal{H}}}   %defines the hamiltonian
\usepackage{physics}               %allows the use of additional commands
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

%%PACKAGE FOR APPENDICES
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------
\usepackage[toc,page]{appendix}
%%-----------------------------------------------------------------------
%%-----------------------------------------------------------------------

\begin{document}
%\maketitle
\frontmatter
\tableofcontents
\thispagestyle{empty}
\listoffigures
\thispagestyle{empty}

\mainmatter
\input{Basics}
\input{Basics1}
%\input{char_eg}
\input{char_pthalo}
% \begin{appendices}
%\input{FourierTransform}
%\input{MoirePatterns}
%\input{superstructures}
%\end{appendices}

\backmatter
% \bibliographystyle{unsrt}
%\bibliography{references}
 \thispagestyle{empty}
 \addcontentsline{toc}{chapter}{Bibliography}
 \printbibliography
\end{document}

答案1

我不确定我是否理解了所需的标头是什么样子。您的代码中有一些奇怪的东西。

\fancyhf{}\fancyfoot[C]{\thepage}删除页眉和页脚中的所有内容。如果在页码被删除后使用它,页脚中的内容当然会被删除。

也许以下内容有帮助:

\documentclass[twoside=false,12pt,english]{scrbook}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage[a4paper, bindingoffset=6mm,
  headheight=15.2pt % use geometry to change the head height
]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}% before redefinition of \chaptermark and sectionmark
\renewcommand*{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{#1}}

\fancyhf{}% before setting the new contents of header and footer
\fancyfoot[C]{\thepage}
\fancyhead[RO]{\leftmark}
\fancyhead[LO]{\rightmark}
%\fancyhead[LE]{\leftmark}% only used if twoside=true
%\fancyhead[RE]{\rightmark}% only used if twoside=true

% page style empty in TOC, LOF, LOT and all other lists under controll of  package tocbasic
\AfterTOCHead{\thispagestyle{empty}\pagestyle{empty}}
\AfterStartingTOC{\thispagestyle{empty}}

\usepackage{blindtext}% only for dummy text

\begin{document}
\frontmatter
\tableofcontents
\listoffigures

\mainmatter
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}

结果:

在此处输入图片描述

注意:建议改用scrlayer-scrpageKOMA fancyhdr-Script 类。因此,这里有一个使用包的建议scrlayer-scrpage

\documentclass[twoside=false,12pt,english]{scrbook}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage[a4paper, bindingoffset=6mm,
  headheight=15.2pt % use geometry to change the head height
]{geometry}

\usepackage[headsepline,automark,autooneside=false]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\renewcommand*\chaptermarkformat{}% remove chapter number from header entry
\renewcommand*\sectionmarkformat{}% remove section number from header entry

\clearpairofpagestyles% before setting the new contents of header and footer
\cfoot*{\pagemark}
\ihead{\rightmark}
\ohead{\leftmark}
\addtokomafont{pageheadfoot}{\upshape}

% page style empty in TOC, LOF, LOT and all other lists under controll of  package tocbasic
\AfterTOCHead{\thispagestyle{empty}\pagestyle{empty}}
\AfterStartingTOC{\thispagestyle{empty}}

\usepackage{blindtext}% only for dummy text

\begin{document}
\frontmatter
\tableofcontents
\listoffigures

\mainmatter
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}

相关内容