# Colored bar next to text over multiple pages

I want to have something like this green box you can see in the image next to the text over multiple (~20) pages. Right now I solved this by using mdframed.

The problem now is, that I cannot start chapters in mdframed and have all footnotes printed in the end - since mdframed is using minipages.

Is there a better solution for my case? Since I do not really frame all this text and just want this green box next to it?

I thought about something like showing the geometry borders just on the left side and changing to look like it is now.

Here is a picture of how its looking right now

This is relatively easy to do in ConTeXt using MetaFun.

\startuseMPgraphic{textframe}
begingroup;
for i=1 upto nofmultipars :
draw ( ulcorner multipars[i] -- llcorner multipars[i] )
xshifted (-2*EmWidth)
withcolor "darkgreen"
withpen pensquare scaled (EmWidth);
endfor ;
endgroup;
\stopuseMPgraphic

\definetextbackground
[TextFrame]
[mp=textframe,
location=paragraph]

\starttext

\starttextbackground[TextFrame]

\startsection[title=Knuth]
\input knuth
\stopsection

\startsection[title=Tufte]
\input tufte
\stopsection

\startsection[title=Ward]
\input ward
\stopsection

\startsection[title=Zapf]
\input zapf
\stopsection

\startsection[title=Dawkins]
\input dawkins
\stopsection

\startsection[title=Bryson]
\input bryson
\stopsection

\stoptextbackground

\stoptext


• Thanks a lot for this answer but would this be possible using LaTeX too? Since until now I just worked with LaTeX – Kavar Jun 13 '18 at 8:00

@leandriis answer to my question works out very well.

So now I'm using the following:

\documentclass{book}

\usepackage[color, leftbars]{changebar}
\usepackage{lipsum}

\setlength\changebarsep{10pt}

\begin{document}
\lipsum[4]
\cbstart % the marked Text starts here
\cbcolor{green}
\lipsum[4]
\lipsum\footnote{a footnote}
\lipsum
\cbend % and ends here
\end{document}

• The usual policy on this site would be to let the person who answered in comments write up a full answer. However, could you please make your code compilable? – TeXnician Jun 13 '18 at 13:01
• Oh, thanks for that advice, did edit my answer. – Kavar Jun 13 '18 at 15:33
• Much better now :) – TeXnician Jun 13 '18 at 16:18