TOC 頁面樣式不適用於首頁(在回憶錄中使用 fancyhdr)

TOC 頁面樣式不適用於首頁(在回憶錄中使用 fancyhdr)

我的論文使用回憶錄課程。在許多裝飾(由 fancyhdr 提供)中,偶數頁和奇數頁的顏色垂直條與此連結中的類似指導相同:彩色標尺邊距,我想在整篇論文中保留這一點。

問題是我無法將這些欄位應用於 frontmatter 中任何部分的首頁,包括摘要、目錄、很多、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並刪除 headrule:

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

但是,我不建議使用memoirand fancyhdr

在此輸入影像描述

\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}

相關內容