经典论文 - 自定义页眉以包含章节标题

经典论文 - 自定义页眉以包含章节标题

我正在使用经典的论文模板,在我的文档中,我根据这里给出的建议修改了页眉,将章节标题包含在每页的右上角1。但是,在章节的最后一页,页眉中的名称更改为下一章的名称。如何确保修改后的页眉应用于同一章节内的所有页面?

我已附上 MWE 和问题截图。如有任何建议,我将不胜感激!

\documentclass[12pt,a4paper,headinclude=true,footinclude]{report}% or book for the standard book class
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[dottedtoc]{classicthesis}
%\usepackage{url}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\graphicspath{{../Visuals/}{../Visuals/Chapter_1/}{../Visuals/Chapter_2/}{../Visuals/Chapter_3/}{../Visuals/Chapter_4/}{../Visuals/Chapter_5/}{../Visuals/Chapter_6/}}
\usepackage{gensymb}
\usepackage{times}
\usepackage{chemformula} % Formula subscripts using \ch{}
\usepackage{adjustbox}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\addbibresource{Libraryv1.69,test}%multiple .bib files here for different chapters
%\addbibresource{test}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 
\usepackage{titleps}%fancy page borders? 
\usepackage[left=4.0cm, right=4cm, top=3.5cm, bottom=3.5cm]{geometry}
\captionsetup{format=plain, font={small,it}, labelfont=bf}
\usepackage{microtype}
\usepackage{wallpaper}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{lipsum}
\setcounter{secnumdepth}{3}

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

\DeclareUnicodeCharacter{2212}{-}

\pagestyle{scrheadings} % <--- Affects the page header 
% and page number in the footer.
\clearscrheadfoot
\ohead{\leftmark}  % comment out to 

\cfoot[\pagemark]{\pagemark}

