In LaTeX, how can I set a background color of the paper such that it has left margin as gray and the center and right part of the paper has background white?
Asked
Active
Viewed 313 times
1
-
There is a Page color package that may help as seen in this question Change background color – Leucippus Jul 12 '20 at 18:16
-
A more complicated but powerful approach is to use tikz of tikzpagenodes and everypage. – John Kormylo Jul 12 '20 at 19:17
1 Answers
3
Very simple with eso-picif you use the relevant parameters:
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{eso-pic}
\AddToShipoutPictureBG{\color{Gainsboro!40!Lavender}\AtPageLowerLeft{\rule{\dimexpr 1in + \oddsidemargin-\marginparsep\relax}{\paperheight}}}
\usepackage{lipsum}
\title{Colouring Left Margin}
\author{Wassily Kandinsky}
\begin{document}
\marginpar{Some text}
\lipsum[1-4]
\marginpar{Some text}
\lipsum[5-8]
\end{document}
Bernard
- 271,350
-
That looks good. I would like to be able to write text also to margins. So my idea is to write a CV using \usepackage[absolute]{textpos} such that I can write my text to the gray background and to the white background. – guest Jul 12 '20 at 18:46
-
I've just tested a simple
\marginparand it works fine (the colouring is only a background , and it can ve overwritten)I'm not sure you needtextpos: for the right margin, you have the command\reversemarginparif necessary, and anyway, eso-pic can take care of absolute positions. Take a look at the documentation for details. – Bernard Jul 12 '20 at 18:59 -
I've updated my answer with two
\marginpars. Please see if the result corresponds to what you want. – Bernard Jul 12 '20 at 19:08
