The color problem may be solved using eso-pic. Figures at the margin but not moving up or down may be done using marginnote. But sometimes moving would be recommended, so you should have a look at marginfix too. Here an example with even some more colors than asked for:
\documentclass{scrbook}% You may use any other KOMA-Script class or
% e.g. a standard class.
\usepackage[english]{babel}
\usepackage{blindtext}% for demo only
\usepackage[demo]{graphicx}% remove option `demo' at real life
\usepackage[svgnames]{xcolor}% to have colors (see http://ctan.org/pkg/xcolor)
\usepackage{eso-pic}% put things into background (see http://ctan.org/pkg/eso-pic)
\usepackage{marginnote}% non floating margin notes (see http://ctan.org/pkg/marginnote)
\AddToShipoutPicture{% from package eso-pic: put something to the background
% 1. Background
\AtPageLowerLeft{% put it at the left bottom of the page
\color{LightGrey}\rule{\LenToUnit\paperwidth}{\LenToUnit\paperheight}%
}%
% 2. Headline
\AtTextUpperLeft{% put it at the left top of the text area
\put(0,\LenToUnit{\dimexpr\headsep-\dp\strutbox\relax}){% move it up
\color{BurlyWood}\rule{\LenToUnit\textwidth}{\LenToUnit\headheight}%
}%
}%
% 3. Text area
\AtTextLowerLeft{% put it at the left bottom of the text area
\color{LightSkyBlue}\rule{\LenToUnit\textwidth}{\LenToUnit\textheight}%
}%
% 4. Bottom
\AtTextLowerLeft{% put it at the left bottom of the text area
\put(0,\LenToUnit{\dimexpr-\footskip-\dp\strutbox\relax}){% move it down
% Note: While there is no \footheight, I'm using \headheight here.
\color{BurlyWood}\rule{\LenToUnit\textwidth}{\LenToUnit\headheight}%
}%
}%
}
\setcapindent{0pt}% The margin is too small for hanging captions.
\begin{document}
\chapter{Test}
\blindtext\marginnote{%
\begin{minipage}{\marginparwidth}
\includegraphics[width=\linewidth,height=5\baselineskip]{Test}\\
\captionof{figure}{\hspace{0pt}Example figure}
\end{minipage}
}
\blindtext
\blinddocument
\end{document}
Maybe using option mpinclude
would be a good idea, if you have a lot of material at the margin (see KOMA-Script manual scrguien.pdf) for more information about this option). In this case, increasing \marginparwidth
may or may not be a good idea.
If you would like to use text area + margin area for a figure or equation, you may use something like
\begin{addmargin*}[0pt]{\dimexpr \marginparsep+\marginparwidth\relax}
\begin{equation}
f(x)=x^2
\end{equation}
\end{addmargin*}
addmargin
and addmargin*
are KOMA-Script environments. You may find them at the KOMA-Script manual.
I've used \dimexpr
for some calculations at my example. You may find this at the e-TeX manual. An alternative would be to use package calc. To avoid all the \LenToUnit
you may simply use package picture. Package picture
extends LaTeX's picture
environment and you may use lengths instead of numbers at \put
, \makebox
, \framebox
etc.