\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{#1}}}
% Remove section number from heading

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

\DeclareUnicodeCharacter{2212}{-}

\doublespacing 
\begin{document}

%CHAPTER_1
\chapter{Introduction}

\lipsum

\chapter{Project 1}

%\printbibliography
\end{document}

在此处输入图片描述

答案1

不要使用多个包来制作页眉和页脚!包classicthesis会加载包scrlayer-scrpage。因此您必须删除包titleps

示例(我已删除所有不相关的内容):

\documentclass[12pt,a4paper,headinclude=true,footinclude]{report}
\usepackage[T1]{fontenc}
\usepackage[dottedtoc]{classicthesis}% loads package scrlayer-scrpage and sets page style scrheadings

\usepackage{mathptmx}% replaces obsolete package times
\usepackage[doublespacing]{setspace}
\usepackage[british]{babel}

%\usepackage{titleps}% <- remove this package!!

\usepackage[left=4.0cm, right=4cm, top=3.5cm, bottom=3.5cm]{geometry}
\usepackage{microtype}
\usepackage{lipsum}

%\pagestyle{scrheadings}% <- not needed
\clearpairofpagestyles% <- replaces outdated \cleardscrheadfoot
\ohead{\leftmark}
\cfoot*{\pagemark}% <- short version of \cfoot[\pagemark]{\pagemark}

\begin{document}
\chapter{Introduction}
\lipsum
\chapter{Project 1}
\lipsum
\end{document}

答案2

其中有各种类别、包和选项。

选项1

使用\documentclass[12pt,a4paper]{report}titleps设置标题。

选项 2

使用

\documentclass[12pt,paper=a4,dottedtoc, headinclude, footinclude=true]{scrreprt},KOMA-Script 报告,以及它自己指定页眉和页脚的方式(以及删除titleps!)

选项1

A

\documentclass[12pt,a4paper]{report}% or book for the standard book class
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[dottedtoc]{classicthesis}
%\usepackage{url}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\graphicspath{{../Visuals/}{../Visuals/Chapter_1/}{../Visuals/Chapter_2/}{../Visuals/Chapter_3/}{../Visuals/Chapter_4/}{../Visuals/Chapter_5/}{../Visuals/Chapter_6/}}
\usepackage{gensymb}
%%%\usepackage{times} 
\usepackage{chemformula} % Formula subscripts using \ch{}
\usepackage{adjustbox}
\usepackage[british]{babel}
\usepackage{csquotes}
%\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
%\addbibresource{Libraryv1.69,test}%multiple .bib files here for different chapters
%\addbibresource{test}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 

%% ********************************************* added <<<<<<<<<<<<<<<<<
\usepackage{newcomputermodern} 
\usepackage{titleps}%fancy page borders? 
\newpagestyle{main}[\sffamily]{
    \sethead[\chaptertitle][][]% even pages if twoside
    {}{}{\chaptertitle} % odd pages
    \setfoot{}{\thepage}{}% 
} 
\pagestyle{main}

\renewpagestyle{plain}[\small\sffamily]{
    \setfoot{}{\thepage}{}}
%% *******************************************

\usepackage[left=4.0cm, right=4cm, top=3.5cm, bottom=3.5cm]{geometry}
\captionsetup{format=plain, font={small,it}, labelfont=bf}
\usepackage{microtype}
\usepackage{wallpaper}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{lipsum}
\setcounter{secnumdepth}{3}

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

%\DeclareUnicodeCharacter{2212}{-}

%   %\pagestyle{scrheadings} % <--- Affects the page header 
%   %% and page number in the footer.
%   %\clearscrheadfoot
%   %\ohead{\leftmark}  % comment out to 
%   %
%   %\cfoot[\pagemark]{\pagemark}
%   %
%   %\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{#1}}}
%   %% Remove section number from heading   

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

%\DeclareUnicodeCharacter{2212}{-}

\doublespacing 
\begin{document}
    
    %CHAPTER_1
    \chapter{Introduction}
    
    \lipsum
    
    \chapter{Project 1}
    
    %\printbibliography
\end{document}

选项 2

b

\documentclass[12pt,paper=a4,dottedtoc, headinclude, footinclude=true]{scrreprt}% KOMA-Script report

\usepackage[T1]{fontenc}

%\usepackage[utf8]{inputenc}
\usepackage[dottedtoc]{classicthesis}
%\usepackage{url}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\graphicspath{{../Visuals/}{../Visuals/Chapter_1/}{../Visuals/Chapter_2/}{../Visuals/Chapter_3/}{../Visuals/Chapter_4/}{../Visuals/Chapter_5/}{../Visuals/Chapter_6/}}
\usepackage{gensymb}
\usepackage{newcomputermodern} % added <<<
%\usepackage{times}
\usepackage{chemformula} % Formula subscripts using \ch{}
\usepackage{adjustbox}
\usepackage[british]{babel}
\usepackage{csquotes}
%\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
%\addbibresource{Libraryv1.69,test}%multiple .bib files here for different chapters
%%\addbibresource{test}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 

%\usepackage{titleps}%fancy page borders?  REMOVE <<<<<<<<<<

\usepackage[left=4.0cm, right=4cm, top=3.5cm, bottom=3.5cm]{geometry}
\captionsetup{format=plain, font={small,it}, labelfont=bf}
\usepackage{microtype}
\usepackage{wallpaper}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{lipsum}
\setcounter{secnumdepth}{3}

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

%\DeclareUnicodeCharacter{2212}{-}

\pagestyle{scrheadings} % <--- Affects the page header  and page number in the footer.
\clearscrheadfoot
\ohead{\leftmark}  % comment out to     
\cfoot[\pagemark]{\pagemark}

\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{#1}}}
% Remove section number from heading

\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words. 

%\DeclareUnicodeCharacter{2212}{-}

\doublespacing 
\begin{document}
    
    %CHAPTER_1
    \chapter{Introduction}
    
    \lipsum
    
    \chapter{Project 1}
    
    %\printbibliography
\end{document}

答案3

解决了。​​不确定这是否是正确的方法,但在\newpage每个方法前添加一个\chapter可以解决问题。

相关内容