.png)
I am using memoir class for my thesis. Among many decoration (by fancyhdr) are the color vertical bars for even and odd pages as similarly guided in this link: coloured rule margin, which I want to keep through the whole thesis.
The problem is that I could not apply these bars for the first page of any parts within frontmatter, including Abstract, TOC, LOT, LOF, despite it seems working for the following pages. I have tried advises in this question, but got no success.
Please kindly advise me. Here is my minimal code:
\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
The easiest way is to call fancy
inside the plain
style and removing the headrule:
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{%
\pagestyle{fancy}%
}
I don't recommend using memoir
and fancyhdr
, however.
\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}