Color page inside of the set height and width
I'm not sure what exactly you want. You can use \rule
together with \textcolor
to get a colored rectangle:
\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\begin{document}
\lipsum
\textcolor{green}{\rule{10cm}{9cm}}
\lipsum
\end{document}
If you want some colored block drawn in the background you can do this using TikZ, when you use the options remember picture,overlay
in the page header, or direct after \newpage
. If you want to draw the colored box to the text area margins use my recent tikzpagenodes
package:
\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\newcommand*{\newcoloredpage}[1]{%
\newpage
\begin{tikzpicture}[overlay,remember picture]%
\fill [#1] (current page text area.south west) rectangle (current page text area.north east);
\end{tikzpicture}%
\vspace{-2.5\baselineskip}%
\par
}
\begin{document}
\lipsum
\newcoloredpage{blue}
\section*{Review}
\lipsum[1]
\newpage
\lipsum
\end{document}
If you want to color the background of a paragraph you could use adjustbox
with the minipage
and bgcolor
keys (and maybe margin
to add some more margin):
\documentclass{article}
\usepackage{xcolor}
\usepackage{adjustbox}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{adjustbox}{minipage=\textwidth,bgcolor=blue}
\lipsum[1]
\end{adjustbox}
\lipsum
\end{document}
However, such a paragraph can't be broken across the page. If you need this the framed
or better the more modern mdframed
package would be the way to go.
I'm working on a TikZ-based decoration package which would be usable here as well, but isn't finished yet.
can be done with a tabularx
:
\documentclass[10pt,a4paper]{article}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{lipsum}
\usepackage{tabularx,xhfill}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ X !{\color{white}\vrule width 2pt} X }
\rowcolor{SkyBlue}
\multicolumn{2}{>{\columncolor{SkyBlue}}p{\dimexpr\linewidth-2\tabcolsep\relax}}{%
\leavevmode\rule[-2ex]{0pt}{6ex}\Large\xrfill{2pt}[white]\sffamily\
Review
\xrfill{2pt}[white]}\\
%
\rowcolor{SkyBlue}
\lipsum[1]
&
\lipsum[1]
\end{tabularx}
\end{document}