texlive[46540] Master/texmf-dist: changebar (4feb18)

commits+karl at tug.org commits+karl at tug.org
Sun Feb 4 22:37:38 CET 2018


Revision: 46540
          http://tug.org/svn/texlive?view=revision&revision=46540
Author:   karl
Date:     2018-02-04 22:37:38 +0100 (Sun, 04 Feb 2018)
Log Message:
-----------
changebar (4feb18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest1-ltx.pdf
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest1-pdf.pdf
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest2-ltx.pdf
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest2-pdf.pdf
    trunk/Master/texmf-dist/doc/latex/changebar/changebar.bug
    trunk/Master/texmf-dist/doc/latex/changebar/changebar.pdf
    trunk/Master/texmf-dist/source/latex/changebar/changebar.dtx
    trunk/Master/texmf-dist/source/latex/changebar/changebar.ins
    trunk/Master/texmf-dist/tex/latex/changebar/changebar.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/changebar/CATALOG
    trunk/Master/texmf-dist/doc/latex/changebar/MANIFEST
    trunk/Master/texmf-dist/doc/latex/changebar/README
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf
    trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/changebar/00readme.txt
    trunk/Master/texmf-dist/doc/latex/changebar/catalog.txt
    trunk/Master/texmf-dist/doc/latex/changebar/manifest.txt

Deleted: trunk/Master/texmf-dist/doc/latex/changebar/00readme.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/00readme.txt	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/00readme.txt	2018-02-04 21:37:38 UTC (rev 46540)
@@ -1,25 +0,0 @@
-                               changebar bundle
-
-                               September 19, 2005
-
-This bundle contains a package that I maintain to add changebars to a
-LaTeX document.
-
-It provides the changebar environment as well as the commands cbstart
-and cbend. It uses \specials to communicate to the dvi driver where
-the bars should be printed.
-
-The file chbar.sh which is part of this bundle was contributed. It can
-be used to compare two versions of a document and automatically add
-the changebars.
-The file chbar.1, also contributed, documents the workings of chbar.sh
-
-Copyright (C) 2005 Johannes L. Braams texniek(at)braams.cistron.nl
-
-This program can be redistributed and/or modified under the terms
-of the LaTeX Project Public License Distributed from CTAN
-archives in directory macros/latex/base/lppl.txt; either
-version 1.3 of the License, or any later version.
-
-
-

Added: trunk/Master/texmf-dist/doc/latex/changebar/CATALOG
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/CATALOG	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/changebar/CATALOG	2018-02-04 21:37:38 UTC (rev 46540)
@@ -0,0 +1,20 @@
+Name: ChangeBar
+Problems-To: texniek(at)braams.xs4all.nl
+Author: J.L. Braams
+Version: 3.6b
+
+Description:
+
+This bundle contains a package that provides commands for adding
+change bars to a document. It relies on \special commands.
+
+Keywords: latex, pdflatex, packages, changebars
+
+See-Also: 
+
+Address:
+TeXniek
+J.L. Braams
+Kersengaarde 33
+2723 BP Zoetermeer
+The Netherlands

Added: trunk/Master/texmf-dist/doc/latex/changebar/MANIFEST
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/MANIFEST	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/changebar/MANIFEST	2018-02-04 21:37:38 UTC (rev 46540)
@@ -0,0 +1,27 @@
+%
+% CONTENTS OF THE CHANGEBAR BUNDLE
+% ================================
+%
+% changebar.dtx   -- A LaTeX2e package that provides commands to add
+%                    change bars to a document. Relies on \specials.
+%
+% changebar.pdf   -- The printed version of the package, including
+%                    a description of the use of the amcroś.
+%
+% changebar.ins   -- The installation script.
+%
+% changebar.bug   -- A (historical) list of changes and of known
+%                    (existing) problems.
+%
+% chbar.sh        -- A Unix sh script to compare two version of a
+%                    document and automatically add changebars to the
+%                    modified document.
+%
+% chbar.1         -- A Unix man page describing the use of chbar.sh
+%
+% cbtest1.tex     -- A sample file using the color package
+% cbtest1-ltx.pdf -- Produced with LaTeX and dvipdfm
+% cbtest1-pdf.pdf -- Produced with pdfLaTeX
+% cbtest2.tex     -- A sample file using the xcolor package
+% cbtest2-ltx.pdf -- Produced with LaTeX and dvipdfm
+% cbtest2-pdf.pdf -- Produced with pdfLaTeX

Added: trunk/Master/texmf-dist/doc/latex/changebar/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/changebar/README	2018-02-04 21:37:38 UTC (rev 46540)
@@ -0,0 +1,25 @@
+                               changebar bundle
+
+                               Februari 04, 2018
+
+This bundle contains a package that I maintain to add changebars to a
+LaTeX document.
+
+It provides the changebar environment as well as the commands cbstart
+and cbend. It uses \specials to communicate to the dvi driver where
+the bars should be printed.
+
+The file chbar.sh which is part of this bundle was contributed. It can
+be used to compare two versions of a document and automatically add
+the changebars.
+The file chbar.1, also contributed, documents the workings of chbar.sh
+
+Copyright (C) 2018 Johannes L. Braams texniek(at)braams.xs4all.nl
+
+This program can be redistributed and/or modified under the terms
+of the LaTeX Project Public License Distributed from CTAN
+archives in directory macros/latex/base/lppl.txt; either
+version 1.3 of the License, or any later version.
+
+
+


Property changes on: trunk/Master/texmf-dist/doc/latex/changebar/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/changebar/catalog.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/catalog.txt	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/catalog.txt	2018-02-04 21:37:38 UTC (rev 46540)
@@ -1,20 +0,0 @@
-Name: ChangeBar
-Problems-To: texniek(at)braams.cistron.nl
-Author: J.L. Braams
-Version: 3.5
-
-Description:
-
-This bundle contains a package that provides commands for adding
-change bars to a document. It relies on \special commands.
-
-Keywords: latex, pdflatex, packages, changebars
-
-See-Also: 
-
-Address:
-TeXniek
-J.L. Braams
-Kersengaarde 33
-2723 BP Zoetermeer
-The Netherlands

Modified: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1-ltx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1-pdf.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf	2018-02-04 21:37:38 UTC (rev 46540)

Property changes on: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1good.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf	2018-02-04 21:37:38 UTC (rev 46540)

Property changes on: trunk/Master/texmf-dist/doc/latex/changebar/cbtest1wrong.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/changebar/cbtest2-ltx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/changebar/cbtest2-pdf.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/changebar/changebar.bug
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/changebar.bug	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/changebar.bug	2018-02-04 21:37:38 UTC (rev 46540)
@@ -5,6 +5,7 @@
 %         emTeX (dvidrv)    (Eberhard Mattes)
 %         VTeX              (Michael Vulis)
 %	  PDFTeX	    (Piet van Oostrum)
+%	  XeTeX		    (Apostolos Syropoulos)
 %
 % change history
 %
@@ -188,8 +189,19 @@
 % v3.5c JLB: Add a small change in the TeXtures specific code that 
 %       was submitted by Blue Sky Systems; made it work with both the
 %       color and xcolor packages.
+%
+% v3.6a Apostolos Syropoulus submitted support for XeTeX
+%
+% v3.6a JLB: a small change in the XeTeX macros
+%
+% v3.6b JLB: set changebarsep to 0.5\marginparsewp instead of 30pt 
+%       in order to prevent the changebar crossing a marginal paragraph.
 
 % Known problems
+%        - changebars for mmarginal paragraphs collide with changebars
+%          for the main body of text
+%        - The documentation contains a \clearpage to prevent a weird
+%          problem when processing the .cb2 file. Cause as of yet unknown.
 %        - With PostScript a dictstack overflow seems to occur with
 %          many changebars. cb at maxpoint=20 seems to help
 %        - I have received the file chgbar.sty, which was written by

Modified: trunk/Master/texmf-dist/doc/latex/changebar/changebar.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/changebar/manifest.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/changebar/manifest.txt	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/doc/latex/changebar/manifest.txt	2018-02-04 21:37:38 UTC (rev 46540)
@@ -1,24 +0,0 @@
-%
-% CONTENTS OF THE CHANGEBAR BUNDLE
-% ================================
-%
-% changebar.dtx   -- A LaTeX2e package that provides commands to add
-%                    change bars to a document. Relies on \specials.
-%
-% changebar.ins   -- The installation script.
-%
-% changebar.bug   -- A (historical) list of changes and of known
-%                    (existing) problems.
-%
-% chbar.sh        -- A Unix sh script to compare two version of a
-%                    document and automatically add changebars to the
-%                    modified document.
-%
-% chbar.1         -- A Unix man page describing the use of chbar.sh
-%
-% cbtest1.tex     -- A sample file using the color package
-% cbtest1-ltx.pdf -- Produced with LaTeX and dvipdf
-% cbtest1-pdf.pdf -- Produced with pdfLaTeX
-% cbtest2.tex     -- A sample file using the xcolor package
-% cbtest2-ltx.pdf -- Produced with LaTeX and dvipdf
-% cbtest2-pdf.pdf -- Produced with pdfLaTeX

Modified: trunk/Master/texmf-dist/source/latex/changebar/changebar.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/changebar/changebar.dtx	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/source/latex/changebar/changebar.dtx	2018-02-04 21:37:38 UTC (rev 46540)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-%% Copyright 1994-2005 (C) Johannes Braams.  All rights reserved.
+%% Copyright 1994-2018 (C) Johannes Braams.  All rights reserved.
 %
 % This file is part of the changebar package.
 % -------------------------------------------
@@ -24,7 +24,7 @@
 % and covered by LPPL is defined by the unpacking scripts (with
 % extension .ins) which are part of the distribution.
 % \fi
-% \CheckSum{2189}
+% \CheckSum{2579}
 %
 %\iffalse
 %    This file is built for \LaTeXe, so we make sure an error is
@@ -39,7 +39,7 @@
 \ProvidesFile{changebar.dtx}
 %</dtx>
 %<+package>\ProvidesPackage{changebar}
-           [2005/09/18 v3.5c Indicate changes with marginal bars]
+           [2018/02/04 v3.6b Indicate changes with marginal bars]
 %    \end{macrocode}
 %
 % \section{A driver for this document}
@@ -128,8 +128,12 @@
 % \changes{v3.4e}{2001/09/14}{Store original definitions using the
 %    \texttt{ltx} prefix, define own versions with \texttt{cb} prefix,
 %    the use \cmd{let} to replace \LaTeX\ macro.}
-%  \changes{v3.5a}{2005/05/23}{Piet van Oostrum: Resolved bugs in twocolumn
+% \changes{v3.5a}{2005/05/23}{Piet van Oostrum: Resolved bugs in twocolumn
 %    mode, mid-document changes to page number, added pdflatex support.}
+% \changes{v3.6a}{2011/04/30}{Added support for XeTeX provided by
+%    Apostolos Syropoulos}
+% \changes{v3.6b}{2018/02/03}{Added a macro for pdf scaling for
+%    Xe\TeX}
 %
 % \title{The Changebar package
 %         \thanks{This file has version number \fileversion,
@@ -137,10 +141,7 @@
 %
 % \author{Michael Fine\\Distributed Systems Architecture \and
 %         Johannes Braams\\
-%         Kersengaarde 33\\
-%         2723 BP Zoetermeer\\
-%         The Netherlands\\
-%         \texttt{texniek at braams.cistron.nl}}
+%         \texttt{texniek at braams.xs4all.nl}}
 %
 % \date{Printed \today}
 %
@@ -155,9 +156,10 @@
 %    modifications in a \LaTeX-document by putting bars in the
 %    margin. It realizes this by making use of the |\special|
 %    commands supported by `dvi drivers'. Currently six different
-% \changes{v3.5a}{2005/05/23}{Pdftex support added}
-%    drivers are supported\cbstart, plus pdftex support\cbend. 
-%   More can easily be added. 
+% \changes{v3.5a}{2005/05/23}{PDF\TeX{} support added}
+% \changes{v3.6a}{2011/04/30}{Xe\TeX{} support added}
+%    drivers are supported, plus pdftex\cbstart{} and XeTeX\cbend{}
+%    support. More can easily be added. 
 % \end{abstract}
 %
 % \section{Introduction}
@@ -188,13 +190,14 @@
 %
 %    \item The colour of the changebars can be changed. This has sofar
 % \changes{v3.5a}{2005/05/23}{Pdftex support added}
-%      been tested with the \Lopt{dvips}\cbstart, \Lopt{pdftex}\cbend{} and
-%      \Lopt{vtex} drivers, 
+% \changes{v3.6a}{2011/05/02}{xetex support added}
+%      been tested with the \Lopt{dvips}, \Lopt{pdftex},
+%      \Lopt{vtex} and\cbstart{}\Lopt{xetex}\cbend{} drivers, 
 %      but it may also work with other PostScript based drivers. It will 
 %      \emph{not} work for the \texttt{DVItoLN03} and em\TeX\ drivers.
 %      For colored changebars to work, make sure that you specify the
 % \changes{v3.5a}{2005/05/23}{Option xcolor mentioned}
-%      option \Lopt{color}\cbstart{} or \Lopt{xcolor}\cbend.
+%      option \Lopt{color} or \Lopt{xcolor}.
 %    \end{itemize}
 %
 % \section{The user interface}
@@ -217,9 +220,11 @@
 %      \item em\TeX
 %      \item \TeX tures
 %      \item V\TeX
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Pdftex support added}
 %      \item PDF\TeX
+% \begin{changebar}
+% \changes{v3.6a}{2011/04/30}{XeTeX added}
+%      \item Xe\TeX
 % \end{changebar}
 %    \end{itemize}
 %    The drivers are represented in the normal typewriter method of
@@ -256,11 +261,11 @@
 %    \Lopt{grey} option.
 %
 % \subsubsection{Tracing}
-%    The package also implements tracing for its own debugging.  The
+%    The package also implements tracing for its own debugging. The
 %    package options \Lopt{traceon} and \Lopt{traceoff} control
 %    tracing. An additional option \Lopt{tracestacks} is available for
 %    the die hard who wants to know what goes on in the internal stacks
-%     maintained by this package.
+%    maintained by this package.
 %
 % \subsection{Macros defined by the package}
 %
@@ -333,8 +338,7 @@
 %    The changebars will be printed in the `inside' margin of your
 %    document.  This means they appear on the left side of the
 %    page. When \Lopt{twoside} is in effect the bars will be printed
-%    on the right side of even pages.  This behaviour can be changed
-%    by including the command |\outerbarstrue| in your document.
+%    on the right side of even pages.  \cbdelete
 %
 %
 % \section{Deficiencies and bugs}
@@ -353,10 +357,9 @@
 %    unpredictable results (but that could be called a feature for a
 %    page with so many bars).  This limitation could be increased if
 %    desired.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Pdftex support added}
-%    There is no such limit with PDF\TeX.
-% \end{changebar}
+% \changes{v3.6a}{2011/04/30}{XeTeX suport added}
+%    There is no such limit with PDF\TeX \cbstart or Xe\TeX\cbend.
 %
 % \item Internal macro names are all of the form |\cb at xxxx|.  No
 %    checking for conflicts with other macros is done.
@@ -379,7 +382,7 @@
 %
 % \item The colour support has only been tested with the \Lopt{dvips}
 % \changes{v3.5a}{2005/05/23}{Pdftex support added}
-%    \cbstart and \Lopt{pdftex} drivers\cbend. 
+%    and \Lopt{pdftex} drivers. 
 %  \end{itemize}
 %
 % \section{The basic algorithm}
@@ -441,10 +444,8 @@
 %    Thus, to ensure that changebars are correct, the document must
 %    be processed twice.  Luckily, this is generally required for
 %    \LaTeX\ anyway. 
-% \begin{changebar}
 %    With PDF\LaTeX{} generally three (or even more) runs
 %    are necessary.
-% \end{changebar}
 %
 %    This approach is sufficiently general to allow nested bars, bars
 %    in floating insertions, and bars around floating insertions.
@@ -572,7 +573,6 @@
 %
 % \begin{macro}{\cb at page}
 % \begin{macro}{\cb at pagecount}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Twocolumn support changes}
 %    The macros need to keep track of the number of pages/columns
 %    output so far.  To this end the counter |\cb at pagecount| is used.
@@ -579,7 +579,6 @@
 %    When a pagenumber is read from the history stack, it is stored in
 %    the counter |\cb at page|. The counter |\cb at pagecount| is initially
 %    $0$; it gets incremented during the call to |\@makebox| (see
-% \end{changebar}
 %    section~\ref{pagebreak}).
 %    \begin{macrocode}
 \newcount\cb at page
@@ -593,28 +592,25 @@
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    A switch is provided to control where the changebars will be
 %    printed. 
-% \begin{changebar}
 %    The value depends on the options given:
 %    \begin{itemize}
 %    \item[0] for innerbars (default),
 %    \item[1] for outerbars,
-%    \item[2] gices leftbars,
+%    \item[2] gives leftbars,
 %    \item[3] gives rightbars.
 %    \end{itemize}
 %    \begin{macrocode}
 \def\cb at barsplace{0}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 %  \begin{Var}{@cb at trace}
-%    A switch to enable tracing of the actions of this package
+%    A switch to enable tracing of the actions of this package.
 %    \begin{macrocode}
 \newif\if at cb@trace
 %    \end{macrocode}
 %  \end{Var}
 %
-% \begin{changebar}
 %  \begin{Var}{@cb at firstcolumn}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    A switch to find out if a point is in the left column of a
@@ -627,15 +623,16 @@
 % \begin{macro}{\cb at pdfxy}
 % \changes{v3.5a}{2005/05/23}{Pdftex support added}
 %    The macro |\cb at pdfxy| populates the pdf x,y coordinates file.
-%    In \Lopt{pdftex} mode it writes one line to \file{.cb2} file
+%    In \Lopt{pdftex}\cbstart{} and \Lopt{xetex}\cbend{} mode it
+%    writes one line to \file{.cb2} file
 %    which is equivalent to one bar point. The default implementation
 %    is a noop. 
-%    If the \Lopt{pdftex} option is given it is redefined.
+%    If the \Lopt{pdftex}\cbstart{} or \Lopt{xetex}\cbend{} option is
+%    given it is redefined.
 %    \begin{macrocode}
 \def\cb at pdfxy#1#2#3#4#5{}
 %    \end{macrocode}
 % \end{macro}
-% \end{changebar}
 %
 % \begin{macro}{\cb at positions}
 %
@@ -738,6 +735,7 @@
 %    specifying the driver name as an option to the
 %    |\usepackage| call.
 % \changes{v3.5a}{2005/05/23}{Added the option \Lopt{PDFTeX}}
+% \changes{v3.6a}{2011/04/30}{Added the option \Lopt{XeTeX}}
 %    Possible choices are:
 %    \begin{itemize}
 %    \item DVItoLN03
@@ -746,8 +744,9 @@
 %    \item em\TeX
 %    \item Textures
 %    \item V\TeX
+%    \item PDF\TeX
 % \begin{changebar}
-%    \item PDF\TeX
+%    \item Xe\TeX
 % \end{changebar}
 %    \end{itemize}
 %
@@ -757,6 +756,7 @@
 % \changes{v3.3e}{1998/02/24}{Added the option \Lopt{textures}}
 % \changes{v3.4a}{2001/04/18}{Added the option \Lopt{VTeX}}
 % \changes{v3.5a}{2005/05/23}{Added the option \Lopt{PDFTeX}}
+% \changes{v3.6a}{2011/04/30}{Added the option \Lopt{XeTeX}}
 %    \begin{macrocode}
 \DeclareOption{DVItoLN03}{\global\chardef\cb at driver@setup=0\relax}
 \DeclareOption{dvitoln03}{\global\chardef\cb at driver@setup=0\relax}
@@ -771,12 +771,11 @@
 \DeclareOption{VTeX}{\global\chardef\cb at driver@setup=5\relax}
 \DeclareOption{vtex}{\global\chardef\cb at driver@setup=5\relax}
 %    \end{macrocode}
-% \begin{changebar}
 %    \begin{macrocode}
 \DeclareOption{PDFTeX}{\cb at pdftexcheck}
 \DeclareOption{pdftex}{\cb at pdftexcheck}
 %    \end{macrocode}
-% \changes{v3.5a}{2005/05/23}{Pdftex support added}
+% \changes{v3.5a}{2005/05/23}{PDFTeX support added}
 %    For the \Lopt{pdftex} option we have to check that the current
 %    \LaTeX{} run is using PDF\TeX{} and that PDF output is selected.
 %    If it is, we initialize the option and open an additional output file.
@@ -809,17 +808,54 @@
       {You are using a LaTeX run which does not generate PDF\MessageBreak
         or you are using a very old version of PDFTeX}}
 %    \end{macrocode}
