\documentclass[12pt,twoside]{article}
\usepackage{amsmath}
\usepackage[outerbars,color,xetex]{changebar}
\usepackage{xltxtra}
\ifx\pdfoutput\undefined
\else\ifnum\pdfoutput>0
  \usepackage{pdfcolmk}
\fi\fi

%\setcounter{changebargrey}{60}
\cbcolor{red}

\usepackage{fancyhdr}

%Header-footer instructions
\pagestyle{fancy}
\setlength{\headheight}{15pt}
\lhead{\scriptsize Changebar test file}
\chead{}
\rhead{v3.5}
\lfoot{Onecolumn text}
\cfoot{Page \thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt} %print a rule below the header
\renewcommand{\footrulewidth}{0.4pt} %print a rule above the footer

\setcounter{page}{16}
\setlength{\emergencystretch}{4em}

\begin{document}
\setmainfont[Mapping=tex-text,Ligatures=Common]{Minion Pro}
%\tableofcontents

\title{CHANGEBAR TEST FILE \\FOR ADVANCED FEATURES}
\author{Piet van Oostrum}
\maketitle

\raggedbottom

\begin {abstract}

This file tests various advanced features of the changebar package.
\cbstart\textcolor{red}{\textbf{Text that should have a changebar is
  printed in red, so that it can easily be checked that the changebars are
  in the proper position.} This changebar should be on the left.
\cbend}

This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.

This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.
\end{abstract}

\newpage

This file tests various advanced features of the changebar package.
\cbstart\textcolor{red}{Text that should have a changebar (like this) is
  printed in red, so that it can easily be checked that the changebars are
  in the proper position.On this page, the changebar should be on the right.
\cbend}
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.

This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.

\cbstart[3mm] \textcolor{red}{Here is a thicker changebar. Text that should
  have a changebar (like this) is printed in red, so that it can easily be
  checked that the changebars are in the proper position.On this page, the
  changebar should be on the right. We also include a formula with large
  descenders which should be completely covered by the changebar:
  $\displaystyle \cfrac{1}{2+\cfrac{1}{3+\cfrac{1}{4+\cdots}}}$
  \cbend}

\twocolumn
\lfoot{Twocolumn page}

\section{Introduction}

\cbstart
\color{red}
This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.
\cbend
\color{black}

\begin{figure}
  \centering 
  \cbstart \color{red} 
  \fbox{
    \parbox{0.8\linewidth}{
      This is a figure. It has its
      own changebar. This is a figure. This is a figure. It has its own
      changebar. This is a figure. This is a figure. It has its own
      changebar. This is a figure. This is a figure.\cbend}}
  \color{black} 
  \caption{This is a test figure}
\end{figure}

This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.

\cbstart
\color{red}
Sections that have been added or modified are marked with a bar in
the  margins. This is a small paragraph that crosses a column boundary. It
should have a changebar in both parts.\cbend
\color{black}

\section{Continuation}
\cbstart
\color{red}

\begin{figure}
\centering
\color{red}
  \fbox{
    \parbox{0.8\linewidth}{ This is a figure. It inherits a changebar from
      the environment. This is a figure. This is a figure. This is a
      figure. This is a figure. It inherits a changebar from the
      environment. This is a figure. This is a figure.}}
\caption{This is a test figure}
\color{black}
\end{figure}
\cbend
\color{black}

\begin{figure}[p]
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. This is a figure. This is a figure. This is a figure.
    This is a figure. This is a figure. This is a figure. This is a figure.
    This is a figure. This is a figure. This is a figure. This is a figure.
    This is a figure. This is a figure. This is a figure. This is a figure.
  }} 
  \caption{Test figure}
\end{figure}

\begin{figure}[p]
\cbstart \color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has its own changebar. This is a figure. It has
    its own changebar. 
    This is a figure. It has its own changebar. This is a figure. It has
    its own changebar. 
    This is a figure. It has its own changebar. This is a figure. It has
    its own changebar. 
  }} \cbend\color{black}
  \caption{Test figure}
\end{figure}

\color{red}
\cbstart

\begin{figure}[p]
\color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
  }} 
  \caption{Test figure}
\end{figure}

This part contains a changebar that crosses several column and page
boundaries. Please note that it crosses several figures also but those have
their own changebars (or not), they do not fall inside the continuation
changebar.

\enlargethispage{1cm}
\subsection{Enlarged column}

\noindent\parbox{\linewidth}{%
This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
\\
\textbf{This column is enlarged, therefore its extends in the footer. 
The changebar should also cover the extended text.}}

This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.

\section*{Specific issues}

\addtocounter{page}{1}
\textbf{Here we change the page number (skipping one page). Therefore we
  have two even pages in a row. The page change is in the righthand column
  which is not proper LaTeX coding, but it should be handled properly.}
This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.

This part contains a changebar that crosses several column and page
boundaries. Please note that it crosses several figures also but those have
their own changebars (or not), they do not fall inside the continuation
changebar.


This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.

This part contains a changebar that crosses several column and page
boundaries. Please note that it crosses several figures also but those have
their own changebars (or not), they do not fall inside the continuation
changebar.

This file tests various advanced features of the changebar package.
This file contains the following features which in combinations used to
give problems in  versions of changebar before version 3.5:
Twoside document, onecolumn and towcolumn text, figures, columns of
figures, page changes in the midst of a document.
It should work both with latex, followed by a supported Postscript driver,
and with pdflatex.

\begin{figure}[p]
\color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
  }} 
  \caption{Test figure}
\end{figure}

\begin{figure}[p]
\color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
  }} 
  \caption{Test figure}
\end{figure}

\begin{figure}[p]
\color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
  }} 
  \caption{Test figure}
\end{figure}

\begin{figure}[p]
\color{red}
\centering  \fbox{\parbox{.9\linewidth}{
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
    This is a figure. It has a changebar from the environment. This is a
    figure. It has a changebar from the environment. 
  }} 
  \caption{Test figure}
\end{figure}

This part contains a changebar that crosses several column and page
boundaries. Please note that it crosses several figures also but those have
their own changebars (or not), they do not fall inside the continuation
changebar. \cbend
\color{black} The last sentence of this part is outside the changebar.
\\[1ex]

\color{red}\cbstart
\noindent\fbox{\parbox[t]{0.95\linewidth}{%
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
This is a parbox. It should have a changebar along its total height.
}}\cbend\color{black}
\\[2cm]
There should be a lonely figure with a changebar at the right.
\end{document}

