我想更改标题,而不是每次都显示当前章节标题,我想看到当前部分标题而不显示“部分:”
以下是 MWE:
\documentclass[a4paper,french,12pt,oneside,openright]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel} %langue francaise
\usepackage{titlesec}
\usepackage{lipsum} %paragraphes prédéfinis
\usepackage{verbatim}
\aliaspagestyle{part}{empty}
\renewcommand{\printpartname}{}
\renewcommand{\partnamenum}{}
\renewcommand{\printpartnum}{}
\usepackage{booktabs}
\chapterstyle{tandh}
\renewcommand\partnumberlinebox[2]{#2\hspace{1em}}
\usepackage{hyperref}
\begin{document}
\part{Hello}
\pagestyle{headings}
\chapter{yes}
\lipsum
\newpage
\lipsum
\chapter{no}
\lipsum
\chapter{maybe}
\end{document}
谢谢
答案1
您可以复制页面样式headings
,然后更改新页面样式的标记:
\copypagestyle{partheadings}{headings}
\makepsmarks{partheadings}{%
\createmark{part}{both}{nonumber}{}{}%
\clearmark{chapter}%
\clearmark{section}%
}
现在您可以使用
\cleardoublepage
\pagestyle{partheadings}
设置文档内的页面样式。
代码:
\documentclass[a4paper,french,12pt,oneside,openright]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel} %langue francaise
\usepackage{titlesec}
%\usepackage{lipsum} %paragraphes prédéfinis
\usepackage{verbatim}
\aliaspagestyle{part}{empty}
\renewcommand{\printpartname}{}
\renewcommand{\partnamenum}{}
\renewcommand{\printpartnum}{}
\usepackage{booktabs}
\chapterstyle{tandh}
\renewcommand\partnumberlinebox[2]{#2\hspace{1em}}
\usepackage{hyperref}
\copypagestyle{partheadings}{headings}
\makepsmarks{partheadings}{%
\createmark{part}{both}{nonumber}{}{}%
\clearmark{chapter}%
\clearmark{section}%
}
\usepackage{blindtext}% dummy text
\begin{document}
\pagestyle{empty}
\tableofcontents
\cleardoublepage
\pagestyle{partheadings}
\part{Hello}
\blinddocument
\cleardoublepage
\pagestyle{headings}% switch to normal headings
\part{Next}
\blinddocument
\end{document}
答案2
\partmark
对\chaptermark
后者进行建模并重新定义:
\documentclass[a4paper,french,12pt,oneside,openright]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel} %langue francaise
\usepackage{titlesec}
\usepackage{lipsum} %paragraphes prédéfinis
\usepackage{verbatim}
\usepackage{booktabs}
\usepackage{hyperref}
\aliaspagestyle{part}{empty}
\renewcommand{\printpartname}{}
\renewcommand{\partnamenum}{}
\renewcommand{\printpartnum}{}
\chapterstyle{tandh}
\renewcommand\partnumberlinebox[2]{#2\hspace{1em}}
\newcommand{\partmarksn}[1]{#1}
\makeatletter
\renewcommand{\partmark}[1]{%
\@setclcnt{part}{@memmarkcntra}%
\advance\c@@memmarkcntra\m@ne
\markright{%
\memUChead{%
\ifnum\c@secnumdepth>\c@@memmarkcntra
\if@mainmatter\@nameuse{partmarksn}{\partname. \ }\fi
\fi
#1%
}%
}%
}
\renewcommand{\chaptermark}[1]{}
\setlength{\headheight}{15.5pt}
\makeatother
\begin{document}
\part{Hello}
\chapter{yes}
\lipsum
\newpage
\lipsum
\chapter{no}
\lipsum
\chapter{maybe}
\end{document}
如果你不想要“Première partie.”,那么注释掉定义中的三行\partmark
:
\renewcommand{\partmark}[1]{%
\@setclcnt{part}{@memmarkcntra}%
\advance\c@@memmarkcntra\m@ne
\markright{%
\memUChead{%
% \ifnum\c@secnumdepth>\c@@memmarkcntra
% \if@mainmatter\@nameuse{partmarksn}{\partname. \ }\fi
% \fi
#1%
}%
}%
}