+%\clearpage
+% \begin{changebar}
+%    \begin{macrocode}
+\DeclareOption{XeTeX}{\cb at xetexcheck}
+\DeclareOption{xetex}{\cb at xetexcheck}
+%    \end{macrocode}
+% \changes{v3.6a}{2005/05/23}{XeTeX support added}
+%    For the \Lopt{xetex} option we have to check that the current
+%    \LaTeX{} run is using Xe\TeX{}.
+%    If it is, we initialize the option and open an additional output file.
+%    If not, we ignore the option and issue a warning..
+%    \begin{macrocode}
+\def\cb at xetexcheck{%
+  \expandafter\ifx\csname XeTeXrevision\endcsname\@undefined \cb at xetexerror
+  \else
+    \global\chardef\cb at driver@setup=7\relax
+    \ifx\cb at writexy\@undefined
+      \newwrite\cb at writexy
+      \newread\cb at readxy
+      \immediate\openout\cb at writexy=\jobname.cb2\relax
+    \fi
+%    \end{macrocode}
+%    Redefine the |\cb at pdfxy| macro to write point coordinates to the
+%    \file{.cb2} file.
+%    \begin{macrocode}
+    \gdef\cb at pdfxy##1##2##3##4##5{%
+      \immediate\write\cb at writexy{##1.##2p##3,##4,##5}%
+      \expandafter\gdef\csname cb@##1.##2\endcsname{##3,##4,##5}}
+    \gdef\sec at nd@ftw@##1 ##2{##2}
+  \fi}
+%    \end{macrocode}
+%
+%    Give a warning if we cannot support the \Lopt{xetex} option.
+%    \begin{macrocode}
+\def\cb at xetexerror{\PackageError
+      {changebar}%
+      {XeTeX option cannot be used}%
+      {You are not using XeLaTeX}}
+%    \end{macrocode}
 % \end{changebar}
 %
 %    The new features of \LaTeXe\ make it possible to implement the
 %    \Lopt{outerbars} option.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    \begin{macrocode}
 \DeclareOption{outerbars}{\def\cb at barsplace{1}}
 \DeclareOption{innerbars}{\def\cb at barsplace{0}}
 %    \end{macrocode}
-% \end{changebar}
 %
 %    It is also possible to specify that the change bars should
 %    \emph{always} be printed on either the left or the right side of
@@ -831,13 +867,11 @@
 % \changes{v3.3d}{1997/10/28}{Removed bogus offset}
 % \changes{v3.3g}{1999/06/11}{take the setting of \Lopt{twoside} into
 %    account}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    \begin{macrocode}
 \DeclareOption{leftbars}{\def\cb at barsplace{2}}
 \DeclareOption{rightbars}{\def\cb at barsplace{3}}
 %    \end{macrocode}
-% \end{changebar}
 % \changes{v3.3j}{2000/09/26}{\cs{cb at even@right} erroneously wasn't
 %    set in the oneside mode with option rightbars}
 %    A set of options to control tracing.
@@ -878,14 +912,15 @@
 %    \end{macrocode}
 %
 %    Signal an error if an unknown option was specified.
+% \changes{v3.5a}{2005/05/23}{Added 'pdftex' to the option list}
 % \begin{changebar}
-% \changes{v3.5a}{2005/05/23}{Added 'pdftex' to the option list}
+% \changes{v3.6a}{2011/04/30}{Added 'xetex' to the option list}
 %    \begin{macrocode}
 \DeclareOption*{\OptionNotUsed\PackageError
       {changebar}%
       {Unrecognised option `\CurrentOption'\MessageBreak
         known options are dvitoln03, dvitops, dvips,\MessageBreak
-        emtex, textures, pdftex and vtex, 
+        emtex, textures, pdftex, vtex and xetex, 
         grey, color, xcolor,\MessageBreak
         outerbars, innerbars, leftbars and rightbars}}
 %    \end{macrocode}
@@ -902,18 +937,23 @@
 % \changes{v3.4b}{2001/08/28}{Added `grey' to the list of default
 %    options}
 % \changes{v3.4d}{2001/09/04}{Added detection of V\TeX}
+% \changes{v3.5a}{2005/05/23}{Added detection of PDF\TeX}
 % \begin{changebar}
-% \changes{v3.5a}{2005/05/23}{Added detection of PDF\TeX}
+% \changes{v3.6a}{2011/04/30}{Added detection of Xe\TeX}
 %    \begin{macrocode}
 \ifx\VTeXversion\@undefined
-  \ifx\pdfoutput\@undefined
-    \ExecuteOptions{innerbars,traceoff,dvips,grey}
-  \else
-    \ifnum\pdfoutput>0
-      \ExecuteOptions{innerbars,traceoff,pdftex,grey}
+  \expandafter\ifx\csname XeTeXrevision\endcsname\@undefined
+    \ifx\pdfoutput\@undefined
+      \ExecuteOptions{innerbars,traceoff,dvips,grey}
     \else
-      \ExecuteOptions{innerbars,traceoff,dvips,grey}
+      \ifnum\pdfoutput>0
+        \ExecuteOptions{innerbars,traceoff,pdftex,grey}
+      \else
+        \ExecuteOptions{innerbars,traceoff,dvips,grey}
+      \fi
     \fi
+  \else
+    \ExecuteOptions{innerbars,traceoff,xetex,grey}
   \fi
 \else
   \ExecuteOptions{innerbars,traceoff,vtex,grey}
@@ -978,7 +1018,6 @@
 \ProcessOptions\relax
 %    \end{macrocode}
 %
-% \begin{changebar}
 %    We have to make sure that when the document is being processed by
 %    pdf\LaTeX, while also creating pdf as output, the driver to be
 %    used is the pdf driver. Therefore we add an extra check, possibly
@@ -997,7 +1036,6 @@
   \fi
 \fi
 %    \end{macrocode}
-% \end{changebar}
 %
 %  \begin{macro}{\cb at trace}
 %    A macro that formats the tracing messages.
@@ -1028,8 +1066,9 @@
 %    \item em\TeX
 %    \item \TeX tures
 %    \item V\TeX
+%    \item PDF\TeX
 % \begin{changebar}
-%    \item PDF\TeX
+%    \item Xe\TeX
 % \end{changebar}
 %    \end{itemize}
 %    This command can only be used in the preamble of the document.
@@ -1042,7 +1081,6 @@
 %    compatibility mode} 
 % \changes{v3.3e}{1998/02/24}{Added \cs{Textures}}
 % \changes{v3.5a}{2005/05/23}{Added 'PDFtex' option}
-% \begin{changebar}
 %    \begin{macrocode}
 \if at compatibility
   \def\driver#1{%
@@ -1054,8 +1092,14 @@
       \def\emTeX{EMTEX}%
       \def\Textures{TEXTURES}%
       \def\VTeX{VTEX}%
-      \def\pdfTeX{PDFTEX}
+      \def\pdfTeX{PDFTEX}%
 %    \end{macrocode}
+% \begin{changebar}
+% \changes{v3.6a}{2011/04/30}{Added 'XeTeX' option}
+%    \begin{macrocode}
+      \def\xeTeX{XETEX}
+%    \end{macrocode}
+% \end{changebar}
 %    The choice has to be communicated to the macro
 %    \verb=\cb at setup@specials= that will be called from within
 %    \verb=\document=. For this purpose the control sequence
@@ -1070,9 +1114,16 @@
       \ifx\tempa\Textures \global\chardef\cb at driver@setup=4\fi
       \ifx\tempa\VTeX     \global\chardef\cb at driver@setup=5\fi
       \ifx\tempa\pdfTeX   \cb at pdftexcheck\fi
+%    \end{macrocode}
+% \begin{changebar}
+% \changes{v3.6a}{2011/04/30}{Added 'XeTeX' option}
+%    \begin{macrocode}
+      \ifx\tempa\xeTeX    \cb at xetexcheck\fi
+%    \end{macrocode}
+% \end{changebar}
+%    \begin{macrocode}
     \egroup}
 %    \end{macrocode}
