如何在标题栏中显示章节名称而不是章节名称?

如何在标题栏中显示章节名称而不是章节名称?

当我创建一个部分时,部分名称会替换标题中的章节名称。我不希望发生这种情况。我怎样才能将章节名称保留在标题中(并忽略部分名称)?部分是否在目录中并不重要。

我正在使用回忆录课程,以及小说来自 Overleaf 的模板。

% universal settings
\documentclass[smalldemyvopaper,11pt,twoside,onecolumn,openright,extrafontsizes]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[osf]{Alegreya,AlegreyaSans}

% PACKAGE DEFINITION
% typographical packages
\usepackage{microtype} % for micro-typographical adjustments
\usepackage{setspace} % for line spacing
\usepackage{lettrine} % for drop caps and awesome chapter beginnings
\usepackage{titlesec} % for manipulation of chapter titles

% for placeholder text
 \usepackage{lipsum} % to generate Lorem Ipsum

% other
\usepackage{calc}
\usepackage{hologo}
\usepackage[hidelinks]{hyperref}
%\usepackage{showframe}

% PHYSICAL DOCUMENT SETUP
% media settings
\setstocksize{8.5in}{5.675in}
\settrimmedsize{8.5in}{5.5in}{*}
\setbinding{0.175in}
\setlrmarginsandblock{0.611in}{1.222in}{*}
\setulmarginsandblock{0.722in}{1.545in}{*}

% defining the title and the author
%\title{\LaTeX{} ePub Template}
%\title{\textsc{How I Started to Love {\fontfamily{cmr}\selectfont\LaTeX{}}}}
\title{Title}
\author{Name}
\newcommand{\ISBN}{0-000-00000-2}
\newcommand{\press}{Nonexistent Press - Hammond, Louisiana}

% custom second title page
\makeatletter
\newcommand*\halftitlepage{\begingroup % Misericords, T&H p 153
  \setlength\drop{0.1\textheight}
  \begin{center}
  \vspace*{\drop}
  \rule{\textwidth}{0in}\par
  {\Large\textsc\thetitle\par}
  \rule{\textwidth}{0in}\par
  \vfill
  \end{center}
\endgroup}
\makeatother

% custom title page
\thispagestyle{empty}
\makeatletter
\newlength\drop
\newcommand*\titleM{\begingroup % Misericords, T&H p 153
  \setlength\drop{0.15\textheight}
  \begin{center}
  \vspace*{\drop}
  \rule{\textwidth}{0in}\par
  {\HUGE\textsc\thetitle\par}
  \rule{\textwidth}{0in}\par
  {\Large\textit\theauthor\par}
  \vfill
  {\Large\scshape\press}
  \end{center}
\endgroup}
\makeatother

% chapter title manipulation
% padding with zero
\renewcommand*\thechapter{\ifnum\value{chapter}<10 0\fi\arabic{chapter}}
% chapter title display
\titleformat
{\chapter}
[display]
{\normalfont\scshape\huge}
{\HUGE\thechapter\centering}
{0pt}
{\vspace{18pt}\centering}[\vspace{42pt}]

% typographical settings for the body text
\setlength{\parskip}{0em}
\linespread{1.09}

% HEADER AND FOOTER MANIPULATION
  % for normal pages
  \nouppercaseheads
  \headsep = 0.16in
  \makepagestyle{mystyle} 
  \setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
  \makerunningwidth{mystyle}{\headwidth}
  \makeevenhead{mystyle}{}{\textsf{\scriptsize\scshape\thetitle}}{}
  \makeoddhead{mystyle}{}{\textsf{\scriptsize\scshape\leftmark}}{}
  \makeevenfoot{mystyle}{}{\textsf{\scriptsize\thepage}}{}
  \makeoddfoot{mystyle}{}{\textsf{\scriptsize\thepage}}{}
  \makeatletter
  \makepsmarks{mystyle}{%
  \createmark{chapter}{left}{nonumber}{\@chapapp\ }{.\ }}
  \makeatother
  % for pages where chapters begin
  \makepagestyle{plain}
  \makerunningwidth{plain}{\headwidth}
  \makeevenfoot{plain}{}{}{}
  \makeoddfoot{plain}{}{}{}
  \pagestyle{mystyle}
% END HEADER AND FOOTER MANIPULATION

% table of contents customisation
\renewcommand\contentsname{\normalfont\scshape Contents}
\renewcommand\cftchapterfont{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont}
\renewcommand{\printtoctitle}{\centering\Huge}

% layout check and fix
\checkandfixthelayout
\fixpdflayout











\begin{document}

\chapter{Fu}

\lipsum[1-8]

\section{Bar}


\end{document}

答案1

首先,永远不要使用titlesec它,因为memoir它会破坏很多东西memoir。我添加了memoir获取相同章节样式的方法。

你忘记重置按部分等做出的标记。我已经从 MWE 中删除了与此问题无关的内容

\documentclass[smalldemyvopaper,11pt,twoside,onecolumn,openright,extrafontsizes]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[osf]{Alegreya,AlegreyaSans}

\usepackage{microtype} % for micro-typographical adjustments

% for placeholder text
% USING AN ENGLISH PLACEHOLDER TEXT INSTEAD 
\usepackage{kantlipsum}

% PHYSICAL DOCUMENT SETUP
% media settings
\setstocksize{8.5in}{5.675in}
\settrimmedsize{8.5in}{5.5in}{*}
\setbinding{0.175in}
\setlrmarginsandblock{0.611in}{1.222in}{*}
\setulmarginsandblock{0.722in}{1.545in}{*}

% typographical settings for the body text
\setlength{\parskip}{0em}
\linespread{1.09}

% layout check and fix
\checkandfixthelayout

\title{Title}


% chapter title manipulation padding with zero
\renewcommand*\thechapter{\ifnum\value{chapter}<10\relax0\fi\arabic{chapter}}

% CHAPTER SETUP IN MEMOIR
\renewcommand*\printchaptername{}
\renewcommand*\chapternamenum{}
\renewcommand*\chapnumfont{\normalfont\HUGE\centering}
\renewcommand*\chaptitlefont{\normalfont\scshape\huge\centering}
\setlength\midchapskip{23pt}
\setlength\afterchapskip{84pt}

% HEADER AND FOOTER MANIPULATION
% for normal pages
\nouppercaseheads
\headsep = 0.16in
\makepagestyle{mystyle} 
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}
% DON'T USE \textsf HERE, USE ITS LONGFORM \sffamily
\makeevenhead{mystyle}{}{\sffamily\scriptsize\scshape\thetitle}{}
\makeoddhead{mystyle}{}{\sffamily\scriptsize\scshape\leftmark}{}
\makeevenfoot{mystyle}{}{\sffamily\scriptsize\thepage}{}
\makeoddfoot{mystyle}{}{\sffamily\scriptsize\thepage}{}
\makeatletter
\makepsmarks{mystyle}{%
  \createmark{chapter}{left}{nonumber}{\@chapapp\ }{.\ }
  \clearmark{section}
  \clearmark{subsection}
  \clearmark{subsubsection}
}
\makeatother
% for pages where chapters begin
% don't overwrite plain
\makepagestyle{plainplain}
\makerunningwidth{plainplain}{\headwidth}
\makeevenfoot{plainplain}{}{}{}
\makeoddfoot{plainplain}{}{}{}
\aliaspagestyle{chapter}{plainplain}
\pagestyle{mystyle}

\begin{document}


\chapter{Fu}

\kant[1-8]

\section{Bar}

\kant[1-8]


\end{document}

相关内容