Text Formatting ⇒ Colored boxes spanning over pages of defined width ...
Colored boxes spanning over pages of defined width ...
I want to put text into a colored box that spans over many pages. I tried the framed-Package and its shaded environment. But with this environment, I can not set the width of the box.
Does anybody know, how I can use a colored box over many pages, where I can set the width of the box as well as the padding of the text in the box?
Thanks
Konrad
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Colored boxes spanning over pages of defined width ...
you can define your own environments using the features provided by the framed package. Take a look at the following simple example:
Code: Select all
\documentclass{report}
\usepackage{lipsum}% just to generate some text
\usepackage{framed}
\usepackage{xcolor}
\renewenvironment{shaded}{%
\def\FrameCommand{\fboxsep=\FrameSep \colorbox{blue!60}}%
\MakeFramed {\FrameRestore}}%
{\endMakeFramed}
\newenvironment{shadedi}{%
\def\FrameCommand{\fboxsep=\FrameSep \colorbox{blue!60}}%
\MakeFramed {\advance\hsize+2\width\FrameRestore}}%
{\endMakeFramed}
\newenvironment{shadedii}{%
\def\FrameCommand{\fboxsep=\FrameSep \colorbox{blue!60}}%
\MakeFramed {\advance\hsize-7\width\everypar{\parshape 1 1.8cm 4cm}\FrameRestore}}%
{\endMakeFramed}
\begin{document}
\begin{shaded}
\lipsum[1-10]
\end{shaded}
\lipsum[1]
\begin{shadedi}
\lipsum[1-10]
\end{shadedi}
\lipsum[1]
\begin{shadedii}
\lipsum[1-10]
\end{shadedii}
\lipsum[1]
\end{document}