-% \end{changebar}
 %    We add \verb+\driver+ to \verb+\@preamblecmds+, which is a
 %    list of commands to be used only in the preamble of a document.
 %    \begin{macrocode}
@@ -1245,9 +1296,8 @@
 %    a filled circle is shown for such lines.
 % \changes{v3.3e}{1998/02/24}{Added the definitions for textures
 %    support}
-% \changes{v3.5c}{2005/09/18}{A small change was submitted by gordon
+% \changes{v3.5c}{2005/09/18}{A small change was submitted by Gordon
 %    Lee from Blue Sky Systems}
-%  \begin{changebar}
 %    \begin{macrocode}
 \or
   \def\cb at defpoint##1##2{%
@@ -1259,7 +1309,6 @@
                 /CBarY\the##1\space exch def}%
     \if at cb@trace\cb at trace@defpoint##1##2\fi}
 %    \end{macrocode}
-%  \end{changebar}
 % \changes{v3.4b}{2001/08/29}{now use \cs{cb at ps@color} instead of
 %    setting the greyness directly}
 %    \begin{macrocode}
@@ -1302,8 +1351,7 @@
     \cb at trace@connect##1##2##3}
   \let\cb at resetpoints\relax
 %    \end{macrocode}
-% \begin{changebar}
-% \changes{v3.5a}{2005/05/23}{Pdftex support added}
+% \changes{v3.5a}{2005/05/23}{PDF\TeX{} support added}
 %    The code for PDF\TeX{} is more elaborate as the calculations have to
 %    be done in \TeX. |\cb at defpoint| will write information about the
 %    coordinates of the point to the \file{.aux} file, from where it will
@@ -1314,9 +1362,7 @@
   \immediate\closeout\cb at writexy
   \immediate\openin\cb at readxy=\jobname.cb2\relax
 %    \end{macrocode}
-% \end{changebar}
 %
-% \begin{changebar}
 % \begin{macro}{\cb at pdfpoints}
 % \begin{macro}{\cb at pdfpagenr}
 %   The |\cb at pdfpoints| macro contains the list of coordinates of points
@@ -1339,9 +1385,272 @@
   }
 %    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\cb@@findpdfpoint}
