TOC 页面样式不适用于第一页(在回忆录中使用 fancyhdr)

TOC 页面样式不适用于第一页(在回忆录中使用 fancyhdr)

我正在使用回忆录类来写我的论文。在众多装饰中(由 fancyhdr 制作),有偶数页和奇数页的彩色垂直条,如下链接中的指导类似:彩色规则边距,我希望在整个论文中都坚持这一点。

问题是我无法将这些栏应用于前言中任何部分的第一页,包括摘要、目录、LOT、LOF,尽管它似乎适用于后续页面。我尝试过以下建议这个问题,但没有成功。

请多多指教。这是我的最小代码:

\documentclass[twoside,12pt,a5paper]{memoir}
\usepackage{tikz,fancyhdr,lipsum}               
\usetikzlibrary{calc}
\pagestyle{fancy}\fancyhf{}
\fancyhead[LO]{%
  \begin{tikzpicture}[overlay,remember picture]
      \fill [color=blue] (current page.north west) rectangle
       ($ (current page.south west) + (1cm,0cm) $);
   \end{tikzpicture}
}
\fancyhead[RE]{%
  \begin{tikzpicture}[overlay,remember picture]
     \fill [color=orange] (current page.north east) rectangle
      ($ (current page.south east) + (-1cm,0cm) $);
  \end{tikzpicture}
}

\begin{document}
  \tableofcontents* \clearpage
  \listoffigures \clearpage
  \fancypagestyle{chapter}{}



   \chapter{My first Chapter: Problems}
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]

\chapter{My Second Chapter: Problems}
   \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
    \end{document}

答案1

最简单的方法是调用样式fancy内部plain并删除主规则:

 \renewcommand{\headrulewidth}{0pt}
   \fancypagestyle{plain}{%
    \pagestyle{fancy}%
 }

然而我不建议使用memoirfancyhdr

在此处输入图片描述

\documentclass[twoside,12pt,a5paper]{memoir}
\usepackage{tikz,fancyhdr,lipsum}               
\usetikzlibrary{calc}
\pagestyle{fancy}\fancyhf{}
\fancyhead[LO]{%
  \begin{tikzpicture}[overlay,remember picture]
      \fill [color=blue] (current page.north west) rectangle
       ($ (current page.south west) + (1cm,0cm) $);
   \end{tikzpicture}
}
\fancyhead[RE]{%
  \begin{tikzpicture}[overlay,remember picture]
     \fill [color=orange] (current page.north east) rectangle
      ($ (current page.south east) + (-1cm,0cm) $);
  \end{tikzpicture}
}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{%
  \pagestyle{fancy}%
}

\begin{document}
\tableofcontents* \clearpage
\listoffigures \clearpage
\fancypagestyle{chapter}{}



\chapter{My first Chapter: Problems}
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]

\chapter{My Second Chapter: Problems}
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\section{A}\subsection{B}\lipsum[1]\subsection{CS1}\lipsum[1] \subsection{C}\lipsum[1]
\end{document}

相关内容