# Nested bars with changebar package

I have a question about the use of the change bar package. According to http://www.ctex.org/documents/packages/auxiliary/changebar.pdf, it is possible to create nested bars. But I am not able neither to create them nor to change its width/color. For instance, suppose I use something like this:

\setlength{\changebarsep}{15pt}
\cbcolor{red}
\cbstart[3mm]
text
\setlength{\changebarsep}{10pt}
\cbcolor{blue}
\cbstart[3mm]
text
\cbend
text
\cbend


But I only get one blue bar. Can anyone help me?

These bars are both being printed, but the longer one is put directly over the shorter one. The general problem is that colors and positions etc. of the changebars are governed by global variables, and at exactly which point their value is read varies.

The easiest thing to do is just increase with width of the bars as you nest.

\documentclass{article}

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

\begin{document}

\begin{changebar}[1mm]
\lipsum[2]
\begin{changebar}[3mm]
\lipsum[1]
\end{changebar}
\lipsum[2]
\end{changebar}

\end{document}


Colour changes may also be added, but at not particularly logical places

\documentclass{article}

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

\begin{document}

\begin{changebar}[1mm]
\lipsum[2]
\begin{changebar}[3mm]
\cbcolor{blue}
\lipsum[1]
\end{changebar}
\cbcolor{red}
\lipsum[2]
\end{changebar}

\end{document}


I haven't found how to move the horizontal position of the nested bars individually.

• Thank you very much. I didn't know one bar was hiding the other. But what about \changebarsep? It seems to be only definable in the preamble, and just for one time. Is there any solution to this problem? It would be nice that bars didn't overlap. – user63660 Oct 4 '14 at 14:16
• My last remark was meant to say that I don't how to set that so you get different values for the nested bars. – Andrew Swann Oct 4 '14 at 14:59