+%   The |\cb@@findpdfpoint| macro finds the coordinates of point \#1 on
+%   pagecount \#2. If the information is not yet in memory is it read from
+%   the \file{.cb2} file. The coordinates of the current point in the text
+%   will be delivered in |\cb at pdfx| and |\cb at pdfy|, and |\cb at pdfz| will get
+%   the x coordinate of the changebar. If the point is unknown, |\cb at pdfx|
+%   will be set to |\relax|.
+%    \begin{macrocode}
+  \def\cb@@findpdfpoint##1##2{%
+    \ifnum##2<\cb at pdfpagenr\relax\else
+      \cb at pdfreadxy{##2}%
+    \fi
+    \let\cb at pdfx\relax
+    \ifx\cb at pdfpoints\@empty\else
+      \ifnum##2<0\relax
+      \else
+        \edef\cb at temp{\noexpand\cb at pdffind{##1}{##2}\cb at pdfpoints\relax{}}%
+        \cb at temp
+      \fi
+    \fi
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\cb at pdffind}
+%    The |\cb at pdffind| recursively searches through |\cb at pdfpoints| to find
+%    point \#1 on pagecount \#2.  |\cb at pdfpoints| contains entries of the
+%    form \meta{pointnr}.\meta{pagecount}p\meta{x},\meta{y},\meta{z}pt.
+%    When the point is found it is removed from |\cb at pdfpoints|. \#9
+%    contains the cumulative head of the list to construct the new list
+%    with the entry removed. \#3--\#8 are for pattern matching.
+%    \begin{macrocode}
+  \def\cb at pdffind##1##2##3.##4p##5,##6,##7pt##8\relax##9{%
+    \def\cb at next{\cb at pdffind{##1}{##2}##8\relax{##9##3.##4p##5,##6,##7pt}}%
+    \ifnum ##1=##3
+      \ifnum ##2=##4
+        \def\cb at pdfx{##5sp}%
+        \def\cb at pdfy{##6sp}%
+        \def\cb at pdfz{##7pt}%
+        \let\cb at next\relax
+        \gdef\cb at pdfpoints{##9##8}%
+      \fi
+    \fi
+    \ifx\relax##8\relax
+      \let\cb at next\relax
+    \fi
+    \cb at next
+  }%
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\cb at pdfreadxy}
+%    The |\cb at pdfreadxy| macro reads lines from the \file{.cb2} file in
+%    |\cb at pdfpoints| until the pagecount is greater than \#1 or the end of
+%    the file is reached. This ensures that all entries belonging to the
+%    current column are in memory.
+%    \begin{macrocode}
+  \def\cb at pdfreadxy##1{%
+    \let\cb at next\relax
+    \ifeof\cb at readxy
+      \global\let\cb at pdfpagenr\cb at maxpoint
+    \else
+      {\endlinechar=-1\read\cb at readxy to\cb at temp
+        \ifx\cb at temp\@empty\else
+          \expandafter\cb at pdfparsexy\cb at temp
+          \ifnum\cb at pdfpg<0\else
+            \xdef\cb at pdfpoints{\cb at pdfpoints\cb at temp}%
+            \cb at trace{PDFpoints=\cb at pdfpoints}%
+            \global\let\cb at pdfpagenr\cb at pdfpg
+          \fi
+          \ifnum\cb at pdfpg>##1\else
+            \global\def\cb at next{\cb at pdfreadxy{##1}}%
+          \fi
+        \fi
+      }%
+    \fi
+    \cb at next
+  }%
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\cb at pdfparsexy}
+%    The |\cb at pdfparsexy| macro extracts the pagecount from an entry read in
+%    from the \file{.cb2} file.
+%    \begin{macrocode}
+  \def\cb at pdfparsexy##1.##2p##3,##4,##5pt{%
+    \def\cb at pdfpg{##2}}%
+%    \end{macrocode}
+% \end{macro}
+%
+%    As PDF is not a programming language it does not have any variables to
+%    remember the coordinates of the current point. Therefore we write the
+%    information to the \file{.aux} file and read it in in the next run. We
+%    write the x,y coordinates of the current point in the text and the x
+%    coordinate of the change bar. 
+%    We also need the value of |\cb at pagecount| here, not during the write.
+%    \begin{macrocode}
+  \def\cb at defpoint##1##2{%
+    \if at filesw
+      \begingroup
+        \edef\point{{\the##1}{\the\cb at pagecount}}%
+        \let\the=\z@
+        \pdfsavepos
+        \edef\cb at temp{\write\@auxout
+          {\string\cb at pdfxy\point
+            {\the\pdflastxpos}{\the\pdflastypos}{\the##2}}}%
+        \cb at temp
+      \endgroup
+    \fi
+    \cb at trace@defpoint##1##2%
+  }%
+%    \end{macrocode}
+%
+% \begin{macro}{\cb at cvtpct}
+%    The macro |\cb at cvtpct| converts a percentage between 0 and 100 to a
+%    decimal fraction.
+%    \begin{macrocode}
+  \def\cb at cvtpct##1{%
+    \ifnum##1<0 0\else
+    \ifnum##1>99 1\else
+    \ifnum##1<10 0.0\the##1\else
+    0.\the##1\fi\fi\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+%    The |\cb at connect| finds the coordinates of the begin and end points,
+%    converts them to PDF units and draws the bar with |\pdfliteral|. It
+%    also sets the color or gray level, if necessary. When any of the
+%    points is unknown the bar is skipped and a rerun is signalled.
+%    \begin{macrocode}
+  \def\cb at connect##1##2##3{%
+    \cb at findpdfpoint{##1}\cb at pagecount
+    \ifx\cb at pdfx\relax\cb at rerun
+    \else
+      \let\cb at pdftopy\cb at pdfy
+      \cb at findpdfpoint{##2}\cb at pagecount
+      \ifx\cb at pdfx\relax\cb at rerun
+      \else
+%    \end{macrocode}
+%    We do everything in a group, so that we can freely use all kinds of
+%    registers.
+%    \begin{macrocode}
+         \begingroup
+           \cb at dima=\cb at pdfz
+           \advance\cb at dima by-\cb at pdfx
+           \advance\cb at dima by1in
+           \cb at dima=0.996264009963\cb at dima\relax
+%    \end{macrocode}
+%    First we let PDF save the graphics state. Then we generate the color
+%    selection code followed by the code to draw the changebar. Finally the
+%    graphics state is restored. We cannot use the color commands from the
+%    color package here, as the generated PDF code may be moved to the next
+%    line.
+%    \begin{macrocode}
+           \ifx\cb at current@color\@undefined
+             \def\cb at temp{\cb at cvtpct\c at changebargrey}%
+             \pdfliteral{q \cb at temp\space g \cb at temp\space G}%
+           \else
+             \pdfliteral{q \cb at current@color}%
+           \fi
+           \edef\cb at temp{\expandafter\cb at removedim\the\cb at dima\space}%
+           \cb at dima=\cb at pdftopy
+           \advance\cb at dima-\cb at pdfy\relax
+           \cb at dima=0.996264009963\cb at dima\relax
+           ##3=0.996264009963##3\relax
+           \pdfliteral direct{\expandafter\cb at removedim\the##3 w
+             \cb at temp 0 m
+             \cb at temp \expandafter\cb at removedim\the\cb at dima\space l S Q}%
+        \endgroup
+%    \end{macrocode}
+%    We look up the two unused points to get them removed from |\cb at pdfpoints|.
+%    \begin{macrocode}
+        \cb at cntb=##1\relax
+        \ifodd\cb at cntb\advance\cb at cntb 1\else\advance\cb at cntb -1\fi
+        \cb at findpdfpoint\cb at cntb\cb at pagecount
+        \cb at cntb=##2\relax
+        \ifodd\cb at cntb\advance\cb at cntb 1\else\advance\cb at cntb -1\fi
+        \cb at findpdfpoint\cb at cntb\cb at pagecount
+      \fi
+    \fi
+    \cb at trace@connect##1##2##3%
+  }%
+%    \end{macrocode}
+%
+% \begin{macro}{\cb at checkPdfxy}
+%    The macro |\cb at checkPdfxy| checks if the coordinates of a point have
+%    changed during the current run. If so, we need to rerun \LaTeX.
+%    \begin{macrocode}
+  \gdef\cb at checkPdfxy##1##2##3##4##5{%
+    \cb@@findpdfpoint{##1}{##2}%
+    \ifnum##3=\cb at pdfx\relax
+      \ifnum##4=\cb at pdfy\relax
+        \ifdim##5=\cb at pdfz\relax
+        \else
+        \cb at error
+        \fi
+      \else
+        \cb at error
+      \fi
+    \else
+      \cb at error
+    \fi
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    For PDF\TeX{} we don't need a limit on the number of bar points.
+%    \begin{macrocode}
+  \def\cb at maxpoint{9999999}
+  \let\cb at resetpoints\relax
+\or
+%    \end{macrocode}
+%
+% \begin{changebar}
+% \changes{v3.6a}{2011/04/30}{Xe\TeX{} support added}
+%    The code for Xe\TeX{} is, like for PDF\TeX{}, more elaborate as
+%    the calculations have to 
+%    be done in \TeX. |\cb at defpoint| will write information about the
+%    coordinates of the point to the \file{.aux} file, from where it will
+%    be picked up in the next run. Then we will construct the PDF
+%    code necessary to draw the changebars.
+%    \begin{macrocode}
+  \immediate\closeout\cb at writexy
+  \immediate\openin\cb at readxy=\jobname.cb2\relax
+%    \end{macrocode}
 % \end{changebar}
 %
 % \begin{changebar}
+% \begin{macro}{\cb at pdfpoints}
+% \begin{macro}{\cb at pdfpagenr}
+%   The |\cb at pdfpoints| macro contains the list of coordinates of points
+%   that have been read in memory from the \file{.cb2} file. The
+%   |\cb at pdfpagenr| macro contains the next pagecount to be read in.
+%    \begin{macrocode}
+  \def\cb at pdfpoints{}
+  \def\cb at pdfpagenr{0}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{changebar}
+%
+% \begin{changebar}
+%  \begin{macro}{\cb at findpdfpoint}
+%    The |\cb at findpdfpoint| macro finds the coordinates of point \#1 on
+%    pagecount \#2. First we expand the arguments to get the real values.
+%    \begin{macrocode}
+  \def\cb at findpdfpoint##1##2{%
+      \edef\cb at temp
+        {\noexpand\cb@@findpdfpoint{\the##1}{\the##2}}%
+      \cb at temp
+  }
+%    \end{macrocode}
+%  \end{macro}
+% \end{changebar}
+%
+% \begin{changebar}
+%  \begin{macro}{\pdfliteral}
+%    For Xe\TeX{} we mimick PDF\TeX's command |\pdfliteral|.
+%    \begin{macrocode}
+  \def\pdfliteral##1{\special{pdf:literal ##1}}
+%    \end{macrocode}
+%  \end{macro}
+% \end{changebar}
+%
+% \begin{changebar}
 % \begin{macro}{\cb@@findpdfpoint}
 %   The |\cb@@findpdfpoint| macro finds the coordinates of point \#1 on
 %   pagecount \#2. If the information is not yet in memory is it read from
@@ -1479,6 +1788,17 @@
 % \end{changebar}
 %
 % \begin{changebar}
+% \begin{macro}{\cb at pdf@scale}
+% \changes{v3.6a}{2018/02/03}{Added macro for scale factor}
+%    In order to get things in the rightspot we need a little scaling
+%    factor. We define it here.
+%    \begin{macrocode}
+\def\cb at pdf@scale{0.996264009963}
+%    \end{macrocode}
+% \end{macro}
+% \end{changebar}
+%
+% \begin{changebar}
 %    The |\cb at connect| finds the coordinates of the begin and end points,
 %    converts them to PDF units and draws the bar with |\pdfliteral|. It
 %    also sets the color or gray level, if necessary. When any of the
@@ -1500,7 +1820,7 @@
            \cb at dima=\cb at pdfz
            \advance\cb at dima by-\cb at pdfx
            \advance\cb at dima by1in
-           \cb at dima=0.996264009963\cb at dima\relax
+           \cb at dima=\cb at pdf@scale\cb at dima\relax
 %    \end{macrocode}
 %    First we let PDF save the graphics state. Then we generate the color
 %    selection code followed by the code to draw the changebar. Finally the
@@ -1512,14 +1832,15 @@
              \def\cb at temp{\cb at cvtpct\c at changebargrey}%
              \pdfliteral{q \cb at temp\space g \cb at temp\space G}%
            \else
-             \pdfliteral{q \cb at current@color}%
+             \pdfliteral{q \expandafter\sec at nd@ftw@\cb at current@color\space RG 
+                           \expandafter\sec at nd@ftw@\cb at current@color\space rg}%
            \fi
            \edef\cb at temp{\expandafter\cb at removedim\the\cb at dima\space}%
            \cb at dima=\cb at pdftopy
            \advance\cb at dima-\cb at pdfy\relax
-           \cb at dima=0.996264009963\cb at dima\relax
-           ##3=0.996264009963##3\relax
-           \pdfliteral direct{\expandafter\cb at removedim\the##3 w
+           \cb at dima=\cb at pdf@scale\cb at dima\relax
+           ##3=\cb at pdf@scale##3\relax
+           \pdfliteral{\expandafter\cb at removedim\the##3 w
              \cb at temp 0 m
              \cb at temp \expandafter\cb at removedim\the\cb at dima\space l S Q}%
         \endgroup
@@ -1564,18 +1885,18 @@
 % \end{changebar}
 %
 % \begin{changebar}
-%    For PDF\TeX{} we don't need a limit on the number of bar points.
+%    For Xe\TeX{} we don't need a limit on the number of bar points.
 %    \begin{macrocode}
   \def\cb at maxpoint{9999999}
   \let\cb at resetpoints\relax
 %    \end{macrocode}
 % \end{changebar}
+%
 %    When code for other drivers should be added it can be inserted
 %    here.  When someone makes a mistake and somehow selects an
 %    unknown driver a warning is issued and the macros are defined to
 %    be no-ops.
 %    \begin{macrocode}
-\or
 \else
   \PackageWarning{Changebar}{changebars not supported in unknown setup}
   \def\cb at defpoint##1##2{\cb at trace@defpoint##1##2}
@@ -1684,9 +2005,12 @@
 % \begin{macro}{\changebarsep}
 %    The default separation between all bars and the text is stored in
 %    the dimen register |\changebarsep|.
+% \changes{v3.6b}{2018/02/04}{set the default separtion between text
+%    and changebars to half the separation between text and marginal
+%    paragraphs} 
 %    \begin{macrocode}
 \newlength{\changebarsep}
-\setlength{\changebarsep}{30pt}
+\setlength{\changebarsep}{0.5\marginparsep}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1708,7 +2032,6 @@
 %    selected we need to load the appropriate package. When we're run
 %    by pdf\LaTeX\ we need to pass that information on to that package.
 % \changes{v3.4e}{2001/09/14}{Detect pdf mode}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{The option \Lopt{pdftex} will be supplied
 %    automatically with the current color packages. Leave out
 %    \Lopt{dvipsnames} as it is usually automatically loaded and may clash
@@ -1718,7 +2041,6 @@
 \@ifpackagewith{changebar}{\csname cb at color@pkg\endcsname}{%
     \RequirePackage{\cb at color@pkg}%
 %    \end{macrocode}
-% \end{changebar}
 %    Then we need to define the command |\cbcolor| which is a slightly
 %    modified copy of the command |\color| from the \pkg{color}
 %    package.
@@ -1746,7 +2068,6 @@
 % \changes{v3.5c}{2005/09/18}{Use the higher level interface throug
 %    \cs{color} to prevent problemns with \texttt{color.sty} or
 %    \texttt{xcolor.sty}}
-% \begin{changebar}
 %    \begin{macrocode}
   \def\@undeclaredcbcolor[#1]#2{%
     \begingroup
@@ -1756,7 +2077,6 @@
     \ignorespaces
     }
 %    \end{macrocode}
-% \end{changebar}
 %  \end{macro}
 %
 %  \begin{macro}{\@declaredcbcolor}
@@ -1763,7 +2083,6 @@
 % \changes{v3.5c}{2005/09/18}{Use the higher level interface throug
 %    \cs{color} to prevent problemns with \texttt{color.sty} or
 %    \texttt{xcolor.sty}}
-% \begin{changebar}
 %    \begin{macrocode}
   \def\@declaredcbcolor#1{%
     \begingroup
@@ -1773,7 +2092,6 @@
     \ignorespaces}%
   }{%
 %    \end{macrocode}
-% \end{changebar}
 %    When the \Lopt{color} option wasn't specified the usage of the
 %    |\cbcolor| command results in a warning message.
 % \changes{v3.4d}{2001/09/04}{Isue an error when \cmd{cbcolor} is
@@ -1814,12 +2132,10 @@
 %    due to the asynchronous nature of the output routine it might be
 %    a different page. The macro |\cb at checkpage| finds the page number
 %    on the history stack.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Correction for nested changebars}
 %    \begin{macrocode}
   \cb at checkpage\z@
 %    \end{macrocode}
-% \end{changebar}
 %    Temporarily assign the page number to |\cb at pagecount| as that
 %    register is used by |\cb at setBeginPoints|. Note that it's value is
 %    offset by one from the page counter.
@@ -1887,27 +2203,19 @@
 %    \end{macrocode}
 %    Call |\cb at checkpage| to find the page this point finally ends up
 %    on.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Correction for nested changebars}
 %    \begin{macrocode}
     \cb at checkpage\thr@@
 %    \end{macrocode}
-% \end{changebar}
 %    Again, we need to temporarily overwrite |\cb at pagecount|.
 %    \begin{macrocode}
     \cb at cnta\cb at pagecount
     \cb at pagecount\cb at page\advance\cb at pagecount\m at ne
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
     \ifvmode
       \cb at setEndPoints
     \else
       \vadjust{\cb at setEndPoints}%
     \fi
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
     \cb at pagecount\cb at cnta
   \fi
   \ignorespaces}
@@ -1921,10 +2229,8 @@
 %
 %    We expect the identification of the points in |\cb at topleft| and
 %    |\cb at page|. The resulting page will be stored in |\cb at page|.
-% \begin{changebar}
 %    The parameter indicates whether we are searching for a begin
 %    point (0) or end point (3).
-% \end{changebar}
 % \changes{v3.3i}{1999/06/18}{Check for and handle the situation that
 %    the history stack is too short due to new bars added to a
 %    document}
@@ -1935,13 +2241,7 @@
 %    First store the identifiers in temporary registers.
 %    \begin{macrocode}
   \cb at cnta\cb at topleft\relax
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
   \advance\cb at cnta by #1\relax
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
   \cb at cntb\cb at page\relax
   \cb at dima\cb at curbarwd\relax
 %    \end{macrocode}
@@ -1954,7 +2254,6 @@
   \ifnum\cb at topleft=\cb at nil
   \else
 %    \end{macrocode}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Correction for moving floats}
 %    Now keep popping the stack until |\cb at topleft| is found. The values
 %    popped from the stack are pushed on a temporary stack to be pushed
@@ -1963,7 +2262,6 @@
 %    \begin{macrocode}
     \cb at FindPageNum
 %    \end{macrocode}
-% \end{changebar}
 % \changes{v3.5a}{2005/05/23}{Correction for nested changebars}
 %    \begin{macrocode}
     \ifnum\cb at topleft>\cb at maxpoint\else
@@ -1981,14 +2279,10 @@
       \cb at pop\cb at tempstack}%
   \fi
 %    \end{macrocode}
-%    Finally return the correct values.
-% \begin{changebar}
+%    Finally return the correct values
 % \changes{v3.5a}{2005/05/23}{Correction for nested changebars}
 %    \begin{macrocode}
   \advance\cb at cnta by -#1\relax
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
   \cb at topleft\cb at cnta\relax
   \cb at page\cb at cntb\relax
   \cb at curbarwd\cb at dima\relax
@@ -1996,7 +2290,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{changebar}
 % \begin{macro}{\cb at FindPageNum}
 %    |\cb at FindPageNum| recursively searches through the history stack until
 %    an entry is found that is equal to |\cb at cnta|.
@@ -2032,7 +2325,6 @@
   }%
 %    \end{macrocode}
 % \end{macro}
-% \end{changebar}
 %
 % \begin{macro}{\cb at setBeginPoints}
 % \changes{v3.3a}{1997/09/26}{Renamed from \cs{cb at setBeginPoint} and
@@ -2051,15 +2343,9 @@
 %    \begin{macrocode}
 \def\cb at setBeginPoints{%
   \cb at topright=\cb at topleft\advance\cb at topright by\@ne
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
   \cb at cntb=\cb at pagecount
   \divide\cb at cntb by\tw@
   \ifodd\cb at cntb
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
     \cb at defpoint\cb at topleft\cb at even@left
     \cb at defpoint\cb at topright\cb at even@right
   \else
@@ -2092,26 +2378,14 @@
   \cb at topright=\cb at topleft\advance\cb at topright by\@ne
   \cb at botleft=\cb at topleft\advance\cb at botleft by\tw@
   \cb at botright=\cb at topleft\advance\cb at botright by\thr@@
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
    \cb at cntb=\cb at pagecount
   \divide\cb at cntb by\tw@
   \ifodd\cb at cntb
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
     \cb at defpoint\cb at botleft\cb at even@left
     \cb at defpoint\cb at botright\cb at even@right
   \else
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
     \cb at defpoint\cb at botleft\cb at odd@left
     \cb at defpoint\cb at botright\cb at odd@right
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
   \fi
   \cb at writeAux\cb at botright
   \edef\cb at leftbar{%
@@ -2124,16 +2398,13 @@
 % \changes{v3.5a}{2005/05/23}{Checking |@firstcolumn| outside the output
 %    routine is unreliable; check \cs{cb at pagecount} instead}
 %    In twocolumn pages always use outerbars
-% \begin{changebar}
 %    \begin{macrocode}
   \if at twocolumn
      \ifodd\cb at pagecount\cb at rightbar\else\cb at leftbar\fi
 %    \end{macrocode}
-% \end{changebar}
 %    
 % \changes{v3.4e}{2001/09/07}{The \cs{outerbars} conditional should be
 %    inside an \cs{else} clause}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Series of \cs{if}s replaced by
 %    \cs{ifcase} on \cs{cb at barsplace}}
 %    \begin{macrocode}
@@ -2170,7 +2441,6 @@
   \fi
   }%
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \begin{macro}{\cb at writeAux}
@@ -2201,7 +2471,6 @@
 % \subsection{Macros for Making It Work Across Page Breaks}
 % \label{pagebreak}
 %
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for twocolumn support: Detect page
 %    number changes in righthand columns.}
 % \begin{Var}{@cb at pagejump}
@@ -2256,10 +2525,8 @@
   \gdef\cb at pagejumplst{#2}}
 %    \end{macrocode}
 % \end{macro}
-% \end{changebar}
 %
 % \begin{macro}{\cb at checkpagecount}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    This macro checks that |\cb at pagecount| is correct at the beginning of
 %    a column or page.
@@ -2318,8 +2585,6 @@
           \fi
         \else
 %    \end{macrocode}
-% \end{changebar}
-% \begin{changebar}
 %    In the righthand column check the flag (see above). If set, write a
 %    pagejump, but compensate for the increase done in the lefthand column.
 %    \begin{macrocode}
@@ -2353,7 +2618,6 @@
   \fi
 }    
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \begin{macro}{\@makecol}
@@ -2377,7 +2641,6 @@
 % \changes{v3.3a}{1997/09/26}{Now use the command
 %    \cs{cb at startSpanBars} to define top points for bars spoanning a
 %    page break} 
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    \begin{macrocode}
 \let\ltx at makecol\@makecol
@@ -2389,15 +2652,10 @@
                   \string\cb at pagecount=\the\cb at pagecount}%
   \let\cb at writeAux\@gobble
 %    \end{macrocode}
-% \end{changebar}
 %    First make sure that |\cb at pagecount| is correct.
 %    Then add the necessary bar points at beginning and end.
-% \begin{changebar}
 %    \begin{macrocode}
   \cb at checkpagecount
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
   \setbox\@cclv \vbox{%
     \cb at resetpoints
     \cb at startSpanBars
@@ -2407,7 +2665,6 @@
   \cb at buildstack\cb at processActive
   \ltx at makecol
 %    \end{macrocode}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    In twocolumn pages write information to the aux file to indicate which
 %    column we are in. This write must precede the whole column, including
@@ -2425,9 +2682,6 @@
    \fi
   \cb at trace@stack{after makecol, page \the\c at page,
                   \string\cb at pagecount=\the\cb at pagecount}%
-%    \end{macrocode}
-% \end{changebar}
-%    \begin{macrocode}
   }
 \let\@makecol\cb at makecol
 %    \end{macrocode}
@@ -2439,7 +2693,6 @@
 % \changes{v3.3a}{1997/09/26}{Now use the command
 %    \cs{cb at startSpanBars} to define top points for bars spoanning a
 %    page break} 
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{We don't want spanning changebars from a
 %    previous page in a float column.
 %    The original code didn't work anyway. It did set \@outputbox,
@@ -2472,7 +2725,6 @@
 }
 \let\@vtryfc\cb at vtryfc
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 % \end{macro}
 %
@@ -2679,7 +2931,6 @@
 %    stack; now it specifically checks that we are popping the history
 %    stack itself. Moreover we read from file only if the history
 %    stack is empty.}
-% \begin{changebar}
 %    \begin{macrocode}
 \def\cb at thehistorystack{\cb at historystack}
 \def\cb at pop#1{%
@@ -2702,7 +2953,6 @@
   \fi
   \cb at trace@pop{#1}}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \begin{macro}{\cb at carcdr}
@@ -2738,13 +2988,11 @@
 %    \meta{element} described above. 
 % \changes{v3.5a}{2005/05/23}{Changes for twocolumn support: if a bar point
 %    is in the left column we have to subtract one from the pagecount.}
-% \begin{changebar}
 %    \begin{macrocode}
 \def\cb at barpoint#1#2#3{\cb at cnta=#2
   \if at cb@firstcolumn\advance\cb at cnta by\m at ne\fi
   \immediate\write\cb at write{#1n\the\cb at cnta p#3l}}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \subsection{Macros For Checking That The \file{.aux} File Is Stable}
@@ -2766,7 +3014,6 @@
 \AtBeginDocument{%
   \cb at setup@specials
 %    \end{macrocode}
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    Add a sentinel to \cs{cb at pagejumplst}.
 %    \begin{macrocode}
@@ -2774,8 +3021,7 @@
 %    \end{macrocode}
 % \changes{v3.5a}{2005/05/23}{Adaption of \cs{cb at pagecount} is no longer
 %    necessary, as \cs{cb at pagecount} will be adjusted at the beginning of
-%    \cs{@makecol} and \cs{@vtryfc}.} 
-% \end{changebar}
+%    \cs{@makecol} and \cs{@vtryfc}.}
 %    Compute the left and right positions of the changebars.
 % \changes{v3.4g}{2004/01/09}{Added tracing information for the left
 %    and right postions} 
@@ -2812,7 +3058,6 @@
   \immediate\openin\cb at read=\jobname.cb%
 %    \end{macrocode}
 %    
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{For pdftex we also close and reread the
 %    \file{.cb2} file.}
 %    Let |\cb at pdfxy=\cb at checkPdfxy| for checking. Make |\cb at pagejump| dummy.
@@ -2830,7 +3075,6 @@
   \let\cb at pagejump\@gobble
   \let\cb at barpoint\cb at checkHistory}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \begin{macro}{\cb at checkHistory}
@@ -2839,7 +3083,6 @@
 %    see if the point and page numbers are the same as the arguments
 %    $\#1$ and $\#2$ respectively.  Prints a warning message if
 %    different.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Changes for twocolumn support: if a bar point
 %    is in the left column we have to subtract one from the pagecount.}
 %    \begin{macrocode}
@@ -2850,7 +3093,6 @@
     \if at cb@firstcolumn\advance\cb at cnta by\m at ne\fi
     \ifnum \cb at cnta=\cb at page\relax
 %    \end{macrocode}
-% \end{changebar}
 %    Both page and point numbers are equal; do nothing,
 %    \begin{macrocode}
     \else
@@ -2866,16 +3108,13 @@
     \cb at error
   \fi}
 %    \end{macrocode}
-% \begin{changebar}
 %    Dummy definition for |\cb at checkPdfxy|. This will be overwritten by
-%    the \Lopt{pdftex} option.
+%    the \Lopt{pdftex}\cbstart{} and \Lopt{xetex}\cbend{} options.
 %    \begin{macrocode}
 \def\cb at checkPdfxy#1#2#3#4#5{}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
-% \begin{changebar}
 % \begin{macro}{\cb at rerun}
 % \changes{v3.5a}{2005/05/23}{Changes for better twocolumn support}
 %    The macro |\cb at rerun| is called when we detect that we need to rerun
@@ -2886,16 +3125,14 @@
 \let\cb at checkrerun\relax
 %    \end{macrocode}
 % \end{macro}
-% \end{changebar}
 %
 % \begin{macro}{\cb at error}
 %    When a mismatch between the changebar information in the
 %    auxiliary file and the history stack is detected a warning is
 %    issued; further checking is disabled.
-% \begin{changebar}
 % \changes{v3.5a}{2005/05/23}{Added pdftex support}
-%    For pdftex we also disable |\cb at checkPdfxy|.
-% \end{changebar}
+%    For pdf\TeX\cbstart{} and Xe\TeX\cbend{} we also disable
+%    |\cb at checkPdfxy|.
 %    \begin{macrocode}
 \def\cb at error{%
   \PackageWarning{Changebar}%
@@ -2903,13 +3140,9 @@
      Rerun to get the bars right}
   \gdef\cb at checkHistory##1##2##3{}%
   \let\cb at barpoint\cb at checkHistory
-%    \end{macrocode}
-% \begin{changebar}
-%    \begin{macrocode}
   \gdef\cb at checkPdfxy##1##2##3##4##5{}%
   \let\cb at pdfxy\cb at checkPdfxy}
 %    \end{macrocode}
-% \end{changebar}
 % \end{macro}
 %
 % \subsection{Macros For Making It Work With Nested Floats/Footnotes}
@@ -2956,6 +3189,25 @@
 %    rebind |\endfigure|.
 % \changes{3.2}{1994/04/21}{Removed
 %    \cs{let}\cs{endfigure}\cs{end at float}, no longer necessary}
+%
+%  \begin{macro}{\@xympar}
+%    There is one snag with this redefinition in that the macro
+%    |\end at float| is also used by the command |\marginpar|. This may
+%    lead to problems with stack underflow. Therefore we need to
+%    redefine an internal macro from the marginal paragraph mechanism
+%    as well. The solution is to make sure the this macro uses the
+%    original definition of |\end at float|.
+% \changes{v3.5d}{2005/12/24}{Redefine \cs{@xympar} to use the
+%    original version of \cs{end at float}}
+%    \begin{macrocode}
+\let\ltx@@xympar\@xympar
+\def\@xympar{%
+  \let\end at float\ltx at end@float
+  \ltx@@xympar
+  \let\end at float\cb at end@float}
+%    \end{macrocode}
+%  \end{macro}
+%
 % \end{macro}
 %
 %  \begin{macro}{\float at end}

Modified: trunk/Master/texmf-dist/source/latex/changebar/changebar.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/changebar/changebar.ins	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/source/latex/changebar/changebar.ins	2018-02-04 21:37:38 UTC (rev 46540)
@@ -10,7 +10,7 @@
 %% 
 %% IMPORTANT NOTICE:
 %% 
-%% Copyright (C) 1994-2005 Johannes Braams,  All rights reserved.
+%% Copyright (C) 1994-2018 Johannes Braams,  All rights reserved.
 %% 
 %% This program can be redistributed and/or modified under the terms
 %% of the LaTeX Project Public License Distributed from CTAN
@@ -24,7 +24,7 @@
 \preamble
 This is a generated file.
 
-Copyright (C) 1994-2005 Johannes Braams,  All rights reserved.
+Copyright (C) 1994-2018 Johannes Braams,  All rights reserved.
 
 This file was generated from file(s) of the changebar package.
 --------------------------------------------------------------

Modified: trunk/Master/texmf-dist/tex/latex/changebar/changebar.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/changebar/changebar.sty	2018-02-04 20:47:24 UTC (rev 46539)
+++ trunk/Master/texmf-dist/tex/latex/changebar/changebar.sty	2018-02-04 21:37:38 UTC (rev 46540)
@@ -7,7 +7,7 @@
 %% changebar.dtx  (with options: `package')
 %% This is a generated file.
 %% 
-%% Copyright (C) 1994-2005 Johannes Braams,  All rights reserved.
+%% Copyright (C) 1994-2018 Johannes Braams,  All rights reserved.
 %% 
 %% This file was generated from file(s) of the changebar package.
 %% --------------------------------------------------------------
@@ -34,10 +34,10 @@
 %% The list of derived (unpacked) files belonging to the distribution
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
-%% Copyright 1994-2005 (C) Johannes Braams.  All rights reserved.
+%% Copyright 1994-2018 (C) Johannes Braams.  All rights reserved.
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{changebar}
-           [2005/09/18 v3.5c Indicate changes with marginal bars]
+           [2018/02/04 v3.6b Indicate changes with marginal bars]
 \def\cb at maxpoint{80}
 \def\cb at minpoint{1}
 \def\cb at nil{0}
@@ -119,6 +119,26 @@
       {PDFTeX option cannot be used}%
       {You are using a LaTeX run which does not generate PDF\MessageBreak
         or you are using a very old version of PDFTeX}}
+\DeclareOption{XeTeX}{\cb at xetexcheck}
+\DeclareOption{xetex}{\cb at xetexcheck}
+\def\cb at xetexcheck{%
+  \expandafter\ifx\csname XeTeXrevision\endcsname\@undefined \cb at xetexerror
+  \else
+    \global\chardef\cb at driver@setup=7\relax
+    \ifx\cb at writexy\@undefined
+      \newwrite\cb at writexy
+      \newread\cb at readxy
+      \immediate\openout\cb at writexy=\jobname.cb2\relax
+    \fi
+    \gdef\cb at pdfxy##1##2##3##4##5{%
+      \immediate\write\cb at writexy{##1.##2p##3,##4,##5}%
+      \expandafter\gdef\csname cb@##1.##2\endcsname{##3,##4,##5}}
+    \gdef\sec at nd@ftw@##1 ##2{##2}
+  \fi}
+\def\cb at xetexerror{\PackageError
+      {changebar}%
+      {XeTeX option cannot be used}%
+      {You are not using XeLaTeX}}
 \DeclareOption{outerbars}{\def\cb at barsplace{1}}
 \DeclareOption{innerbars}{\def\cb at barsplace{0}}
 \DeclareOption{leftbars}{\def\cb at barsplace{2}}
@@ -144,18 +164,22 @@
       {changebar}%
       {Unrecognised option `\CurrentOption'\MessageBreak
         known options are dvitoln03, dvitops, dvips,\MessageBreak
-        emtex, textures, pdftex and vtex,
+        emtex, textures, pdftex, vtex and xetex,
         grey, color, xcolor,\MessageBreak
         outerbars, innerbars, leftbars and rightbars}}
 \ifx\VTeXversion\@undefined
-  \ifx\pdfoutput\@undefined
-    \ExecuteOptions{innerbars,traceoff,dvips,grey}
-  \else
-    \ifnum\pdfoutput>0
-      \ExecuteOptions{innerbars,traceoff,pdftex,grey}
+  \expandafter\ifx\csname XeTeXrevision\endcsname\@undefined
+    \ifx\pdfoutput\@undefined
+      \ExecuteOptions{innerbars,traceoff,dvips,grey}
     \else
-      \ExecuteOptions{innerbars,traceoff,dvips,grey}
+      \ifnum\pdfoutput>0
+        \ExecuteOptions{innerbars,traceoff,pdftex,grey}
+      \else
+        \ExecuteOptions{innerbars,traceoff,dvips,grey}
+      \fi
     \fi
+  \else
+    \ExecuteOptions{innerbars,traceoff,xetex,grey}
   \fi
 \else
   \ExecuteOptions{innerbars,traceoff,vtex,grey}
@@ -199,7 +223,8 @@
       \def\emTeX{EMTEX}%
       \def\Textures{TEXTURES}%
       \def\VTeX{VTEX}%
-      \def\pdfTeX{PDFTEX}
+      \def\pdfTeX{PDFTEX}%
+      \def\xeTeX{XETEX}
       \global\chardef\cb at driver@setup=0\relax
       \ifx\tempa\LN       \global\chardef\cb at driver@setup=0\fi
       \ifx\tempa\DVItoPS  \global\chardef\cb at driver@setup=1\fi
@@ -208,6 +233,7 @@
       \ifx\tempa\Textures \global\chardef\cb at driver@setup=4\fi
       \ifx\tempa\VTeX     \global\chardef\cb at driver@setup=5\fi
       \ifx\tempa\pdfTeX   \cb at pdftexcheck\fi
+      \ifx\tempa\xeTeX    \cb at xetexcheck\fi
     \egroup}
   {\def\do{\noexpand\do\noexpand}
     \xdef\@preamblecmds{\@preamblecmds \do\driver}
@@ -451,6 +477,144 @@
   \def\cb at maxpoint{9999999}
   \let\cb at resetpoints\relax
 \or
+  \immediate\closeout\cb at writexy
+  \immediate\openin\cb at readxy=\jobname.cb2\relax
+  \def\cb at pdfpoints{}
+  \def\cb at pdfpagenr{0}
+  \def\cb at findpdfpoint##1##2{%
+      \edef\cb at temp
+        {\noexpand\cb@@findpdfpoint{\the##1}{\the##2}}%
+      \cb at temp
+  }
+  \def\pdfliteral##1{\special{pdf:literal ##1}}
+  \def\cb@@findpdfpoint##1##2{%
+    \ifnum##2<\cb at pdfpagenr\relax\else
+      \cb at pdfreadxy{##2}%
+    \fi
+    \let\cb at pdfx\relax
+    \ifx\cb at pdfpoints\@empty\else
+      \ifnum##2<0\relax
+      \else
+        \edef\cb at temp{\noexpand\cb at pdffind{##1}{##2}\cb at pdfpoints\relax{}}%
+        \cb at temp
+      \fi
+    \fi
+  }
+  \def\cb at pdffind##1##2##3.##4p##5,##6,##7pt##8\relax##9{%
+    \def\cb at next{\cb at pdffind{##1}{##2}##8\relax{##9##3.##4p##5,##6,##7pt}}%
+    \ifnum ##1=##3
+      \ifnum ##2=##4
+        \def\cb at pdfx{##5sp}%
+        \def\cb at pdfy{##6sp}%
+        \def\cb at pdfz{##7pt}%
+        \let\cb at next\relax
+        \gdef\cb at pdfpoints{##9##8}%
+      \fi
+    \fi
+    \ifx\relax##8\relax
+      \let\cb at next\relax
+    \fi
+    \cb at next
+  }%
+  \def\cb at pdfreadxy##1{%
+    \let\cb at next\relax
+    \ifeof\cb at readxy
+      \global\let\cb at pdfpagenr\cb at maxpoint
+    \else
+      {\endlinechar=-1\read\cb at readxy to\cb at temp
+        \ifx\cb at temp\@empty\else
+          \expandafter\cb at pdfparsexy\cb at temp
+          \ifnum\cb at pdfpg<0\else
+            \xdef\cb at pdfpoints{\cb at pdfpoints\cb at temp}%
+            \cb at trace{PDFpoints=\cb at pdfpoints}%
+            \global\let\cb at pdfpagenr\cb at pdfpg
+          \fi
+          \ifnum\cb at pdfpg>##1\else
+            \global\def\cb at next{\cb at pdfreadxy{##1}}%
+          \fi
+        \fi
+      }%
+    \fi
+    \cb at next
+  }%
+  \def\cb at pdfparsexy##1.##2p##3,##4,##5pt{%
+    \def\cb at pdfpg{##2}}%
+  \def\cb at defpoint##1##2{%
+    \if at filesw
+      \begingroup
+        \edef\point{{\the##1}{\the\cb at pagecount}}%
+        \let\the=\z@
+        \pdfsavepos
+        \edef\cb at temp{\write\@auxout
+          {\string\cb at pdfxy\point
+            {\the\pdflastxpos}{\the\pdflastypos}{\the##2}}}%
+        \cb at temp
+      \endgroup
+    \fi
+    \cb at trace@defpoint##1##2%
+  }%
+  \def\cb at cvtpct##1{%
+    \ifnum##1<0 0\else
+    \ifnum##1>99 1\else
+    \ifnum##1<10 0.0\the##1\else
+    0.\the##1\fi\fi\fi}
+\def\cb at pdf@scale{0.996264009963}
+  \def\cb at connect##1##2##3{%
+    \cb at findpdfpoint{##1}\cb at pagecount
+    \ifx\cb at pdfx\relax\cb at rerun
+    \else
+      \let\cb at pdftopy\cb at pdfy
+      \cb at findpdfpoint{##2}\cb at pagecount
+      \ifx\cb at pdfx\relax\cb at rerun
+      \else
+         \begingroup
+           \cb at dima=\cb at pdfz
+           \advance\cb at dima by-\cb at pdfx
+           \advance\cb at dima by1in
+           \cb at dima=\cb at pdf@scale\cb at dima\relax
+           \ifx\cb at current@color\@undefined
+             \def\cb at temp{\cb at cvtpct\c at changebargrey}%
+             \pdfliteral{q \cb at temp\space g \cb at temp\space G}%
+           \else
+             \pdfliteral{q \expandafter\sec at nd@ftw@\cb at current@color\space RG
+                           \expandafter\sec at nd@ftw@\cb at current@color\space rg}%
+           \fi
+           \edef\cb at temp{\expandafter\cb at removedim\the\cb at dima\space}%
+           \cb at dima=\cb at pdftopy
+           \advance\cb at dima-\cb at pdfy\relax
+           \cb at dima=\cb at pdf@scale\cb at dima\relax
+           ##3=\cb at pdf@scale##3\relax
+           \pdfliteral{\expandafter\cb at removedim\the##3 w
+             \cb at temp 0 m
+             \cb at temp \expandafter\cb at removedim\the\cb at dima\space l S Q}%
+        \endgroup
+        \cb at cntb=##1\relax
+        \ifodd\cb at cntb\advance\cb at cntb 1\else\advance\cb at cntb -1\fi
+        \cb at findpdfpoint\cb at cntb\cb at pagecount
+        \cb at cntb=##2\relax
+        \ifodd\cb at cntb\advance\cb at cntb 1\else\advance\cb at cntb -1\fi
+        \cb at findpdfpoint\cb at cntb\cb at pagecount
+      \fi
+    \fi
+    \cb at trace@connect##1##2##3%
+  }%
+  \gdef\cb at checkPdfxy##1##2##3##4##5{%
+    \cb@@findpdfpoint{##1}{##2}%
+    \ifnum##3=\cb at pdfx\relax
+      \ifnum##4=\cb at pdfy\relax
+        \ifdim##5=\cb at pdfz\relax
+        \else
+        \cb at error
+        \fi
+      \else
+        \cb at error
+      \fi
+    \else
+      \cb at error
+    \fi
+  }
+  \def\cb at maxpoint{9999999}
+  \let\cb at resetpoints\relax
 \else
   \PackageWarning{Changebar}{changebars not supported in unknown setup}
   \def\cb at defpoint##1##2{\cb at trace@defpoint##1##2}
@@ -479,7 +643,7 @@
 \newlength{\deletebarwidth}
 \setlength{\deletebarwidth}{4pt}
 \newlength{\changebarsep}
-\setlength{\changebarsep}{30pt}
+\setlength{\changebarsep}{0.5\marginparsep}
 \newcounter{changebargrey}
 \setcounter{changebargrey}{65}
 \@ifpackagewith{changebar}{\csname cb at color@pkg\endcsname}{%
@@ -915,6 +1079,11 @@
   \fi
   \ltx at end@float}
 \let\end at float\cb at end@float
+\let\ltx@@xympar\@xympar
+\def\@xympar{%
+  \let\end at float\ltx at end@float
+  \ltx@@xympar
+  \let\end at float\cb at end@float}
 \let\flt at float@end\float at end
 \def\float at end{%
   \cb at trace@stack{end float on page \the\c at page}%



More information about the tex-live-commits mailing list