Page Layout ⇒ Page border colors
Page border colors
How can I do that?
Thanks
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Page border colors
Page border colors
Now I can make an index and put marks in different possitions for each chapter but I don't know how to use different colors for the marks. They are all black.
Code: Select all
\documentclass[a4paper]{book}
\setlength{\unitlength}{18mm}
\newcommand{\blob}{\rule[-.2\unitlength]{.5\unitlength}{.5\unitlength}}
\newcommand\rblob{\thepage
\begin{picture}(0,0)
\put(1,-\value{chapter}){\blob}
\end{picture}}
\newcommand\lblob{%
\begin{picture}(0,0)
\put(-3,-\value{chapter}){\blob}
\end{picture}%
\thepage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\cfoot{}
\newcounter{line}
\newcommand{\secname}[1]{\addtocounter{line}{1}%
\put(1,-\value{line}){\blob}
\put(-7.5,-\value{line}){\Large \arabic{line}}
\put(-7,-\value{line}){\Large #1}}
\newcommand{\overview}{\thepage
\begin{picture}(0,0)
\secname{Introduction}
\secname{The first year}
\secname{Specialisation}
\end{picture}}
\begin{document}
\fancyhead[R]{\overview}\mbox{}\newpage % This produces the overview page
\fancyhead[R]{} % Front matter may follow here
\clearpage
\chapter{Introduction}
\fancyhead[RE]{\rightmark}
\fancyhead[RO]{\rblob}
\fancyhead[LE]{\lblob}
\fancyhead[LO]{{\leftmark}}
Text
\chapter{The first year}
Text
\chapter{Specialisation}
Text
\end{document}
Page border colors
There are only small changes to your original MWE (and thanks for providing it, makes things a lot easier):
1. added first couple of lines for color definitions,
2. line 34, added #1 argument to change blob color in the overview page
3. lines 40–42, specified different colors as optional arguments for different chapters
4. the custom \blobcolor command used after every \chapter command to change blob color
Code: Select all
\documentclass[a4paper]{book}
\usepackage{xcolor}
\newcommand{\colori}{\color{red}}
\newcommand{\colorii}{\color{green}}
\newcommand{\coloriii}{\color{magenta}}
\newcommand{\blobcolor}[1]{% To change blob color for chapters
\renewcommand{\blob}{#1\rule[-.2\unitlength]{.5\unitlength}{.5\unitlength}}
}
\setlength{\unitlength}{18mm}
\newcommand{\blob}{\rule[-.2\unitlength]{.5\unitlength}{.5\unitlength}}
\newcommand\rblob{\thepage
\begin{picture}(0,0)
\put(1,-\value{chapter}){\blob}
\end{picture}}
\newcommand\lblob{%
\begin{picture}(0,0)
\put(-3,-\value{chapter}){\blob}
\end{picture}%
\thepage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\cfoot{}
\newcounter{line}
\newcommand{\secname}[2][\color{black}]{\addtocounter{line}{1}%
\put(1,-\value{line}){#1\blob}% #1 here is to change blob color in the overview page
\put(-7.5,-\value{line}){\Large \arabic{line}}
\put(-7,-\value{line}){\Large #2}}
\newcommand{\overview}{\thepage
\begin{picture}(0,0)
\secname[\colori]{Introduction}
\secname[\colorii]{The first year}
\secname[\coloriii]{Specialisation}
\end{picture}}
\begin{document}
\fancyhead[R]{\overview}\mbox{}\newpage % This produces the overview page
\fancyhead[R]{} % Front matter may follow here
\clearpage
\chapter{Introduction}
\blobcolor{\colori}
\fancyhead[RE]{\rightmark}
\fancyhead[RO]{\rblob}
\fancyhead[LE]{\lblob}
\fancyhead[LO]{{\leftmark}}
Text
\chapter{The first year}
\blobcolor{\colorii}
Text
\chapter{Specialisation}
\blobcolor{\coloriii}
Text
\end{document}
Page border colors
OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim