使用回憶錄類別的 LaTeX 和 Friends 中的頁眉

使用回憶錄類別的 LaTeX 和 Friends 中的頁眉

LaTeX 和 Friends 的頁眉fancyhdr包用於創建《LaTeX and Friends》一書的頁眉。我怎麼能使用memoir類別以及章節開始的第一頁來做到這一點?

微量元素:

\documentclass[a4,twoside]{memoir}
\usepackage{lipsum}
\nouppercaseheads
\makepagestyle{mystyle} 
\setlength{\headwidth}{\dimexpr\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}
\makeevenhead{mystyle}{\thepage\quad\smash{\rule[-0.2ex]{1pt}{4cm}}\quad\textsc{\chaptername~\thechapter}}{}{} 

\makeoddhead{mystyle}{}{}{\textsc{\leftmark}\quad\smash{\rule[-0.2ex]{1pt}{4cm}}\quad\thepage} 

\makeatletter
\makepsmarks{mystyle}{%
    \createmark{chapter}{left}{nonumber}{\@chapapp\ }{.\ }}
\makeatother

\makepagestyle{plain}
\makerunningwidth{plain}{\dimexpr\marginparsep+\marginparwidth\relax}
\makeevenfoot{plain}{\textsc{\leftmark}\quad\smash{\rule[-0.2ex]{1pt}{4cm}}\quad\thepage}{}{}

\pagestyle{mystyle}

\begin{document}
    \chapter{Test Chapter}
    \lipsum[1]
    \section{Test Section}
    \lipsum[1-20]
\end{document}

答案1

該類別對本章的第一頁memoir使用 pagestyle 。chapter所以你可以做

...
\pagestyle{mystyle}
\aliaspagestyle{chapter}{mystyle}

\begin{document}
...

我不確定為什麼您將plain頁面樣式重新定義為與 相同,但如果您仍然需要它,mystyle最好將其替換為。\aliaspagestyle{plain}{mystyle}

相關內容