Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-release-src > by-pkgid > 3c83bbb1176e313dd084f0338245b0ec > files > 13

tetex-3.0-48mdv2009.1.src.rpm

diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/LICENSE tetex-src-2.0.1/xmltex/contrib/passivetex/LICENSE
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/LICENSE	1970-01-01 01:00:00.000000000 +0100
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/LICENSE	2002-02-08 00:00:00.000000000 +0100
@@ -0,0 +1,14 @@
+%
+% Copyright 2002 Sebastian Rahtz/Oxford University  
+%      <sebastian.rahtz@oucs.ox.ac.uk>
+%
+% Permission is hereby granted, free of charge, to any person obtaining
+% a copy of this software and any associated documentation files (the
+% ``Software''), to deal in the Software without restriction, including
+% without limitation the rights to use, copy, modify, merge, publish,
+% distribute, sublicense, and/or sell copies of the Software, and to
+% permit persons to whom the Software is furnished to do so, subject to
+% the following conditions:
+% 
+% The above copyright notice and this permission notice shall be included
+% in all copies or substantial portions of the Software.
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/README.passivetex tetex-src-2.0.1/xmltex/contrib/passivetex/README.passivetex
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/README.passivetex	1970-01-01 01:00:00.000000000 +0100
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/README.passivetex	2003-02-04 00:00:00.000000000 +0100
@@ -0,0 +1,35 @@
+PassiveTeX
+
+Sebastian Rahtz, February 2003
+
+The files in this directory provide an implementation of XSL
+formatting objects. If an XSLT processor is used to write out XSL
+objects in serialized XML format, the result can be formatted using
+xmltex.  In addition, an extended xmltex control file for TEI
+documents is provided.
+
+This package consists of the following files:
+
+The core xmltex `style' files for XSL FO XML:
+
+ fotex.xmt
+ fotex.sty
+
+In test/, a sample file containing TEI + MathML markup:
+
+ latextei.xml    (original)
+ latextei.fo 	(transformed to XSL FO)
+ latextei.pdf 	(transformed to XSL FO)
+
+Support for direct formatting of TEI XML with xmltex
+
+ tei.xmt        
+ latextei.tex    (wrapper for xmltex of sample file)
+
+Some support files, shared with Jadetex:
+
+ unicode.sty
+ ucharacters.sty
+ mlnames.sty 
+ dummyels.sty
+ nomulticol.sty
\ No newline at end of file
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/fotex.sty tetex-src-2.0.1/xmltex/contrib/passivetex/fotex.sty
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/fotex.sty	2002-06-27 10:18:00.000000000 +0200
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/fotex.sty	2003-02-14 00:00:00.000000000 +0100
@@ -1,6 +1,6 @@
-%RCS: $Id: //TEI/web/Software/passivetex/fotex.sty#29 $, $Date: 2002/06/26 $
+%RCS: $Id: //TEI/web/Software/passivetex/fotex.sty#40 $, $Date: 2003/02/13 $
 %
-% Copyright 2002 Sebastian Rahtz/Oxford University  
+% Copyright 2003 Sebastian Rahtz/Oxford University  
 %      <sebastian.rahtz@oucs.ox.ac.uk>
 %
 % Permission is hereby granted, free of charge, to any person obtaining
@@ -14,14 +14,41 @@
 % The above copyright notice and this permission notice shall be included
 % in all copies or substantial portions of the Software.
 %
-% Includes fixes from Tomas Bures <ghort@pauline.vellum.cz>
-%
-\ProvidesPackage{fotex}[2002/06/25: version 1.17. support for XSL formatting, S Rahtz]
+\batchmode
+\ProvidesPackage{fotex}[2003/02/13: version 1.23. support for XSL formatting, S Rahtz]
 \RequirePackage{graphicx}
-\IfFileExists{multicol.sty}
-  {\RequirePackage{multicol}[1997/12/16]}
-  {\newenvironment{multicols}[1]%
-  {\typeout{Warning,  at line \the\inputlineno, multicol package not available}}{}%
+%\IfFileExists{multicol.sty}
+%  {\RequirePackage{multicol}[1997/12/16]}
+%  {\newenvironment{multicols}[1]%
+%  {\typeout{Warning,  at line \the\inputlineno, multicol package not available}}{}%
+%}
+
+\def\confirmnomulticols{
+	\RequirePackage{nomulticol}[2003/01/09]
+	\typeout{INFO (nomulticol.sty:  fo:block span="all" works}
+}
+\def\warnnomulticols{
+	\RequirePackage{multicol}[1997/12/16]
+	\typeout{WARNING (multicol.sty:  fo:block span="all" does not work}
+	\fakenomulticols
+}
+\def\warnmulticols{
+	\typeout{WARNING (no multicol.sty:  multiple columns not available}
+	\newenvironment{multicols}[1]{\typeout{Warning,  at line \the\inputlineno, multicol package not available}}{}
+	\fakenomulticols
+}
+\def\fakenomulticols{
+	\def\nobeginmulticols##1{\begin{multicols}{##1}}
+   	\def\noendmulticols{\end{multicols}}
+	\def\interbeginmulticols##1{}
+	\let\interendmulticols\relax
+	\let\refreshmulticols\relax
+}
+\IfFileExists{nomulticol.sty}
+{\confirmnomulticols}
+{\IfFileExists{multicol.sty}
+	{\warnnomulticols}
+	{\warnmulticols}
 }
 \RequirePackage{rotating}
 \RequirePackage{array}
@@ -30,6 +57,7 @@
 \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
 \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
 \newcolumntype{P}[1]{>{\arraybackslash}p{#1}}
+\RequirePackage{soul}
 \RequirePackage{amsmath}
 \let\Vec\undefined
 \RequirePackage{longtable}
@@ -46,11 +74,14 @@
 \RequirePackage[colorlinks=false,plainpages=true,hypertexnames=false,pdfborder={1 0 0}]{hyperref}[1999/08/1]
 %-------------------------------------------
 \newcount\FOListBlocks
+\edef\This@FOListBlocks{\the\FOListBlocks}
 \newcount\FOTableNesting
 \newcount\FOinList
 \newcount\FOinTable
 \newcount\NCols
 \newcount\RowCount
+\newcount\SimplePMRefs
+\newskip\LeaderLength
 \newdimen\CurrentCellWidth
 \newdimen\FObalancespace
 \newdimen\FOspaceleft
@@ -77,13 +108,17 @@
 \newif\ifMulticolPending
 \newif\ifNoTableCheckHeight
 \newif\ifStartWithOmit
+\newif\ifForcePageSetup
+\newif\ifBlankPage
+\newif\ifInInsertion
 \newsavebox\BlockBox
 \newsavebox\CellBox
 \newsavebox\FOBOX
 \newsavebox\ItemBox
 \newtoks\ColSpecs
+\newtoks\BoxedFootnotes
 %
-\FODebugfalse
+%\FODebugtrue
 \FOBlockGrabfalse
 \FODefiningPagefalse
 \FOListBodyfalse
@@ -99,6 +134,10 @@
 \MasterTopMargin\z@
 \MulticolPendingfalse
 \StartWithOmitfalse
+% smarts from Anton to deal with long lines in verbatim
+\gdef\FOdiscretionary{\ifx\FOwrapoption\att@nowrap\discretionary{\kern-.5ex\lower1ex\hbox{$\hookleftarrow$}}{}{\kern1ex}\else\space\fi}
+\def\obeyspaces{\catcode`\ =\active}
+{\obeyspaces\global\let =\FOdiscretionary}
 \def\DEBUG#1{%
  \ifFODebug
    \typeout{#1, at \the\inputlineno}%
@@ -257,33 +296,95 @@
 \def\NoTableSetup{%
   \global\advance\AbsoluteTableCount by 1
   \DeclareArray{fotable\the\AbsoluteTableCount:}%
+  \DeclareArray{fotabletextalign\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderbeforestyle\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderafterstyle\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderstartstyle\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderendstyle\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderbeforewidth\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderafterwidth\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderstartwidth\the\AbsoluteTableCount:}%
+  \DeclareArray{fotableborderendwidth\the\AbsoluteTableCount:}%
   \global\CellCount0
+\ifnum\FOinTable=0
+  \global\BoxedFootnotes{}%
+  \global\let\FOfoottext\FOboxedfoottext
+\fi
+}
+
+\def\NoTableFinish{
+\ifnum\FOinTable=0
+   \the\BoxedFootnotes
+   \global\BoxedFootnotes={}%
+   \global\let\FOfoottext\FOplainfoottext
+\fi
+}
+
+\def\saveinterlineskip{%
+	\edef\savedbaselineskip{\the\baselineskip}%
+	\edef\savedlineskip{\the\lineskip}%
+	\edef\savedlineskiplimit{\the\lineskiplimit}%
+	\baselineskip=-1000pt\relax
+	\lineskiplimit=16383pt\relax
+	\lineskip=0pt
+}
+
+\def\restoreinterlineskip{%
+	\baselineskip\savedbaselineskip\relax
+	\lineskip\savedlineskip\relax
+	\lineskiplimit\savedlineskiplimit\relax
 }
 
 \def\NoTableStart#1{#1}
 
-\def\NoTableEnd{\clearArray{fotable\the\AbsoluteTableCount:}}
+\def\NoTableEnd{%
+	\clearArray{fotable\the\AbsoluteTableCount:}%
+  	\clearArray{fotabletextalign\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderbeforestyle\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderafterstyle\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderstartstyle\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderendstyle\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderbeforewidth\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderafterwidth\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderstartwidth\the\AbsoluteTableCount:}%
+  	\clearArray{fotableborderendwidth\the\AbsoluteTableCount:}%
+}
 
 \def\NoTableColumn{%
-   \ifx\@empty\FOcolumnnumber
-    \global\advance\NCols by 1
-   \else
-    \global\NCols\FOcolumnnumber
-   \fi
-   \ifx\prop@width\FOcolumnwidth\def\FOcolumnwidth{1in}\fi
-   \ifx\@empty\FOcolumnwidth\def\FOcolumnwidth{1in}\fi
-   \TablePercentToDimen{\FOcolumnwidth}%
-   \addToArray{fotable\the\AbsoluteTableCount:}{\the\@tempdima}%
-   \DEBUG{Table Column \the\NCols, in Table \the\AbsoluteTableCount, 
-     \FOcolumnwidth, = \the\@tempdima}%
+   	\ifx\@empty\FOcolumnnumber
+   	 	\global\advance\NCols by 1
+   	\else
+   	 	\global\NCols\FOcolumnnumber
+   	\fi
+   	\ifx\prop@width\FOcolumnwidth\def\FOcolumnwidth{1in}\fi
+   	\ifx\@empty\FOcolumnwidth\def\FOcolumnwidth{1in}\fi
+   	\TablePercentToDimen{\FOcolumnwidth}%
+   	\addToArray{fotable\the\AbsoluteTableCount:}{\the\@tempdima}%
+   	\addToArray{fotabletextalign\the\AbsoluteTableCount:}{\FOtextalign}%
+  	\addToArray{fotableborderbeforestyle\the\AbsoluteTableCount:}{\FOborderbeforestyle}%
+  	\addToArray{fotableborderafterstyle\the\AbsoluteTableCount:}{\FOborderafterstyle}%
+  	\addToArray{fotableborderstartstyle\the\AbsoluteTableCount:}{\FOborderstartstyle}%
+  	\addToArray{fotableborderendstyle\the\AbsoluteTableCount:}{\FOborderendstyle}%
+  	\addToArray{fotableborderbeforewidth\the\AbsoluteTableCount:}{\FOborderbeforewidth}%
+  	\addToArray{fotableborderafterwidth\the\AbsoluteTableCount:}{\FOborderafterwidth}%
+  	\addToArray{fotableborderstartwidth\the\AbsoluteTableCount:}{\FOborderstartwidth}%
+  	\addToArray{fotableborderendwidth\the\AbsoluteTableCount:}{\FOborderendwidth}%
+   	\DEBUG{Table Column \the\NCols, in Table \the\AbsoluteTableCount, 
+     	\FOcolumnwidth, = \the\@tempdima}%
 }
 \def\NoTableRow#1{%
- \setbox0=\vbox{\strut They}%
+ \setbox0=\vbox{
+  \ifx\FOheight\att@auto%
+    \strut They
+  \else
+    \rule{\z@}{\FOheight}%
+  \fi
+  }%
  \NoTableCellHeight=\ht0
  \advance\NoTableCellHeight by \dp0
  \global\CellCount0
  \NoTableCheckHeightfalse
- \setbox0=\hbox{#1}%
+ \setbox0=\vbox{\hbox{\let\FOfoottext\FOnofoottext#1}}%
  \@tempdima=\ht0
  \advance\@tempdima by \dp0
  \FOspaceleft=\pagegoal
@@ -295,31 +396,38 @@
  \fi
  \ifdim\@tempdima>\NoTableCellHeight
 %\typeout{row pass 2 at \the\inputlineno, as [\the\@tempdima] > [\the\NoTableCellHeight]}%
-   \global\CellCount0
    \NoTableCellHeight=\@tempdima
-   \NoTableCheckHeighttrue
-   \vbox{\hbox{#1}}%
- \else
-   \box0\relax
  \fi
- \vskip-\lineskip
+ \global\CellCount0
+ \NoTableCheckHeighttrue
+ \vbox to \NoTableCellHeight{\hbox{#1}}%
+% \ifFOinOutput\else\vskip-\lineskip\fi
 }
 
 \def\NoTableCell#1{%
  \ifx\FOstartsrow\att@true
-    \vskip-\lineskip
+%    \vskip-\lineskip
     \global\CellCount1
  \else
     \global\advance\CellCount by 1
  \fi
  \ifnum\NCols<1
   \CurrentCellWidth\z@
-  \setbox0=\hbox{#1}%
+  \setbox0=\hbox{\restoreinterlineskip#1\strut}%
   \CurrentCellWidth=\wd0
-\DEBUG{report \the\CurrentCellWidth}%
+%\DEBUG{report \the\CurrentCellWidth}%
  \else
   \CurrentCellWidth=\csname fotable\the\AbsoluteTableCount:\the\CellCount\endcsname
- \fi
+  \edef\FOtextalign{\csname fotabletextalign\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderbeforestyle{\csname fotableborderbeforestyle\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderafterstyle{\csname fotableborderafterstyle\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderstartstyle{\csname fotableborderstartstyle\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderendstyle{\csname fotableborderendstyle\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderbeforewidth{\csname fotableborderbeforewidth\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderafterwidth{\csname fotableborderafterwidth\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderstartwidth{\csname fotableborderstartwidth\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+% \edef\FOborderendwidth{\csname fotableborderendwidth\the\AbsoluteTableCount:\the\CellCount\endcsname}%
+\fi
  \advance\CurrentCellWidth by -\FOpaddingstart
  \advance\CurrentCellWidth by -\FOpaddingend
  \ifx\FOborderstartstyle\att@solid\advance\CurrentCellWidth by -\FOborderstartwidth\fi
@@ -341,7 +449,7 @@
    \leavevmode\hbox{\FOTableCellBlock#1\FOEndTableCellBlock}%
  \fi
  \ifx\FOendsrow\att@true
-    \vskip-\lineskip
+%    \vskip-\lineskip
     \global\CellCount0
  \fi
 }
@@ -350,17 +458,18 @@
  \begin{lrbox}{\CellBox}%
  \vbox\bgroup
  \hsize\the\CurrentCellWidth
- \color@begingroup
+ \restoreinterlineskip
+ \ifFOinOutput\else \color@begingroup\fi
  \FOSetFont{tablecellblock}%
  \ifx\FOwhitespace\att@pre\obeyspaces\obeylines\fi
  \ifx\FOwhitespacecollapse\att@false\obeyspaces\fi
  \ifx\FOwrapoption\att@nowrap\obeylines\fi
- \ifx\TOverticalalign\att@bottom\vfill\fi
+ \ifx\FOverticalalign\att@bottom\vfill\fi
  }
 
 \def\FOEndTableCellBlock{%
- \ifx\TOverticalalign\att@top\vfill\fi
- \color@endgroup
+ \ifx\FOverticalalign\att@top\vfill\fi
+ \ifFOinOutput\else \color@endgroup\fi
  \egroup
  \end{lrbox}%
  \@tempdima\FOmargintop
@@ -376,7 +485,7 @@
      \hbox{%
       \hskip\FOmarginleft
       \vbox{%
-        \vskip\FOmargintop
+        \kern\FOmargintop
         \vbox{%
         \ifx\FOborderbeforestyle\att@solid
            {\color{\FOborderbeforecolor}\hrule\@height\FOborderbeforewidth}%
@@ -393,29 +502,29 @@
 % According to FOdisplayalign property, we put glue 
 % before and/or after the cell contents
              \vtop to \NoTableCellHeight{%
-               \vskip\FOpaddingbefore
+               \kern\FOpaddingbefore
                \ifx\FOdisplayalign\att@auto
-                 \else\ifx\FOdisplayalign\att@after
-                   \else\ifx\FOdisplayalign\att@before\vfil
+                 \else\ifx\FOdisplayalign\att@before
+                   \else\ifx\FOdisplayalign\att@after\vfil
                      \else\ifx\FOdisplayalign\att@centered\vfil\fi
                    \fi
                  \fi
                \fi
                \hbox{\kern\FOpaddingstart\box\CellBox\kern\FOpaddingend}%
                \ifx\FOdisplayalign\att@auto\vfil
-                 \else\ifx\FOdisplayalign\att@after\vfil
-                   \else\ifx\FOdisplayalign\att@before
+                 \else\ifx\FOdisplayalign\att@before\vfil
+                   \else\ifx\FOdisplayalign\att@after
                      \else\ifx\FOdisplayalign\att@centered\vfil\fi
                    \fi
                  \fi
                \fi
-               \vskip\FOpaddingafter
+               \kern\FOpaddingafter
              }%
            \else
             \vbox{%
-              \vskip\FOpaddingbefore
+              \kern\FOpaddingbefore
                 \hbox{\kern\FOpaddingstart\box\CellBox\kern\FOpaddingend}%
-              \vskip\FOpaddingafter
+              \kern\FOpaddingafter
               }%
            \fi
           \ifx\FOborderendstyle\att@solid
@@ -425,7 +534,7 @@
         \ifx\FOborderafterstyle\att@solid
            {\color{\FOborderaftercolor}\hrule\@height\FOborderafterwidth}\fi
         }%
-        \vskip\FOmarginbottom
+        \kern\FOmarginbottom
      }%
      \hskip\FOmarginright
     }%
@@ -433,18 +542,22 @@
 }
 
 \def\FOBoxedBlock#1{%
- \ifdim\@tempdimb=\z@
-    \setbox0=\hbox{#1}\@tempdimb\wd0
+% Dirk Roorda: I cannot perceive what should be going on here.
+% But \hbox{#1} cannot be right, since #1 is a length or even a dimen.
+% In the latter case this leads to a TeX error!
+% So I have commented out the then-branch.
+% \ifdim\@tempdimb=\z@
+%    \setbox0=\hbox{#1}\@tempdimb\wd0\relax
 %\typeout{report \the\CurrentCellWidth}%
- \else
-    \@tempdimb#1%
- \fi
- \advance\@tempdimb by -\FOpaddingstart
- \advance\@tempdimb by -\FOpaddingend
- \ifx\FOborderstartstyle\att@solid\advance\@tempdimb by -\FOborderstartwidth\fi
- \ifx\FOborderendstyle\att@solid\advance\@tempdimb by -\FOborderendwidth\fi
- \advance\@tempdimb by -\FOmarginright
- \advance\@tempdimb by -\FOmarginleft
+% \else
+    \@tempdimb#1\relax%
+% \fi
+ \advance\@tempdimb by -\FOpaddingstart\relax
+ \advance\@tempdimb by -\FOpaddingend\relax
+ \ifx\FOborderstartstyle\att@solid\advance\@tempdimb by -\FOborderstartwidth\relax\fi
+ \ifx\FOborderendstyle\att@solid\advance\@tempdimb by -\FOborderendwidth\relax\fi
+ \advance\@tempdimb by -\FOmarginright\relax
+ \advance\@tempdimb by -\FOmarginleft\relax
  \begin{lrbox}{\BlockBox}%
  \vbox\bgroup
  \hsize\the\@tempdimb
@@ -459,7 +572,6 @@
  }
 
 \def\FOEndBoxedBlock{%
- \par
  \color@endgroup
  \egroup
  \end{lrbox}%
@@ -478,7 +590,7 @@
      \hbox{%
       \kern\FOtempdim
       \vbox{%
-        \vskip\FOmargintop
+        \kern\FOmargintop
         \vbox{%
         \ifx\FOborderbeforestyle\att@solid
            {\color{\FOborderbeforecolor}\hrule\@height\FOborderbeforewidth}%
@@ -491,9 +603,9 @@
            {\color{\FObackgroundcolor}\vrule\@width\@tempdimc\kern-\@tempdimc}%
           \fi
             \vbox{%
-              \vskip\FOpaddingbefore
+              \kern\FOpaddingbefore
                \hbox{\kern\FOpaddingstart\box\BlockBox\kern\FOpaddingend}%
-              \vskip\FOpaddingafter
+              \kern\FOpaddingafter
               }%
           \ifx\FOborderendstyle\att@solid
            {\color{\FOborderendcolor}\vrule\@width\FOborderendwidth}\fi
@@ -501,7 +613,7 @@
         \ifx\FOborderafterstyle\att@solid
            {\color{\FOborderaftercolor}\hrule\@height\FOborderafterwidth}\fi
         }%
-        \vskip\FOmarginbottom
+        \kern\FOmarginbottom
      }%
      \kern\FOmarginright
     }%
@@ -548,6 +660,7 @@
  \xdef\FOsrcname{#1}%
 }
 \def\NColumns{1}
+\gdef\PrevNColumns{1}
 \def\Pass#1\\{\expandafter\@Pass#1}
 \def\@Pass#1|#2|#3|#4|{%
  \columnsep=#1
@@ -585,32 +698,42 @@
       \xdef\FOsrcname{#1#2#3#4#5#6#7#8}%
    \fi
   \fi}
-{\catcode`\%=13
+
+
+{\catcode`\%=12\relax
+\gdef\percentother{%}
+}
+{\catcode`\%=13\relax
+\gdef\defpercentother{\xdef%{\percentother}}
+}
+{\catcode`\%=12\relax
 \gdef\percenttest#1%#2#3\@{\ifx#2\relax\def\percentval{#1}\expandafter\@firstoftwo
   \else
     \expandafter\@secondoftwo
   \fi}
-\gdef\TablePercentToDimen#1{\expandafter\percenttest#1\relax%.\@
-  {\@tempdimb\percentval pt\relax\divide\@tempdimb by 100
+\gdef\performpercent#1{\defpercentother\edef\dopercent{\noexpand\percenttest#1\relax%.\noexpand\@}\dopercent}
+
+\gdef\TablePercentToDimen#1{\performpercent{#1}
+	{\@tempdimb\percentval pt\relax\divide\@tempdimb by 100
    \edef\SCALE{\strip@pt\@tempdimb}\global\@tempdima=\SCALE\TableWidth}{\global\@tempdima#1}
 }
-\gdef\PercentToDimen#1{\expandafter\percenttest#1\relax%.\@
+\gdef\PercentToDimen#1{\performpercent{#1}
   {\@tempdimb\percentval pt\relax\divide\@tempdimb by 100
    \edef\SCALE{\strip@pt\@tempdimb}\global\@tempdima=\SCALE\hsize}{\global\@tempdima#1}
 }
-\gdef\FOSetGWidth{\expandafter\percenttest\FOcontentwidth\relax%.\@
+\gdef\FOSetGWidth{\performpercent{\FOcontentwidth}
   {\@tempdima\percentval pt\relax\divide\@tempdima by 100
   \edef\WSCALE{\strip@pt\@tempdima}\setkeys{Gin}{width=\WSCALE\Gin@nat@width}}{\setkeys{Gin}{width=\FOcontentwidth}}}
 
-\gdef\FOSetGHeight{\expandafter\percenttest\FOcontentheight\relax%.\@
+\gdef\FOSetGHeight{\performpercent{\FOcontentheight}
   {\@tempdima\percentval pt\relax\divide\@tempdima by 100 
   \edef\HSCALE{\strip@pt\@tempdima}\setkeys{Gin}{height=\HSCALE\Gin@nat@height}}{\setkeys{Gin}{height=\FOcontentheight}}}
 
 \gdef\PlayWithFSize#1{\@default\f@size pt
-  \expandafter\percenttest#1\relax%.\@
+  \performpercent{#1}
       {\dimen@0.01\@default
      \multiply\dimen@\percentval\relax}{\dimen@#1}\edef\FOfontsizefinal{\the\dimen@}}
-\gdef\PlayWithShift{\expandafter\percenttest\FOverticalalign\relax%.\@
+\gdef\PlayWithShift{performpercent{\FOverticalalign}
       {\dimen@0.01\baselineskip\multiply\dimen@\percentval\relax}{\dimen@\FOverticalalign}}
 }
 \def\strip@pt@and@otherjunk#1{\expandafter\rem@ptetc\the#1!} 
@@ -633,15 +756,19 @@
 }
 \catcode`\/=12
 %
+\def\nocontentbox{\vbox to \z@{}}
+
 \def\BlankPage{%
- \def\@thehead{\csname\FirstHead\endcsname}%
- \def\@thefoot{\csname\FirstTail\endcsname}%
- \let\@themargin\oddsidemargin
- \def\headheight{\FirstHeadExtent}%
- \def\tailheight{\FirstTailExtent}%
- \mark{}%
  \DEBUG{Blank Page \the\c@page}%
- \hbox{}
+% \def\@thehead{\csname\FirstHead\endcsname}%
+% \def\@thefoot{\csname\FirstTail\endcsname}%
+% \let\@themargin\oddsidemargin
+% \def\headheight{\FirstHeadExtent}%
+% \def\tailheight{\FirstTailExtent}%
+% \mark{}%
+ \global\BlankPagetrue
+ \nocontentbox
+ \newpage
 }
 %-----------------------------------------------
 % longtable
@@ -714,10 +841,12 @@
    \endgroup
 }
 
+\def\oline#1{$\overline{\mbox{#1}}$}
 \def\TableHeader{}
 \def\DECO@{\@firstofone}
 \def\DECO@blink{\uwave}
 \def\DECO@underline{\uline}
+\def\DECO@overline{\oline}
 \expandafter\def\csname DECO@line-through\endcsname{\sout}
 \def\QuaddingStart{%
  \ifx\FOtextalignlast\att@relative
@@ -741,20 +870,19 @@
  \fi
 }%
 % page number compression (by David Carlisle)
-
-\def\fopagecitation{\pageref{\FOrefid}}
+\def\fopagecitation{\csname r@\FOrefid\endcsname}
 %was \hyperlink{\FOrefid}{\pageref{\FOrefid}}}
 \newcount\sortcount
 \newtoks\sorttoks
 \def\fosortpagecitation{%
    \setbox0\hbox{\global\sortcount=0\expandafter\expandafter\expandafter
    \@secondoffive\csname r@\FOrefid\endcsname
-      \relax\relax\relax\relax\relax}
+      \relax\relax\relax\relax\relax}%
     \let\@elt\fosort@elt
     \global\sorttoks\expandafter{\expandafter}\the\sorttoks
     \ifnum\sortcount<\maxdimen
    \global\sorttoks\expandafter{%
-       \the\expandafter\sorttoks\expandafter\@elt\expandafter{\the\sortcount}}
+       \the\expandafter\sorttoks\expandafter\@elt\expandafter{\the\sortcount}}%
   \fi
     }
 
@@ -771,18 +899,19 @@
 }
 
 \gdef\focompress@elt#1{%
- \global\advance\sortcount\@ne
- \ifnum#1=\sortcount
-   \ifx\foheld\relax
-      \edef\foheld{#1}%
-    \else
-       \def\foheld{\textendash#1}%
-   \fi
-  \else
-   \foheld\fosep#1   
- \fi
- \global\sortcount#1
- \def\fosep{, }%
+	\global\advance\sortcount\@ne
+	\ifnum#1=\sortcount\relax
+		\edef\foheld{#1}%
+  	\else
+		\ifx\foheld\relax
+		\else
+			\FOrangechar
+		\fi
+   		\foheld\fosep#1\relax   
+		\let\foheld\relax
+ 	\fi
+ 	\global\sortcount#1\relax
+ 	\def\fosep{, }%
 } 
 
 % headers
@@ -843,6 +972,32 @@
 
 \def\FOgeneratePage#1#2\@null{\csname Format-#1\endcsname{\c@page}#2}
 
+\def\endtrivlist{%
+  \if@inlabel
+    \leavevmode
+    \global \@inlabelfalse
+  \fi
+  \if@newlist
+    \@noitemerr
+    \global \@newlistfalse
+  \fi
+  \ifhmode\unskip \par\fi
+  \if@noparlist \else
+  \ifInInsertion\else
+    \ifdim\lastskip >\z@
+      \@tempskipa\lastskip \vskip -\lastskip
+      \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
+      \vskip\@tempskipa
+    \fi
+  \fi
+    \@endparenv
+  \fi
+}
+
+\def\@endparenv{%
+  \ifInInsertion\else\addpenalty\@endparpenalty\addvspace\@topsepadd\@endpetrue\fi
+}
+
 \def\@item[#1]{%
   \if@noparitem
     \@donoparitem
@@ -853,19 +1008,22 @@
     \ifhmode
       \unskip\unskip \par
     \fi
-    \if@newlist
+	\ifInInsertion
+	\else
+    	\if@newlist
 % removed this test 2000/11/05. always put in topsep.
-%      \if@nobreak
-%        \@nbitem
-%      \else
-        \addpenalty\@beginparpenalty
-        \addvspace\@topsep
-        \addvspace{-\parskip}%
-%      \fi
-    \else
-      \addpenalty\@itempenalty
-      \addvspace\itemsep
-    \fi
+%      		\if@nobreak
+%      		  	\@nbitem
+%      		\else
+       	 		\addpenalty\@beginparpenalty
+        		\addvspace\@topsep
+        		\addvspace{-\parskip}%
+%      		\fi
+    	\else
+      		\addpenalty\@itempenalty
+      		\addvspace\itemsep
+    	\fi
+	\fi
     \global\@inlabeltrue
   \fi
   \global\everypar{%
@@ -877,7 +1035,7 @@
        \ifvoid\z@
          \kern-\itemindent
        \fi}%
-      \box\@labels
+      \box\@labels\FOlabel
       \penalty\z@
     \fi
     \if@nobreak
@@ -886,7 +1044,8 @@
     \else
       \clubpenalty \@clubpenalty
       \global\everypar{}%
-    \fi}%
+    \fi
+  }%
   \if@noitemarg
     \@noitemargfalse
     \if@nmbrlist
@@ -948,59 +1107,82 @@
 }
 
 
+%\tracingpages3\relax
 % vertical spacing
 \newskip\FOafterskip
 \def\FOvspaceafter{%
-\ifFOinOutput
-\else
-  \ifnum\FOTableNesting>0
-  \else
-    \ifx\@empty\FOspaceafter
-      \@tempdima\FOspaceafteroptimum
-      \advance\@tempdima by -\FOspaceafterminimum
-      \@tempdimb\FOspaceafteroptimum
-      \advance\@tempdimb by \FOspaceaftermaximum
-      \FOafterskip\FOspaceafteroptimum plus \@tempdimb minus \@tempdima
-    \else
-      \FOafterskip\FOspaceafter
-    \fi
-   \@tempswafalse
-   \ifx\FOkeepwithnext\att@always\@tempswatrue\fi
-   \ifx\FOkeepwithnextColumn\att@always\@tempswatrue\fi
-   \ifx\FOkeepwithnextPage\att@always\@tempswatrue\fi
-   \if@tempswa\addpenalty{\@M}\fi
-   \addvspace\FOafterskip
-  \fi
-\fi
+	\ifFOinOutput
+	\else
+		\ifnum\FOTableNesting>0
+		\else
+			\ifx\@empty\FOspaceafter
+				\@tempdima\FOspaceafteroptimum
+				\advance\@tempdima by -\FOspaceafterminimum
+				\@tempdimb\FOspaceafteroptimum
+				\advance\@tempdimb by \FOspaceaftermaximum
+				\FOafterskip\FOspaceafteroptimum plus \@tempdimb minus \@tempdima
+			\else
+				\FOafterskip\FOspaceafter
+			\fi
+			\@tempswafalse
+			\ifx\FOkeepwithnext\att@always\@tempswatrue\fi
+			\ifx\FOkeepwithnextColumn\att@always\@tempswatrue\fi
+			\ifx\FOkeepwithnextPage\att@always\@tempswatrue\fi
+			\addvspace\FOafterskip
+			\if@tempswa\addpenalty{9996}\fi
+		\fi
+	\fi
 }
 
+\@secpenalty = -300
 \def\FOvspacebefore{%
-\ifFOinOutput
-\else
-    \ifx\@empty\FOspacebefore
-      \@tempdima\FOspacebeforeoptimum
-      \advance\@tempdima by -\FOspacebeforeminimum
-      \@tempdimb\FOspacebeforeoptimum
-      \advance\@tempdimb by \FOspacebeforemaximum
-      \@tempskipa\FOspacebeforeoptimum plus \@tempdimb minus \@tempdima
-    \else
-      \@tempskipa\FOspacebefore
-    \fi
-%\typeout{SPACE BEFORE \the\inputlineno: \the\@tempskipa, \FOspacebeforeminimum/\FOspacebeforemaximum/\FOspacebeforeoptimum}%
- \ifnum\FOTableNesting>0
-   \rule{\z@}{\@tempskipa}%
- \else
-   \@tempswafalse
-   \ifx\FOkeepwithnext\att@always\@tempswatrue\fi
-   \ifx\FOkeepwithnextColumn\att@always\@tempswatrue\fi
-   \ifx\FOkeepwithnextPage\att@always\@tempswatrue\fi
-   \if@tempswa\addpenalty\@secpenalty\fi
-   \addvspace\@tempskipa
- \fi
-\fi
-\def\FOspacebefore{\z@}%
+	\ifFOinOutput
+	\else
+		\ifx\@empty\FOspacebefore
+			\@tempdima\FOspacebeforeoptimum
+			\advance\@tempdima by -\FOspacebeforeminimum
+			\@tempdimb\FOspacebeforeoptimum
+			\advance\@tempdimb by \FOspacebeforemaximum
+			\@tempskipa\FOspacebeforeoptimum plus \@tempdimb minus \@tempdima
+		\else
+			\@tempskipa\FOspacebefore
+		\fi
+	%\typeout{SPACE BEFORE \the\inputlineno: \the\@tempskipa, \FOspacebeforeminimum/\FOspacebeforemaximum/\FOspacebeforeoptimum}%
+		\ifnum\FOTableNesting>0
+			\rule{\z@}{\@tempskipa}%
+		\else
+			\@tempswafalse
+			\ifx\FOkeepwithnext\att@always\@tempswatrue\fi
+			\ifx\FOkeepwithnextColumn\att@always\@tempswatrue\fi
+			\ifx\FOkeepwithnextPage\att@always\@tempswatrue\fi
+			\@tempskipb\f@baselineskip\relax\@tempskipb3\@tempskipb\relax
+			\ifx\@empty\FOspacebefore\else\if@tempswa\vskip0pt plus \@tempskipb\addpenalty\@secpenalty\vskip-\lastskip\fi\fi
+			\addvspace\@tempskipa
+		\fi
+	\fi
+	\def\FOspacebefore{\z@}%
+}
+
+\def\addpenalty#1{%
+  	\ifvmode
+    	\if@minipage
+    	\else
+      		\if@nobreak
+      		\else
+        		\ifdim\lastskip=\z@
+          			\penalty#1\relax
+        		\else
+          			\@tempskipb\lastskip
+          			\vskip -\lastskip
+          			\penalty#1%
+          			\vskip\@tempskipb
+        		\fi
+      		\fi
+    	\fi
+  	\else
+   		\@noitemerr
+  	\fi
 }
-
 % lets do some setup
 % setup
 \paperwidth211mm
@@ -1019,8 +1201,8 @@
 \relpenalty=500
 \tolerance=1000
 \vbadness=3000
-\widowpenalty=8000
-\clubpenalty=8000
+\widowpenalty=0
+\clubpenalty=0
 \@twosidetrue
 \fboxsep0pt
 \setcounter{topnumber}{5}
@@ -1049,82 +1231,108 @@
 %\catcode`\^^M\active\gdef\@resetactivechars{\def^^M{x}}\endgroup
 
 \def\@outputpage{%
-\begingroup           % the \endgroup is put in by \aftergroup
-  \let \protect \noexpand
+	\begingroup           % the \endgroup is put in by \aftergroup
+  	\let\protect\noexpand
 %  \@resetactivechars
-  \@parboxrestore
-  \shipout \vbox{%
-    \set@typeset@protect
-    \aftergroup \endgroup
-    \aftergroup \set@typeset@protect
+  	\@parboxrestore
+  	\shipout\vbox{%
+    	\set@typeset@protect
+    	\aftergroup\endgroup
+    	\aftergroup\set@typeset@protect
                                 % correct? or just restore by ending
                                 % the group?
- \if@specialpage
-    \global\@specialpagefalse
-    \def\@thehead{\csname\FirstHead\endcsname}%
-    \def\@thefoot{\csname\FirstTail\endcsname}%
-    \let\@themargin\oddsidemargin
-    \def\headheight{\FirstHeadExtent}%
-    \def\tailheight{\FirstTailExtent}%
- \else
-      \ifodd\count\z@ 
-         \def\@thehead{\csname\OddHead\endcsname}%
-         \def\@thefoot{\csname\OddTail\endcsname}%
-         \let\@themargin\oddsidemargin
-         \def\headheight{\OddHeadExtent}%
-         \def\tailheight{\OddTailExtent}%
-      \else 
-         \def\@thehead{\csname\EvenHead\endcsname}%
-         \def\@thefoot{\csname\EvenTail\endcsname}%
-         \let\@themargin\evensidemargin
-         \def\headheight{\EvenHeadExtent}%
-         \def\tailheight{\EvenTailExtent}%
-      \fi
- \fi
- \@tempdima\textwidth
- \advance\@tempdima by -\FOheadindent
-  \reset@font
-  \normalsize
-  \normalsfcodes
-  \let\label\@gobble
-  \let\index\@gobble
-  \let\glossary\@gobble
-  \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
-   \@begindvi
-    \vskip \topmargin
-    \moveright\@themargin \vbox {%
-      \setbox\@tempboxa \vbox to\headheight{%
-        \color@hbox
-          \normalcolor
-        \hb@xt@\textwidth{\hfill\llap{\hb@xt@\@tempdima{\@thehead}}}%
-        \color@endbox
-        \vfil
-        }%
-      \dp\@tempboxa \z@
-      \box\@tempboxa
-      \vskip \headsep
-      \box\@outputbox
-      \baselineskip \footskip
-      \vskip \bottommargin
- \@tempdima\textwidth
- \advance\@tempdima by -\FOheadindent
-      \setbox\@tempboxa \vbox to\tailheight{%
-        \color@hbox
-          \normalcolor
-         \hb@xt@\textwidth{\hfill\llap{\hb@xt@\@tempdima{\@thefoot}}}%
-        \color@endbox
-        \vfil
-        }%
-      \dp\@tempboxa \z@
-      \box\@tempboxa
-      }%
-    }%
-  \global \@colht \textheight
-  \stepcounter{page}%
-  \let\firstmark\botmark
+		\if@specialpage
+%	\typeout{PAGE=FIRST \the\c@page}%
+			\global\@specialpagefalse
+			\def\@thehead{\csname\FirstHead\endcsname}%
+			\def\@thefoot{\csname\FirstTail\endcsname}%
+			\let\@themargin\oddsidemargin
+			\def\headheight{\FirstHeadExtent}%
+			\def\tailheight{\FirstTailExtent}%
+		\else
+			\ifBlankPage
+%\typeout{PAGE=BLANK \the\c@page}%
+				\global\BlankPagefalse
+				\def\@thehead{\csname\BlankHead\endcsname}%
+				\def\@thefoot{\csname\BlankTail\endcsname}%
+				\let\@themargin\oddsidemargin
+				\def\headheight{\BlankHeadExtent}%
+				\def\tailheight{\BlankTailExtent}%
+			\else
+				\ifodd\count\z@ 
+%	\typeout{PAGE=ODD \the\c@page}%
+					\def\@thehead{\csname\OddHead\endcsname}%
+					\def\@thefoot{\csname\OddTail\endcsname}%
+					\let\@themargin\oddsidemargin
+					\def\headheight{\OddHeadExtent}%
+					\def\tailheight{\OddTailExtent}%
+				\else 
+%	\typeout{PAGE=EVEN \the\c@page}%
+					\def\@thehead{\csname\EvenHead\endcsname}%
+					\def\@thefoot{\csname\EvenTail\endcsname}%
+					\let\@themargin\evensidemargin
+					\def\headheight{\EvenHeadExtent}%
+					\def\tailheight{\EvenTailExtent}%
+				\fi
+			\fi
+		\fi
+ 		\@tempdima\textwidth
+ 		\advance\@tempdima by -\FOheadindent
+  		\reset@font
+  		\normalsize
+  		\normalsfcodes
+  		\let\label\@gobble
+  		\let\index\@gobble
+  		\let\glossary\@gobble
+  %\baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
+  		\offinterlineskip
+   		\@begindvi
+    	\vskip \topmargin
+    	\vskip -\InnerTopMargin
+    	\moveright\@themargin \vbox {%
+      		\setbox\@tempboxa \vbox to\z@{%
+        		\color@hbox
+          		\normalcolor
+        		\hb@xt@\textwidth{\hfill\llap{\hb@xt@\@tempdima{\@thehead}}}%
+        		\color@endbox
+        		\vss
+        	}%
+      		\dp\@tempboxa \z@
+      		\box\@tempboxa
+      		\vskip\headsep
+      		\vskip\InnerTopMargin
+      		\box\@outputbox
+      		\baselineskip\footskip
+      		\vskip\bottommargin
+      		\vskip-\tailheight
+ 			\@tempdima\textwidth
+ 			\advance\@tempdima by -\FOheadindent
+      		\setbox\@tempboxa \vbox to\tailheight{%
+        		\color@hbox
+          		\normalcolor
+         		\hb@xt@\textwidth{\hfill\llap{\hb@xt@\@tempdima{\@thefoot}}}%
+        		\color@endbox
+        		\vfil
+        	}%
+      		\dp\@tempboxa \z@
+      		\box\@tempboxa
+      	}%
+	}%
+  	\global \@colht \textheight
+  	\stepcounter{page}%
+  	\ifForcePageSetup
+  		\global\advance\SimplePMRefs1\relax
+  		\DEBUG{Start page \the\SimplePMRefs\space of page sequence, using layout \CurrentPageMaster, at page \the\c@page}%
+  		\setaccordingtomaster
+  		\ifnum\NColumns>1\relax
+			\refreshmulticols % this is defined in nomulticols.sty
+		\fi
+  	\else
+  		\DEBUG{Skipping page set up at page \the\c@page}%
+  	\fi
+  	\let\firstmark\botmark
 }
 
-%%%%
 \def\FO@character#1{%
 \ifx\FOverticalalign\att@baseline
   #1%
@@ -1142,21 +1350,26 @@
 \fi
 }
 \def\FO@inlinesequence#1{%
- \FOSetFont{normal}%
-\ifx\FOverticalalign\att@baseline
-  \csname DECO@\FOtextdecoration\endcsname{\FOlabel#1}%
-\else
- \ifx\FOverticalalign\att@super
-   \textsuperscript{\csname DECO@\FOtextdecoration\endcsname{\FOlabel#1}}%
- \else
-    \ifx\FOverticalalign\att@sub
-      \textsubscript{\csname DECO@\FOtextdecoration\endcsname{\FOlabel#1}}%
-    \else
-      \PlayWithShift
-      \raisebox{\dimen@}{\csname DECO@\FOtextdecoration\endcsname{\FOlabel#1}}%
-    \fi
- \fi
-\fi
+	\FOSetFont{normal}%
+	\ifx\FOletterspacing\att@normal
+		\def\pre@sequence{{#1}}%
+	\else
+		\def\pre@sequence{\@ifundefined{thisso}{\sodef\thisso{}{\FOletterspacing}{.4em}{.5em}}{}{\thisso{#1}}}%
+	\fi
+	\ifx\FOverticalalign\att@baseline
+  		\csname DECO@\FOtextdecoration\endcsname{\FOlabel\pre@sequence}%
+	\else
+ 		\ifx\FOverticalalign\att@super
+   			\textsuperscript{\csname DECO@\FOtextdecoration\endcsname{\FOlabel\pre@sequence}}%
+ 		\else
+    		\ifx\FOverticalalign\att@sub
+      			\textsubscript{\csname DECO@\FOtextdecoration\endcsname{\FOlabel\pre@sequence}}%
+    		\else
+      			\PlayWithShift
+      			\raisebox{\dimen@}{\csname DECO@\FOtextdecoration\endcsname{\FOlabel\pre@sequence}}%
+    		\fi
+ 		\fi
+	\fi
 }
 \def\FOboxedsequence#1{%
 \FOSetFont{normal}%
@@ -1200,6 +1413,117 @@
        \def\FOfontvariant{#4}%
        \def\FOfontweight{#5}%
        \def\FOfontstyle{#3}#8\global\FOinOutputfalse}}}%
+	\ifx\FOflowname\att@xsl@footnote@separator\relax
+		\xdef\footnoterulepre{Static:#9}%
+		\global\footnotesep\z@\relax
+		\setbox\@tempboxa\vbox{\csname\footnoterulepre\endcsname}%
+		\@tempdima=\z@\relax
+		\advance\@tempdima\ht\@tempboxa\relax
+		\advance\@tempdima\dp\@tempboxa\relax
+		\global\skip\footins\@tempdima\relax
+		\gdef\footnoterule{\vfill\vbox to\z@{\vss\csname\footnoterulepre\endcsname}}%
+	\fi
+}
+
+\def\setaccordingtomaster{%
+    \global\@specialpagetrue
+	\@ifundefined{Atomic:\CurrentPageMaster}
+	{
+  		\@ifundefined{Lead:\the\SimplePMRefs:\CurrentPageMaster}
+		{
+			\ifnum\SimplePMRefs>1\relax\global\@specialpagefalse\fi
+			\@ifundefined{First:\CurrentPageMaster}
+			{
+				\ifx\FOinitialpagenumber\att@auto
+					\ifodd\c@page
+						\DEBUG{Master \CurrentPageMaster: no first page, use odd page}
+						\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
+					\else
+						\DEBUG{Master \CurrentPageMaster: no first page, use even page}
+						\@ifundefined{Even:\CurrentPageMaster}
+						{\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
+						{\xdef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
+					\fi
+				\else
+					\ifx\FOinitialpagenumber\att@autoeven
+						\@ifundefined{Even:\CurrentPageMaster}
+						{\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
+						{\xdef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
+					\else
+						\ifx\FOinitialpagenumber\att@autoodd
+							\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
+						\else
+							\ifodd\FOinitialpagenumber
+								\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
+							\else
+								\@ifundefined{Even:\CurrentPageMaster}
+								{\xdef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
+								{\xdef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
+							\fi
+						\fi
+					\fi
+				\fi
+			}
+			{
+				\xdef\PFirst{\csname First:\CurrentPageMaster\endcsname}
+			}
+			\@ifundefined{Blank:\CurrentPageMaster}
+				{\xdef\PBlank{\csname Odd:\CurrentPageMaster\endcsname}}
+				{\xdef\PBlank{\csname Blank:\CurrentPageMaster\endcsname}}
+			\@ifundefined{Even:\CurrentPageMaster}
+				{\xdef\PEven{\csname Odd:\CurrentPageMaster\endcsname}}
+				{\xdef\PEven{\csname Even:\CurrentPageMaster\endcsname}}
+			\xdef\POdd{\csname Odd:\CurrentPageMaster\endcsname}
+		}
+		{
+			\xdef\PFirst{\csname Lead:\the\SimplePMRefs:\CurrentPageMaster\endcsname}
+			\global\let\POdd\PFirst
+			\global\let\PEven\PFirst
+			\global\let\PBlank\PFirst
+		}
+  	}
+  	{
+    	\global\let\PFirst\CurrentPageMaster
+      	\global\let\PBlank\CurrentPageMaster
+      	\global\let\POdd\CurrentPageMaster
+      	\global\let\PEven\CurrentPageMaster
+  	}
+  	\DEBUG{ first page master is [\PFirst]}
+  	\DEBUG{ odd  page master is [\POdd]}
+  	\DEBUG{ even page master is [\PEven]}
+  	\DEBUG{ blank page master is [\PBlank]}
+  	\expandafter\Pass\csname\POdd:xsl-region-body\endcsname\\
+  	\csname Atomic:\POdd\endcsname
+  	\global\oddsidemargin\MasterLeftMargin
+  	\global\evensidemargin\MasterLeftMargin
+  	\global\advance\evensidemargin by \SpecialOffset
+  	\global\advance\oddsidemargin by \SpecialOffset
+  	\@ifundefined{Atomic:\PEven}
+	{
+		\DEBUG{no master for Atomic:\PEven}
+	}
+    {
+		\csname Atomic:\PEven\endcsname
+     	\global\evensidemargin\MasterLeftMargin
+     	\global\advance\evensidemargin by \SpecialOffset
+    }
+   	\xdef\EvenHeadExtent{\csname\PEven:before-extent\endcsname}
+   	\xdef\EvenHead{Static:\csname\PEven:before\endcsname}
+   	\xdef\EvenTailExtent{\csname\PEven:after-extent\endcsname}
+   	\xdef\EvenTail{Static:\csname\PEven:after\endcsname}
+   	\xdef\FirstHeadExtent{\csname\PFirst:before-extent\endcsname}
+   	\xdef\FirstHead{Static:\csname\PFirst:before\endcsname}
+   	\xdef\FirstTailExtent{\csname\PFirst:after-extent\endcsname}
+   	\xdef\FirstTail{Static:\csname\PFirst:after\endcsname}
+   	\xdef\OddHeadExtent{\csname\POdd:before-extent\endcsname}
+   	\xdef\OddHead{Static:\csname\POdd:before\endcsname}
+   	\xdef\OddTailExtent{\csname\POdd:after-extent\endcsname}
+   	\xdef\OddTail{Static:\csname\POdd:after\endcsname}
+   	\xdef\BlankHeadExtent{\csname\PBlank:before-extent\endcsname}
+   	\xdef\BlankHead{Static:\csname\PBlank:before\endcsname}
+   	\xdef\BlankTailExtent{\csname\PBlank:after-extent\endcsname}
+   	\xdef\BlankTail{Static:\csname\PBlank:after\endcsname}
+   	\FOSetPage
 }
 
 \let\olditem\item
@@ -1209,7 +1533,7 @@
  % \typeout{Hypertext label \FOid, at \the\inputlineno}%
   \@bsphack
   \protected@write\@mainaux{}%
-    {\string\newlabel{\FOid}{{}{\expandafter\FOgeneratePage\FOformat\@null}{}{\FOid}{}}}%
+    {\string\newlabel{\FOid}{{}{\noexpand\FOgeneratePage\FOformat\noexpand\@null}{}{}{}}}%
   \@esphack
   \hyper@@anchor{\FOid}{\relax}%
   \global\let\FOid\@empty
@@ -1229,9 +1553,10 @@
       \itemsep\FOspacebefore
     \fi
   \itemindent=\FOstartindent
-  \leftmargin=\FOprovisionaldistancebetweenstarts
+  \PercentToDimen{\FOprovisionaldistancebetweenstarts}%
+  \leftmargin=\@tempdima\relax
   \rightmargin=\FOmarginright
-  \labelwidth=\FOprovisionaldistancebetweenstarts
+  \labelwidth=\@tempdima\relax
   \advance\labelwidth by -\FOprovisionallabelseparation
   \expandafter\csname List\FOtextalign\endcsname
 %\typeout{List at \the\inputlineno: labelwidth: \the\labelwidth, 
@@ -1242,72 +1567,106 @@
 
 \def\FOOutputBlock{%
  \FOSetFont{output}%
- \ifFOBlockGrab
-   \FOBoxedBlock{\textwidth}%
- \fi
  \ifx\FOtextalignlast\att@relative
    \csname startQ@\FOtextalign\endcsname
-   \csname Q@\FOtextalign\endcsname
+%   \csname Q@\FOtextalign\endcsname
  \else
    \csname startQ@\FOtextalignlast\endcsname
-   \csname Q@\FOtextalignlast\endcsname
+%   \csname Q@\FOtextalignlast\endcsname
+ \fi
+% \Quadding
+ \ifFOBlockGrab
+   \FOBoxedBlock{\textwidth}%
  \fi
 }
 
-\def\FONormalBlock{%
-  \let\@x\relax
-  \ifnum\FOTableNesting>0
-   \ifx\FOtextalign\att@centered
-       \centering
-   \fi
-   \let\@x\relax
-   \FOSetFont{normalblock}%
-   \vrule height \f@baselineskip depth \z@ width \z@ 
+\def\list#1#2{%
+  \ifnum \@listdepth >5\relax
+    \@toodeep
   \else
-    \ifnum\FOinList>0
-      \FOlabel
-      \ifFOListInnerPar\par\FOvspacebefore\fi
-      \ifx\FOwhitespace\att@pre\obeyspaces\obeylines\fi
-      \ifx\FOwhitespacecollapse\att@false\obeyspaces\fi
-      \ifx\FOwrapoption\att@nowrap\obeylines\fi
-    \else
-      \ifx\FObreakbefore\att@page
-        \let\tempID\FOid
-        \penalty -\@M
-        \let\FOid\tempID
-      \else
-        \ifx\FObreakbefore\att@oddpage
-        \let\tempID\FOid
-        \penalty -\@M
-        \ifodd\c@page\else\BlankPage\newpage\fi
-        \let\FOid\tempID
-        \fi
-      \fi
-      \par
-      \FOlabel
-      \Quadding
-      \ifFOBlockGrab
-        \FOBoxedBlock{\linewidth}%
-      \else
-        \FOBorderTop
-        \ifdim\FOpaddingbefore>\z@
-         \vskip\FOpaddingbefore
-        \fi
-        \FOvspacebefore
-        \parindent\FOtextindent
-        \advance\leftskip by  \FOpaddingstart
-        \advance\leftskip by  \FOmarginleft
-        \advance\rightskip by \FOpaddingend
-        \advance\rightskip by \FOmarginright
-      \fi
-%      \par
-      \ifx\FOwhitespace\att@pre\obeyspaces\obeylines\fi
-      \ifx\FOwhitespacecollapse\att@false\obeyspaces\fi
-      \ifx\FOwrapoption\att@nowrap\obeylines\fi
-    \fi
-    \FOSetFont{normal}%
+    \global\advance\@listdepth\@ne
   \fi
-\@x
+  \rightmargin\z@
+  \listparindent\z@
+  \itemindent\z@
+  \csname @list\romannumeral\the\@listdepth\endcsname
+  \def\@itemlabel{#1}%
+  \let\makelabel\@mklab
+  \@nmbrlistfalse
+  #2\relax
+  \@trivlist
+  \parskip\parsep
+  \parindent\listparindent
+  \global\advance\linewidth -\rightmargin
+  \global\advance\linewidth -\leftmargin
+  \advance\@totalleftmargin \leftmargin
+  \parshape \@ne \@totalleftmargin \linewidth
+  \ignorespaces}
+
+\def\FONormalBlock{%
+  	\ifnum\FOTableNesting>0
+   		\ifx\FOtextalign\att@centered
+       		\centering
+   		\fi
+   		\FOSetFont{normalblock}%
+   		\vrule height \f@baselineskip depth \z@ width \z@\relax
+  	\else
+    	\ifnum\FOinList>0
+      		\ifFOListInnerPar
+				\unskip\par
+				\FOvspacebefore
+			\fi
+      		\ifx\FOwhitespace\att@pre\obeyspaces\obeylines\fi
+      		\ifx\FOwhitespacecollapse\att@false\obeyspaces\fi
+      		\ifx\FOwrapoption\att@nowrap\obeylines\fi
+			\ifInInsertion\start@strut\fi
+    	\else
+			\ifx\FObreakbefore\att@page
+				\let\tempID\FOid
+%		        \penalty -\@M
+				\newpage
+				\let\FOid\tempID
+			\else
+				\ifx\FObreakbefore\att@oddpage
+					\let\tempID\FOid
+%	          		\penalty -\@M
+					\newpage
+					\ifodd\c@page\else\BlankPage\fi
+					\let\FOid\tempID
+				\else
+					\ifx\FObreakbefore\att@evenpage
+						\let\tempID\FOid
+%            			\penalty -\@M
+						\newpage
+						\ifodd\c@page\BlankPage\fi
+						\let\FOid\tempID
+					\fi
+				\fi
+			\fi
+			\par
+			\Quadding
+			\ifFOBlockGrab
+				\FOBoxedBlock{\linewidth}%
+			\else
+				\FOBorderTop
+				\ifdim\FOpaddingbefore>\z@
+					\vskip\FOpaddingbefore
+				\fi
+				\FOvspacebefore
+				\parindent\FOtextindent
+				\advance\leftskip by  \FOpaddingstart
+				\advance\leftskip by  \FOmarginleft
+				\advance\rightskip by \FOpaddingend
+				\advance\rightskip by \FOmarginright
+			\fi
+%      		\par
+			\ifx\FOwhitespace\att@pre\obeyspaces\obeylines\fi
+			\ifx\FOwhitespacecollapse\att@false\obeyspaces\fi
+			\ifx\FOwrapoption\att@nowrap\obeylines\fi
+			\FOlabel
+		\fi
+    	\ifx\XML@parent\FOFootnoteBody\else\FOSetFont{normal}\fi
+  	\fi
 }
 
 \def\FOEndOutputBlock{%
@@ -1325,7 +1684,8 @@
   \ifx\XML@parent\FOListItemLabel
   \else
     \ifnum\FOinList>0
-      \ifFOListInnerPar\par\fi
+      \ifInInsertion\start@strut\fi
+      \ifFOListInnerPar\unskip\par\fi
     \else
        \ifnum\FOTableNesting>0
        \else
@@ -1335,6 +1695,7 @@
    \fi
 }
 
+
 \def\FOEndBlockTwo{%
   \par
    \ifFOBlockGrab
@@ -1346,22 +1707,27 @@
         \FOBorderBottom
    \fi
    \ifx\FObreakafter\att@page
-        \penalty -\@M
+   		\clearpage
+%        \penalty -\@M
    \else
         \ifx\FObreakafter\att@oddpage
-            \cleardoublepage
+          	\ifodd\c@page\cleardoublepage\else\clearpage\fi
+		\else
+          \ifx\FObreakafter\att@evenpage
+          	  \ifodd\c@page\clearpage\else\cleardoublepage\fi
+		  \fi
         \fi
    \fi
    \@tempswafalse
    \ifx\FOkeepwithnext\att@always\@tempswatrue\fi
    \ifx\FOkeepwithnextColumn\att@always\@tempswatrue\fi
    \ifx\FOkeepwithnextPage\att@always\@tempswatrue\fi
-   \if@tempswa\nobreak\fi
+   \if@tempswa\addpenalty{9993}\fi
    \FOvspaceafter
-   \if@tempswa\@afterheading\fi
+%   \if@tempswa\@afterheading\fi
 }
 
-
+% \FOStartGrab is never called, so it seems
 \def\FOStartGrab#1{%
          \@tempdima#1
          \XFOstartindent\FOstartindent
@@ -1399,6 +1765,7 @@
          \vskip\FOpaddingbefore
          \parindent\FOtextindent\leftskip\z@\rightskip\z@
 }
+% \FOEndGrab is never called, so it seems
 \def\FOEndGrab#1{%
   \vspace*{\FOpaddingafter}%
   \end{minipage}%
@@ -1502,17 +1869,88 @@
   \expandafter\let\csname p@footnote\endcsname\relax
   \@footnotetext{\FOlabel#2}}
 
+\def\start@strut{%
+   	\vrule height \ht\strutbox depth \dp\strutbox width \z@\relax
+}
+
 \def\FOplainfootmark#1{#1}
-\long\def\FOplainfoottext#1{\insert\footins{%
-    \reset@font\footnotesize
-    \interlinepenalty\interfootnotelinepenalty
-    \splittopskip\footnotesep
-    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
-    \hsize\columnwidth \@parboxrestore
-    \color@begingroup
-    #1\unskip\ifhmode\nobreak\fi\vskip\lineskip
-    \color@endgroup}%
+
+\newtoks\sav@everypar
+\newbox\sav@labels
+
+%\showboxbreadth10
+%\showboxdepth10
+\gdef \@makecol {%
+   \ifvoid\footins
+     \setbox\@outputbox \box\@cclv
+   \else
+%	\showbox\footins
+     \setbox\@outputbox \vbox {%
+       \boxmaxdepth \@maxdepth
+       \@tempdima\dp\@cclv
+       \unvbox \@cclv
+       \vskip \skip\footins
+       \color@begingroup
+         \normalcolor
+         \footnoterule
+         \unvbox \footins
+       \color@endgroup
+       }%
+   \fi
+   \xdef\@freelist{\@freelist\@midlist}%
+   \global \let \@midlist \@empty
+   \@combinefloats
+   \ifvbox\@kludgeins
+     \@makespecialcolbox
+   \else
+     \setbox\@outputbox \vbox to\@colht {%
+       \@texttop
+       \dimen@ \dp\@outputbox
+       \unvbox \@outputbox
+       \vskip -\dimen@
+       \@textbottom
+       }%
+   \fi
+   \global \maxdepth \@maxdepth
+}
+
+\long\def\FOplainfoottext#1{%
+	\insert\footins{\relax
+	\reset@font\footnotesize
+	\FORestoreFontSize
+	\size@update
+	\interlinepenalty\interfootnotelinepenalty
+	\splittopskip0pt\relax
+	\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+	\hsize\columnwidth\@parboxrestore
+	\color@begingroup\InInsertiontrue
+	\xdef\Sav@FOListBlocks{\the\FOListBlocks}\FOListBlocks0\relax
+	\global\let\sav@if@inlabel\if@inlabel
+	\global\let\sav@if@nobreak\if@nobreak
+	\global\let\sav@if@newlist\if@newlist
+	\global\setbox\sav@labels\box\@labels
+	\expandafter\global\expandafter\sav@everypar\expandafter{\the\everypar}\global\everypar{}\relax
+	\FOinList0\relax
+	\FOListBodyfalse
+	#1\ifhmode\nobreak\fi
+	\global\FOListBlocks\Sav@FOListBlocks\relax
+	\global\let\if@inlabel\sav@if@inlabel
+	\global\let\if@nobreak\sav@if@nobreak
+	\global\let\if@newlist\sav@if@newlist
+	\global\setbox\@labels\box\sav@labels
+	\expandafter\global\expandafter\everypar\expandafter{\the\sav@everypar}\relax
+	%\vskip\lineskip
+	\color@endgroup}%
+}
+\let\FOfoottext\FOplainfoottext
+
+\def\FOboxedfoottext#1{
+	\edef\boxedfootnotetext{\the\BoxedFootnotes\noexpand\FOplainfoottext}%
+	\global\BoxedFootnotes=\expandafter{\boxedfootnotetext{#1}}%
 }
+
+\def\FOnofoottext#1{}
+
 \ColSpecs={}%
 \NCols0
 \RowCount0
@@ -1559,6 +1997,15 @@
 %}
 \edef\LastLanguage{\newL}}
 
+\def\FoTeXSetSpacingStyle{%
+  \ifx\FoTeXSpacingStyle\att@french
+	  \frenchspacing
+	  \typeout{INFO: Using french-spacing in document}%
+  \else
+	  \typeout{INFO: Using normal, i.e. nonfrench-spacing in document}%
+	  %\nonfrenchspacing
+  \fi
+}
 \def\FOSetHyphenation{%
   \ifx\FOhyphenate\att@true
      \LoadLanguage{\FOlanguage}%
@@ -1573,8 +2020,8 @@
       \csname Weight@\FOfontweight\endcsname}%
  \ifx\LaTeXshape\@empty\def\LaTeXshape{m}\fi
 \edef\fFamName{\FOfontfamily}%
-%\typeout{#1 At \the\inputlineno, \FOfontweight, \FOfontstyle,
-%  \FOfontsize, \FOtextalign, \LaTeXshape}%
+\DEBUG{#1: \FOfontweight, \FOfontstyle,
+  \FOfontsize, \FOtextalign, \LaTeXshape}%
  \edef\f@series{\LaTeXshape}%
  \edef\f@shape{\csname Posture@\FOfontstyle\endcsname}%
  \ifx\FOfontvariant\att@smallcaps
@@ -1632,43 +2079,69 @@
    \set@fontsize\baselinestretch{\FOfontsizefinal}{\FOlineheight}%
  \fi
 }
+\def\FOSaveFontSize{%
+ \computeFOfontsize
+ \ifx\FOlineheight\att@normal
+   \@tempdima\FOfontsizefinal
+   \multiply\@tempdima by 12
+   \divide\@tempdima by 10
+   \xdef\FORestoreFontSize{\noexpand\set@fontsize\noexpand\baselinestretch{\FOfontsizefinal}{\the\@tempdima}}%
+ \else
+   \xdef\FORestoreFontSize{\noexpand\set@fontsize\noexpand\baselinestretch{\FOfontsizefinal}{\FOlineheight}}%
+ \fi
+}
+
 
 \DeclareRobustCommand*\textsubscript[1]{%
   \@textsubscript{\selectfont#1}}
+%\def\@textsubscript#1{%
+% {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
 \def\@textsubscript#1{%
-  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
+  {\m@th\ensuremath{_{\mbox{#1}}}}}
+\def\@textsuperscript#1{%
+  {\m@th\ensuremath{^{\mbox{#1}}}}}
 \def\reserved@e{}
+
 \def\FOSetPage{%
- \bottommargin\Marginbottom
- \headsep\Margintop
- \topmargin\MasterTopMargin
- \advance\topmargin by \SpecialOffset
- \textheight\paperheight
- \textwidth\paperwidth
- \advance\textheight by -\FirstHeadExtent
- \advance\textheight by -\FirstTailExtent
- \advance\textheight by -\MasterTopMargin
- \advance\textheight by -\Margintop
- \advance\textheight by -\MasterBottomMargin
- \advance\textheight by -\Marginbottom
- \advance\textwidth by -\MasterLeftMargin
- \advance\textwidth by -\MasterRightMargin
+ \global\bottommargin\Marginbottom
+% \headsep\Margintop
+ \global\headsep\z@
+ \global\topmargin\MasterTopMargin
+ \global\advance\topmargin by \SpecialOffset
+ \global\textheight\paperheight
+ \global\textwidth\paperwidth
+% \advance\textheight by -\FirstHeadExtent
+% \advance\textheight by -\FirstTailExtent
+ \global\advance\textheight by -\MasterTopMargin
+% \advance\textheight by -\Margintop
+ \global\advance\textheight by -\MasterBottomMargin
+% \advance\textheight by -\Marginbottom
+ \global\advance\textwidth by -\MasterLeftMargin
+ \global\advance\textwidth by -\MasterRightMargin
  \FOpdfsetpagesize{\paperwidth}{\paperheight}
- \@colht\textheight
- \@colroom\textheight
- \vsize\textheight
- \linewidth\textwidth
- \columnwidth\textwidth
- \hsize\columnwidth \linewidth\hsize
- \def\headheight{12pt}%
+ \global\@colht\textheight
+ \global\@colroom\textheight
+ \global\vsize\textheight
+ \global\columnwidth\textwidth
+ \global\hsize\columnwidth
+ \global\linewidth\hsize
+ \gdef\headheight{12pt}%
+% if we are in the middle of a list, we have to redo some of the list assignments
+ \FOResetPageParts
     \DEBUG{Page size is \the\textwidth/\the\textheight,
   on paper   \the\paperwidth/\the\paperheight,^^J
   with paper margins \the\MasterRightMargin/\the\MasterLeftMargin,
   and region margins \the\topmargin/\the\MasterBottomMargin;^^J
   footskip is \the\footskip, headsep is \the\headsep^^J
   evensidemargin \the\evensidemargin, oddsidemargin \the\oddsidemargin}%
-  \global\@specialpagetrue
 }
+
+\def\FOResetPageParts{
+	\expandafter\ifx\csname This@LineWidth\endcsname\relax\else
+		\global\linewidth\This@LineWidth\relax
+	\fi
+}
+
 % don't ask
 \def\supppdf{supp-pdf}
 \let\FOinputIfFileExists\InputIfFileExists
@@ -1720,5 +2193,5 @@
 \g@addto@macro\Gin@extensions{,.gif}
 \@namedef{Gin@rule@.eps}#1{{pdf}{.pdf}{`epstopdf #1}}
 \@namedef{Gin@rule@.gif}#1{{png}{.png}{`giftopng #1}}
-
+\errorstopmode
 \endinput
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/fotex.xmt tetex-src-2.0.1/xmltex/contrib/passivetex/fotex.xmt
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/fotex.xmt	2002-06-25 22:51:00.000000000 +0200
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/fotex.xmt	2003-02-14 00:00:00.000000000 +0100
@@ -1,8 +1,9 @@
-% $Id: //depot/Master/texmf/tex/xmltex/passivetex/fotex.xmt#90 $, $Date: 2002/06/25 $
+% $Id: //TEI/web/Software/passivetex/fotex.xmt#42 $, $Date: 2003/02/13 $
 %
-% PassiveTeX version 1.17
+% PassiveTeX version 1.23
+% modified by Dirk Roorda 
 %
-% Copyright 2002 Sebastian Rahtz/Oxford University  
+% Copyright 2003 Sebastian Rahtz/Oxford University  
 %      <sebastian.rahtz@oucs.ox.ac.uk>
 %
 % Permission is hereby granted, free of charge, to any person obtaining
@@ -19,6 +20,21 @@
 % Includes fixes from Tomas Bures <ghort@pauline.vellum.cz>
 %                     Yura Zotov <yznews@hotbox.ru>
 %                     Anton V. Boyarshinov <boyarsh@ru.echo.fr>
+%                     Dirk Roorda <dirk.roorda@planet.nl>
+
+
+\gdef\XML@attrib@x#1#2{
+    \gdef\XML@tempb##1#1##2##3##4\relax\relax{
+	\global\let\inheritexplicit\relax
+	{\set@display@protect
+	\expandafter\ifx\csname#2\endcsname\inherit
+		\global\let\inheritexplicit\noexpand
+	\fi}%
+	\ifx\inheritexplicit\relax
+		\def##2{#2}%
+	\fi
+    ##1##4\relax\relax}}
+
 \DeclareNamespace{fotex}{http://www.tug.org/fotex}
 \DeclareNamespace{fo}{http://www.w3.org/1999/XSL/Format}
 \def\string@autoauto{autoauto}
@@ -28,31 +44,33 @@
 \XMLstring\file@urlprefix<>url(</>
 \XMLstring\file@prefix<>file://</>
 \XMLstring\file@shortprefix<>file:</>
-\XMLstringX\prop@width<>proportional-column-width(1)</>
+\XMLstring\prop@width<>proportional-column-width(1)</>
 \XMLstringX\@staticafter<>xsl-after</>
 \XMLstringX\@staticbefore<>xsl-before</>
 \XMLstringX\@staticstart<>xsl-start</>
-\XMLstring\att@labelend<>label-end()</>
-\XMLstring\att@bodystart<>body-start()</>
 \XMLstringX\att@NaN<>NaN</>
+\XMLstringX\att@after<>after</>
 \XMLstringX\att@all<>all</>
 \XMLstringX\att@always<>always</>
 \XMLstringX\att@any<>any</>
 \XMLstringX\att@auto<>auto</>
-\XMLstringX\att@autoodd<>auto-odd</>
 \XMLstringX\att@autoeven<>auto-even</>
-\XMLstringX\att@endonodd<>end-on-odd</>
-\XMLstringX\att@endoneven<>end-on-even</>
+\XMLstringX\att@autoodd<>auto-odd</>
 \XMLstringX\att@baseline<>baseline</>
-\XMLstringX\att@blank<>blank</>
+\XMLstringX\att@before<>before</>
 \XMLstringX\att@black<>black</>
+\XMLstringX\att@blank<>blank</>
 \XMLstringX\att@bottom<>bottom</>
 \XMLstringX\att@centered<>center</>
+\XMLstringX\att@endoneven<>end-on-even</>
+\XMLstringX\att@endonodd<>end-on-odd</>
+\XMLstringX\att@even<>even</>
+\XMLstringX\att@evenpage<>even-page</>
 \XMLstringX\att@false<>false</>
-\XMLstringX\att@first@starting@within@page<>first-starting-within-page</>
 \XMLstringX\att@first<>first</>
-\XMLstringX\att@even<>even</>
-\XMLstringX\att@odd<>odd</>
+\XMLstringX\att@first@starting@within@page<>first-starting-within-page</>
+\XMLstringX\att@french<>french</>
+\XMLstringX\att@last@starting@within@page<>last-starting-within-page</>
 \XMLstringX\att@lr@tb<>lr-tb</>
 \XMLstringX\att@maximum<>maximum</>
 \XMLstringX\att@maximumuniform<>maximum-uniform</>
@@ -62,6 +80,7 @@
 \XMLstringX\att@none<>none</>
 \XMLstringX\att@normal<>normal</>
 \XMLstringX\att@nowrap<>no-wrap</>
+\XMLstringX\att@odd<>odd</>
 \XMLstringX\att@oddpage<>odd-page</>
 \XMLstringX\att@page<>page</>
 \XMLstringX\att@page@sequence<>page-sequence</>
@@ -70,25 +89,28 @@
 \XMLstringX\att@relative<>relative</>
 \XMLstringX\att@repeat<>repeat</>
 \XMLstringX\att@replace<>replace</>
-\XMLstringX\att@scroll<>scroll</>
 \XMLstringX\att@scaletofit<>scale-to-fit</>
+\XMLstringX\att@scroll<>scroll</>
 \XMLstringX\att@show<>show</>
 \XMLstringX\att@smallcaps<>small-caps</>
 \XMLstringX\att@solid<>solid</>
 \XMLstringX\att@static<>static</>
 \XMLstringX\att@sub<>sub</>
 \XMLstringX\att@super<>super</>
+\XMLstringX\att@thick<>thick</>
+\XMLstringX\att@thin<>thin</>
+\XMLstringX\att@tiny<>true</>
 \XMLstringX\att@top<>top</>
 \XMLstringX\att@transparent<>transparent</>
 \XMLstringX\att@true<>true</>
-\XMLstringX\att@tiny<>true</>
-\XMLstringX\att@thin<>thin</>
-\XMLstringX\att@thick<>thick</>
 \XMLstringX\att@uniform<>uniform</>
 \XMLstringX\att@use@font@metrics<>use-font-metrics</>
 \XMLstringX\att@visible<>visible</>
 \XMLstringX\att@xsl@any<>xsl-any</>
+\XMLstringX\att@xsl@footnote@separator<>xsl-footnote-separator</>
 \XMLstringX\att@yes<>yes</>
+\XMLstring\att@bodystart<>body-start()</>
+\XMLstring\att@labelend<>label-end()</>
 \XMLstringX\leader@pattern@space<>space</>
 \XMLstringX\leader@pattern@rule<>rule</>
 \XMLstringX\leader@pattern@dots<>dots</>
@@ -349,15 +371,17 @@
 %<length> | <percentage> | inherit
 \XMLnamespaceattributeX{fo}{last-line-end-indent}{\FOlastlineendindent}{\inherit}
 %none | reference-area | page | inherit
-\XMLnamespaceattributeX{fo}{leader-alignment}{\FOleaderalignment}{\inherit}
-%<length-range> | inherit
-\XMLnamespaceattributeX{fo}{leader-length}{\FOleaderlength}{\inherit}
+ \XMLnamespaceattribute{fo}{leader-length.maximum}{\FOleaderlengthmaximum}{\textwidth}
+% leader-length.minimum=0pt, .optimum=12.0pt, .maximum=100percent
+ \XMLnamespaceattributeX{fo}{leader-alignment}{\FOleaderalignment}{\inherit}
+ \XMLnamespaceattributeX{fo}{leader-length}{\FOleaderlength}{\inherit}
 %space | rule | dots | use-content | inherit
-\XMLnamespaceattributeX{fo}{leader-pattern}{\FOleaderpattern}{\inherit}
+ \XMLnamespaceattributeX{fo}{leader-pattern}{\FOleaderpattern}{\inherit}
 %use-font-metrics | <length> | inherit
-\XMLnamespaceattributeX{fo}{leader-pattern-width}{\FOleaderpatternwidth}{\inherit}
+ \XMLnamespaceattributeX{fo}{leader-pattern-width}{\FOleaderpatternwidth}{\inherit}
 %<length> | <percentage> | auto | inherit
-\XMLnamespaceattributeX{fo}{left}{\FOleft}{auto}
+ \XMLnamespaceattribute{fo}{leader-length.optimum}{\FOleaderlengthoptimum}{0pt}
+ \XMLnamespaceattributeX{fo}{leader-length.minimum}{\FOleaderlengthminimum}{\z@}\XMLnamespaceattributeX{fo}{left}{\FOleft}{auto}
 %normal | <length> | <space> | inherit
 \XMLnamespaceattributeX{fo}{letter-spacing}{\FOletterspacing}{\inherit}
 %auto | alphabetic | traditional
@@ -602,6 +626,7 @@
 %          with namespaces.
 \XMLnamespaceattributeX{fo}{fotex:placement}{\FOkplacement}{}
 \XMLname{fo:inline-container}{\FOInlineContainer}
+\XMLname{fo:footnote-body}{\FOFootnoteBody}
 \XMLname{fo:list-item-label}{\FOListItemLabel}
 \XMLname{fo:list-item-body}{\FOListItemBody}
 \XMLname{fo:table-cell}{\FOTableCell}
@@ -651,7 +676,7 @@
  \gdef\FOlanguage{none}
  \gdef\FOlastlineendindent{\z@}
  \gdef\FOleaderalignment{none}
- \gdef\FOleaderlength{\z@}
+ \gdef\FOleaderlength{}
  \gdef\FOleaderpattern{space}
  \gdef\FOleaderpatternwidth{}
  \gdef\FOletterspacing{normal}
@@ -702,12 +727,13 @@
 \gdef\FOkplacement{}
 
 \XMLelement{fo:root}
-  {}
+  {\XMLnamespaceattributeX{fo}{fotex:spacing-style}{\FoTeXSpacingStyle}{normal}}
   {\documentclass{article}
    \usepackage{fotex}
    \begin{document}
    \pagestyle{empty}
    \FOSetHyphenation
+   \FoTeXSetSpacingStyle
    %\ignorewhitespace
    }
   {\end{document}}
@@ -759,53 +785,60 @@
 \XMLelement{fo:block}
   {\SpaceAttributes}
   {%
+  \ifx\FOspan\att@all
+	\ifnum\NColumns>1\relax
+  		\interendmulticols
+	\fi
+  \fi
+  \ifnum\FOwidows>1\relax\widowpenalty10000\relax\else\widowpenalty0\relax\fi
+  \ifnum\FOorphans>1\relax\clubpenalty10000\relax\else\clubpenalty0\relax\fi
   \FOBlockGrabfalse
   \FOexpandattributes
   \FOSetHyphenation
-  %\edef\SavedNColumns{\NColumns}
-  \ifx\XML@parent\FOListItemLabel
-       \def\w@t{\FOListBlock}%
-       \def\@whattodonext{\FOEndBlock}%
-  \else
-   \ifFOinOutput
+  \ifFOinOutput
      \ifx\FObackgroundcolor\att@transparent
         \ifx\FOborderstyle\att@solid
-          \FOBlockGrabtrue
+           \FOBlockGrabtrue
         \fi
      \else
-         \FOBlockGrabtrue
+        \FOBlockGrabtrue
      \fi
      \def\w@t{\FOOutputBlock}%
      \def\@whattodonext{\FOEndOutputBlock}%
-   \else
+     \DEBUG{Start of Output Block, \expandafter\meaning\w@t, \expandafter\meaning\@whattodonext}%
+  \else
+     \ifx\XML@parent\FOListItemLabel
+        \def\w@t{\FOListBlock}%
+        \def\@whattodonext{\FOEndBlock}%
+     \else
 % we care if a block is inside a table cell
-       \ifnum\FOinTable>\z@
-         \def\w@t{\FOBoxedBlock{\CurrentCellWidth}}%
-         \def\@whattodonext{\FOEndBoxedBlock}
-       \else
-        % we care if a block is a second or subsequent child of a list body
-        \ifx\XML@parent\FOListItemBody
-          \global\advance\FOListBlocks by 1%
-          \ifnum\FOListBlocks=1\relax\else\FOListInnerPartrue\fi
+        \ifnum\FOinTable>1\relax
+			\FOinTable1\relax
+           \def\w@t{\FOBoxedBlock{\CurrentCellWidth}}%
+           \def\@whattodonext{\FOEndBoxedBlock}
         \else
+        % we care if a block is a second or subsequent child of a list body
+           \ifx\XML@parent\FOListItemBody
+              \global\advance\FOListBlocks by 1\relax%
+              \ifnum\FOListBlocks<2\relax\else\FOListInnerPartrue\fi
+           \else
         % but also if its nested within a list body block
-          \ifFOListBody
-             \FOListInnerPartrue
-          \fi
-        \fi
-        \ifx\FObackgroundcolor\att@transparent
-         \ifx\FOborderstyle\att@solid
-           \FOBlockGrabtrue
-         \fi
-        \else
-          \FOBlockGrabtrue
+              \ifFOListBody
+                 \FOListInnerPartrue
+              \fi
+           \fi
+           \ifx\FObackgroundcolor\att@transparent
+              \ifx\FOborderstyle\att@solid
+                 \FOBlockGrabtrue
+              \fi
+           \else
+              \FOBlockGrabtrue
+           \fi
+           \def\@whattodonext{\FOEndBlock}
+           \def\w@t{\FONormalBlock}%
         \fi
-        \def\@whattodonext{\FOEndBlock}
-        \def\w@t{\FONormalBlock}%
-       \fi
-    \fi
+     \fi
   \fi
-%\typeout{Block \the\inputlineno, \meaning\w@t,  \meaning\@whattodonext}%
   \w@t
   \ifx\FOkeeptogether\att@always\samepage\fi
   \ifx\FOkeeptogetherColumn\att@always\samepage\fi
@@ -816,6 +849,11 @@
   \ifx\FOkeeptogetherColumn\att@always\samepage\fi
   \ifx\FOkeeptogetherPage\att@always\samepage\fi
   \@whattodonext
+  \ifx\FOspan\att@all
+	\ifnum\NColumns>1\relax
+  		\interbeginmulticols{\NColumns}%
+  	\fi
+  \fi
 }
 
 \XMLelement{fo:character}
@@ -830,9 +868,9 @@
 \XMLelement{fo:external-graphic}
    {
 %auto | <length> | <percentage> | inherit
-\XMLattribute{content-height}{\FOcontentheight}{auto}
+\XMLattributeX{content-height}{\FOcontentheight}{auto}
 %auto | <length> | <percentage> | inherit
-\XMLattribute{content-width}{\FOcontentwidth}{auto}
+\XMLattributeX{content-width}{\FOcontentwidth}{auto}
 }
    {
 {\utfeight@protect@chars\expandafter\FOfiletest\FOsrc\@empty\@empty\@empty\@empty\@empty\@empty\@empty\@}%
@@ -852,12 +890,12 @@
   \fi
 \fi
 \ifx\FOcontentwidth\att@scaletofit
- \setkeys{Gin}{width=\linewidth}%
+ \setkeys{Gin}{width=\hsize}%
 \else
   \ifx\FOcontentwidth\att@auto\else\FOSetGWidth\fi
 \fi
 \ifx\FOcontentheight\att@scaletofit
- \setkeys{Gin}{height=\textheight}%
+ \setkeys{Gin}{height=\vsize}%
 \else
  \ifx\FOcontentheight\att@auto\else\FOSetGHeight\fi
 \fi
@@ -890,131 +928,66 @@
 
 \XMLelement{fo:flow}
   {}
-  {\FOSetHyphenation
-  \clearpage
+  {\global\SimplePMRefs1\relax
+  \FOSetHyphenation
+  \ifnum\PrevNColumns>1\relax
+  \else
+  	\clearpage
+  \fi
   \DEBUG{New page, \the\c@page, \PageNumber}%
   \ifx\PageNumber\att@auto
   \else
-     \ifx\PageNumber\att@autoeven
-       \ifodd\c@page\hbox{}\newpage\fi
-     \else
-        \ifx\PageNumber\att@autoodd
-          \ifodd\c@page\else\hbox{}\newpage\fi
-        \else
-          \setcounter{page}{\PageNumber}%
-        \fi
-     \fi
-  \fi
+  	\ifx\PageNumber\att@autoeven
+  		\ifodd\c@page
+			\BlankPage
+		\fi
+ 		\else
+  			\ifx\PageNumber\att@autoodd
+  				\ifodd\c@page
+ 				\else
+					\BlankPage
+				\fi
+      		\else
+    			\setcounter{page}{\PageNumber}%
+    		\fi
+   		\fi
+  	\fi
   \ifx\@empty\pendingID\else
    \@bsphack
    \protected@write\@mainaux{}%
-    {\string\newlabel{\pendingID}{{}{\expandafter\FOgeneratePage\FOformat\@null}{}{\pendingID}{}}}%
+    {\string\newlabel{\pendingID}{{}{\expandafter\FOgeneratePage\FOformat\@null}{}{}{}}}%
    \@esphack
   \hyper@@anchor{\pendingID}{\relax}%
   \global\let\pendingID\@empty
   \fi
   
-    \DEBUG{^^JStart page sequence, using layout \CurrentPageMaster, at page \the\c@page}
+    \DEBUG{^^JStart page sequence, using layout \CurrentPageMaster, at page \the\c@page}%
   
-  \@ifundefined{Atomic:\CurrentPageMaster}
-   {
-    \@ifundefined{First:\CurrentPageMaster}
-    {
-     \ifx\FOinitialpagenumber\att@auto
-        \ifodd\c@page
-    \DEBUG{Master \CurrentPageMaster: no first page, use odd page}
-           \edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
-        \else
-           \DEBUG{Master \CurrentPageMaster: no first page, use even page}
-           \@ifundefined{Even:\CurrentPageMaster}
-            {\edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
-            {\edef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
-        \fi
-     \else
-      \ifx\FOinitialpagenumber\att@autoeven
-           \@ifundefined{Even:\CurrentPageMaster}
-            {\edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
-            {\edef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
-      \else
-        \ifx\FOinitialpagenumber\att@autoodd
-          \edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
-        \else
-          \ifodd\FOinitialpagenumber
-           \edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}
-          \else
-           \@ifundefined{Even:\CurrentPageMaster}
-            {\edef\PFirst{\csname Odd:\CurrentPageMaster\endcsname}}
-            {\edef\PFirst{\csname Even:\CurrentPageMaster\endcsname}}
-          \fi
-        \fi
-      \fi
-     \fi
-    }
-    {
-     \edef\PFirst{\csname First:\CurrentPageMaster\endcsname}
-    }
-   \@ifundefined{Blank:\CurrentPageMaster}
-     {\edef\PBlank{\csname Odd:\CurrentPageMaster\endcsname}}
-     {\edef\PBlank{\csname Blank:\CurrentPageMaster\endcsname}}
-   \@ifundefined{Even:\CurrentPageMaster}
-       {\edef\PEven{\csname Odd:\CurrentPageMaster\endcsname}}
-       {\edef\PEven{\csname Even:\CurrentPageMaster\endcsname}}
-   \edef\POdd{\csname Odd:\CurrentPageMaster\endcsname}
-  }
-  {
-      \let\PFirst\CurrentPageMaster
-      \let\PBlank\CurrentPageMaster
-      \let\POdd\CurrentPageMaster
-      \let\PEven\CurrentPageMaster
-  }
-  \DEBUG{ first page master  is [\PFirst]}
-  \DEBUG{ odd  page master is [\POdd]}
-  \DEBUG{ even page master is [\PEven]}
-  \DEBUG{ blank page master is [\PBlank]}
-  \expandafter\Pass\csname\POdd:xsl-region-body\endcsname\\
-  \csname Atomic:\POdd\endcsname
-  \oddsidemargin\MasterLeftMargin
-  \evensidemargin\MasterLeftMargin
-  \advance\evensidemargin by \SpecialOffset
-  \advance\oddsidemargin by \SpecialOffset
-  \@ifundefined{Atomic:\PEven}{\DEBUG{no master for Atomic:\PEven}}
-    {\csname Atomic:\PEven\endcsname
-     \evensidemargin\MasterLeftMargin
-     \advance\evensidemargin by \SpecialOffset
-    }
-   \edef\EvenHeadExtent{\csname\PEven:before-extent\endcsname}
-   \edef\EvenHead{Static:\csname\PEven:before\endcsname}
-   \edef\EvenTailExtent{\csname\PEven:after-extent\endcsname}
-   \edef\EvenTail{Static:\csname\PEven:after\endcsname}
-   \edef\FirstHeadExtent{\csname\PFirst:before-extent\endcsname}
-   \edef\FirstHead{Static:\csname\PFirst:before\endcsname}
-   \edef\FirstTailExtent{\csname\PFirst:after-extent\endcsname}
-   \edef\FirstTail{Static:\csname\PFirst:after\endcsname}
-   \edef\OddHeadExtent{\csname\POdd:before-extent\endcsname}
-   \edef\OddHead{Static:\csname\POdd:before\endcsname}
-   \edef\OddTailExtent{\csname\POdd:after-extent\endcsname}
-   \edef\OddTail{Static:\csname\POdd:after\endcsname}
-   \edef\BlankHeadExtent{\csname\PBlank:before-extent\endcsname}
-   \edef\BlankHead{Static:\csname\PBlank:before\endcsname}
-   \edef\BlankTailExtent{\csname\PBlank:after-extent\endcsname}
-   \edef\BlankTail{Static:\csname\PBlank:after\endcsname}
-   \FOSetPage
-   \ifnum\NColumns>1\begin{multicols}{\NColumns}\fi
+   \setaccordingtomaster
+   \xdef\PrevNColumns{\NColumns}%
+   \ForcePageSetuptrue
+   \ifnum\NColumns>1\relax
+   		\nobeginmulticols{\NColumns}%
+   \fi
 %  \ifnum\NColumns>1\MulticolPendingtrue
 %  \begin{multicols}{\NColumns}\fi
    }
   {
-   \ifnum\NColumns>1\end{multicols}\fi
-   \clearpage
+   \ForcePageSetupfalse
+   \ifnum\NColumns>1\relax
+   		\noendmulticols
+   \else
+   		\clearpage
+   \fi
    \ifx\ForcePage\att@auto
    \else
 % remember that we'll do a \clearpage next time anyway.
 % so leave here on wrong sort of page
      \ifx\ForcePage\att@endoneven
-       \ifodd\c@page\else\BlankPage\newpage\fi
+       \ifodd\c@page\else\BlankPage\fi
      \else
         \ifx\ForcePage\att@endonodd
-          \ifodd\c@page\BlankPage\newpage\fi
+          \ifodd\c@page\BlankPage\fi
         \fi
      \fi
    \fi
@@ -1029,7 +1002,7 @@
 \XMLelement{fo:footnote}
   {}
   {\xmlgrab}
-  {\xmltextwochildren\FOplainfootmark\FOplainfoottext#1}
+  {\FOSaveFontSize\xmltextwochildren\FOplainfootmark\FOfoottext#1}
 
 \XMLelement{fo:page-number-citation}
    {\XMLattributeX{ref-id}{\FOrefid}{}}
@@ -1037,14 +1010,15 @@
    {\fopagecitation}
 
 \XMLelement{fotex:sort}
-   {}
+   {\XMLattributeX{range-char}{\FOrangechar}{\textendash}}
    {\let\fopagecitation\fosortpagecitation
     \global\sorttoks{}}
    {\global\sortcount-2\let\@elt\focompress@elt
     \let\fosep\@empty
     \let\foheld\relax
     \the\sorttoks
-    \foheld}
+    \ifx\foheld\relax\else\FOrangechar\fi\foheld
+   }
 
 \XMLelement{fo:wrapper}
   {}
@@ -1056,28 +1030,47 @@
   {
 \leavevmode
 \ifx\FOleaderpattern\leader@pattern@rule
-   \ifx\FOrulestyle\rule@style@dashed
-    \def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu-\mkern1.5mu$}\hfil}%
-   \else
-    \ifx\FOrulestyle\rule@style@dotted
-      \def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfil}%
-    \else
-      \ifdim\FOrulethickness>\z@
-        \def\w@t{\leaders\hrule height \FOrulethickness\hfill}%
-      \else
-        \def\w@t{\hfill}%
-      \fi
-    \fi
-   \fi
+  	\ifx\FOrulestyle\rule@style@dashed
+    	\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu-\mkern1.5mu$}\hfil}%
+   	\else
+    	\ifx\FOrulestyle\rule@style@dotted
+      		\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfil}%
+    	\else
+      		\ifdim\FOrulethickness>\z@
+        		\def\w@t{\leaders\hrule height \FOrulethickness\hfill}%
+      		\else
+        		\def\w@t{\hfill}%
+      		\fi
+    	\fi
+   	\fi
 \else
-  \ifx\FOleaderpattern\leader@pattern@dots
-      \def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}%
-  \else % space
-      \def\w@t{\hfill}%
-  \fi
+  	\ifx\FOleaderpattern\leader@pattern@dots
+      	\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}%
+  	\else % space
+      	\def\w@t{\hfill}%
+  	\fi
+\fi
+\ifx\@empty\FOleaderlength
+	\PercentToDimen{\FOleaderlengthoptimum}%
+	\edef\leaderopt{\the\@tempdima}%
+	\PercentToDimen{\FOleaderlengthminimum}%
+	\edef\leadermin{\the\@tempdima}%
+	\PercentToDimen{\FOleaderlengthmaximum}%
+	\edef\leadermax{\the\@tempdima}%
+	\@tempdima\leaderopt\relax
+	\advance\@tempdima-\leadermin\relax
+	\@tempdimb\leadermax\relax
+	\advance\@tempdimb-\leaderopt\relax
+	\LeaderLength\leaderopt plus \@tempdimb minus \@tempdima\relax
+\else
+	\PercentToDimen{\FOleaderlength}%
+	\LeaderLength\@tempdima\relax
+\fi
+\ifdim\LeaderLength=\z@
+	\w@t
+\else
+	\hbox to \LeaderLength{\w@t}%
 \fi
-\PercentToDimen{\FOleaderlength}%
-\ifdim\@tempdima=\z@\w@t\else\hbox to \@tempdima{\w@t}\fi
    }
   {}
   
@@ -1124,27 +1117,29 @@
 
 \XMLelement{fo:list-block}
   {\SpaceAttributes}
-  {
-   \ifx\FOstartindent\att@bodystart
+  {\ifx\FOstartindent\att@bodystart
      \let\FOstartindent\z@
    \fi
    \ifx\FOendindent\att@labelend
      \let\FOendindent\z@
    \fi
-   \FOSetFont{normal}%
+   %\FOSetFont{normal}%
    \advance\FOinList by 1\relax
-   \ifnum\FOinList>1\relax\leavevmode\fi
+   %\ifnum\FOinList>1\relax\leavevmode\fi
+   \edef\This@LineWidth{\the\linewidth}%
    \begin{list}{}{%
    \itemindent=\FOstartindent
-   \leftmargin=\FOprovisionaldistancebetweenstarts
+   \PercentToDimen{\FOprovisionaldistancebetweenstarts}%
+   \leftmargin=\@tempdima\relax
    \advance\leftmargin by \FOmarginleft
    \rightmargin=\FOmarginright
-   \labelwidth=\FOprovisionaldistancebetweenstarts
+   \labelwidth=\@tempdima\relax
    \advance\labelwidth by -\FOprovisionallabelseparation
    \expandafter\csname List\FOtextalign\endcsname
    \labelsep\FOprovisionallabelseparation
    \itemsep\z@
    \parsep\z@
+   \partopsep\z@
    \topsep\z@
    \parskip\z@
    \ifx\@empty\FOspacebefore
@@ -1156,11 +1151,13 @@
     \else
       \topsep\FOspacebefore
     \fi
-   }
-   }
-  {\end{list}
-   \advance\FOinList by -1
-   \par
+   }%
+   \edef\This@LineWidth{\the\linewidth}%
+  }
+  {\end{list}%
+   \global\linewidth\This@LineWidth\relax
+   \advance\FOinList by -1\relax
+%   \par
   }
 
 \XMLelement{fo:list-item-body}
@@ -1168,8 +1165,9 @@
   {\ifx\FOstartindent\att@bodystart
      \let\FOstartindent\z@
    \fi
-   \FOListBodytrue\FOListBlocks0}
-  {}
+   \edef\This@FOListBlocks{\the\FOListBlocks}%
+   \FOListBodytrue\global\FOListBlocks0}
+  {\global\FOListBlocks\This@FOListBlocks\relax}
 
 \XMLelement{fo:list-item-label}
   {}
@@ -1184,8 +1182,7 @@
 
 \XMLelement{fo:list-item}
   {\SpaceAttributes}
-  {
-   \FOSetHyphenation
+  {\FOSetHyphenation
    \ifx\@empty\FOspacebefore
       \@tempdima\FOspacebeforeoptimum
       \advance\@tempdima by -\FOspacebeforeminimum
@@ -1193,7 +1190,7 @@
       \advance\@tempdimb by \FOspacebeforemaximum
       \vskip\FOspacebeforeoptimum plus \@tempdimb minus \@tempdima
     \else
-      \vskip\FOspacebefore
+      \ifdim\FOspacebefore=0pt\relax\else\vskip\FOspacebefore\fi
     \fi
    \FOlabel}
   {}
@@ -1316,6 +1313,7 @@
        \end{sidewaystable}
       \fi
    \fi
+   \NoTableFinish
   }
 
 \XMLelement{fo:table-body}
@@ -1323,6 +1321,7 @@
   {
    \FOFirstCelltrue
    \FOinTable1
+   \saveinterlineskip
    \expandafter\NoTableStart{\TableHeader}%
  }
 {
@@ -1346,11 +1345,14 @@
   {\xmlgrab}
   {\FOlabel
   \FOexpandattributes
+  \FOinTable2
   \NoTableCell{#1}}
 
 
 \XMLelement{fo:table-column}
- {}
+ {
+   \XMLattributeX{text-align}{\FOtextalign}{\inherit}
+ }
  { 
   \@tempcnta0
   \loop\ifnum\FOnumbercolumnsrepeated>\@tempcnta
@@ -1373,14 +1375,20 @@
 \XMLelement{fo:table}
   {}
   {
+   \FOexpandattributes
    \global\ColSpecs={}\NCols0
    \TableWidth\linewidth
    \advance\TableWidth by -\FOmarginleft
    \advance\TableWidth by -\FOmarginright
    \gdef\TableHeader{}
    \NoTableSetup
+   \vbox\bgroup\FOBorderTop
+% 	\vskip2\lineskip
+
+  }
+  {\FOBorderBottom\egroup
+   \NoTableFinish
   }
-  {}
 
 \XMLelement{fo:inline}
   {}
@@ -1439,13 +1447,13 @@
  {\xmlgrab}
  {\begingroup
        \utfeight@protect@chars
-\ifx\FOretrieveposition\FirstOnPage
-   \xdef\FOthismark{\topmark}%
+\ifx\FOretrieveposition\att@first@starting@within@page
+   \xdef\FOthismark{\firstmark}%
 \else
-   \ifx\FOretrieveposition\LastOnPage
+   \ifx\FOretrieveposition\att@last@starting@within@page
        \xdef\FOthismark{\botmark}%
    \else
-       \xdef\FOthismark{\topmark}%
+       \xdef\FOthismark{\firstmark}%
    \fi
 \fi
        \xdef\FOthisretrieveclassname{\FOretrieveclassname}
@@ -1500,21 +1508,23 @@
 
 \XMLelement{fo:page-sequence-master}
   {}
-  {
+  {\global\SimplePMRefs0\relax
    \DEBUG{Page sequence master: \FOmastername}
    \let\Granpa\FOmastername
   }
-  {}
+  {\global\SimplePMRefs0\relax}
 
 \XMLelement{fo:single-page-master-reference}
    {}
-   {\DEBUG{ (single page in \Granpa: use master \FOmasterreference)}
+   {\global\advance\SimplePMRefs1\relax
+	\DEBUG{ (single page \the\SimplePMRefs\space in \Granpa: use master \FOmasterreference)}
     \begingroup
     \utfeight@protect@chars
-     \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
-     \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
-     \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
-     \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
+      \expandafter\xdef\csname Lead:\the\SimplePMRefs:\Granpa\endcsname{\FOmasterreference}
+%     \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
+%     \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
+%     \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
+%     \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
     \endgroup
     }
    {}
@@ -1524,10 +1534,10 @@
    {\DEBUG{ (multiple pages in \Granpa: use master \FOmasterreference)}
     \begingroup
      \utfeight@protect@chars
-    \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
-    \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
-    \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
-    \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
+%    \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
+%    \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
+     \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
+%    \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
     \endgroup
    }
    {}
@@ -1603,18 +1613,18 @@
     \expandafter\xdef\csname\FOMaster:after-extent\endcsname{\FOextent}
     }
   { 
- \ifdim\InnerTopMargin>\FOmargintop\def\FOmargintop{\InnerTopMargin}\fi
- \ifdim\InnerBottomMargin>\FOmarginbottom\def\FOmarginbottom{\InnerBottomMargin}\fi
- \ifdim\InnerRightMargin>\FOmarginright\def\FOmarginright{\InnerRightMargin}\fi
- \ifdim\InnerLeftMargin>\FOmarginleft\def\FOmarginleft{\InnerLeftMargin}\fi
+% \ifdim\InnerTopMargin>\FOmargintop\def\FOmargintop{\InnerTopMargin}\fi
+% \ifdim\InnerBottomMargin>\FOmarginbottom\def\FOmarginbottom{\InnerBottomMargin}\fi
+% \ifdim\InnerRightMargin>\FOmarginright\def\FOmarginright{\InnerRightMargin}\fi
+% \ifdim\InnerLeftMargin>\FOmarginleft\def\FOmarginleft{\InnerLeftMargin}\fi
  \DEBUG{Define page master \FOmargin, \FOMaster, \FOmarginright/\FOmarginleft}
     \begingroup
      \utfeight@protect@chars
     \expandafter\xdef\csname Atomic:\FOMaster\endcsname{
-     \MasterTopMargin\FOmargintop
-     \MasterBottomMargin\FOmarginbottom
-     \MasterRightMargin\FOmarginright
-     \MasterLeftMargin\FOmarginleft
+     \MasterTopMargin\FOmargintop\advance\MasterTopMargin\InnerTopMargin\relax
+     \MasterBottomMargin\FOmarginbottom\advance\MasterBottomMargin\InnerBottomMargin\relax
+     \MasterRightMargin\FOmarginright\advance\MasterRightMargin\InnerRightMargin\relax
+     \MasterLeftMargin\FOmarginleft\advance\MasterLeftMargin\InnerLeftMargin\relax
      \paperwidth\FOpagewidth
      \paperheight\FOpageheight
     }
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/index.xml tetex-src-2.0.1/xmltex/contrib/passivetex/index.xml
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/index.xml	1970-01-01 01:00:00.000000000 +0100
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/index.xml	2003-02-14 00:00:00.000000000 +0100
@@ -0,0 +1,420 @@
+<?xml version="1.0"?>
+<!DOCTYPE TEI.2 SYSTEM "http://www.oucs.ox.ac.uk/dtds/tei-oucs.dtd" [
+ <!ENTITY properties SYSTEM "properties.xml">
+]>
+<TEI.2>
+  <teiHeader>
+    <fileDesc>
+      <titleStmt>
+        <title>PassiveTeX</title>
+      </titleStmt>
+      <publicationStmt>
+        <p> </p>
+      </publicationStmt>
+      <sourceDesc>
+        <p></p>
+      </sourceDesc>
+    </fileDesc>
+    <revisionDesc>
+      <list>
+        <item><date>2003/02/14</date>version 1.23 </item>
+        <item><date>2003/02/04</date>version 1.22 </item>
+        <item><date>2002/09/16</date>version 1.21 </item>
+        <item><date>2002/09/14</date>version 1.20 </item>
+        <item><date>2002/08</date>version 1.19 </item>
+        <item><date>2002/06/25</date>version 1.18 </item>
+        <item><date>2002/02/08</date>version 1.12 </item>
+        <item><date>2001/12/04</date>version 1.11 </item>
+        <item><date>2001/12/02</date>version 1.10 </item>
+        <item><date>2001/11/29</date>version 1.9 </item>
+        <item><date>2001/11/19</date>version 1.8 </item>
+        <item><date>2001/06/19</date>version 1.7 </item>
+        <item><date>2001/04/02</date>version 1.6 </item>
+        <item><date>2001/01/04</date>version 1.4 </item>
+        <item><date>2000/12/10</date>version 1.3 </item>
+        <item><date>2000/11/23</date>version 1.3 </item>
+        <item><date>2000/10/04</date>version 1.1 </item>
+        <item><date>2000/09/13</date>A couple of changes to property list</item>
+        <item><date>2000/09/12</date>Notes on memory sizes</item>
+        <item><date>2000/06/24</date>Checking links</item>
+        <item><date>2000/05/30</date>Added conformance and dependency notes</item>
+        <item><date>2000/02/07</date>Second version</item>
+        <item><date>1999/08/08</date>First version, authored in TEI XML</item>
+      </list>
+    </revisionDesc>
+  </teiHeader>
+  <text>
+<front>
+<titlePage>
+<docTitle>
+ <titlePart type="main">PassiveTeX</titlePart>
+</docTitle>
+<docAuthor>Sebastian Rahtz</docAuthor>
+<docDate>February 2003</docDate>
+</titlePage>
+</front>
+<body>
+<div>
+<head>Summary</head>
+<list type="unordered">
+<item>
+PassiveTeX is a library of TeX macros which can be used to process an XML
+document which results from an XSL transformation to formatting objects. 
+</item>
+<item>
+PassiveTeX provides a rapid development environment for experimenting
+with XSL FO, using a reliable pre-existing formatter
+</item>
+<item>
+Running PassiveTeX with the pdfTeX variant of TeX generates high-quality
+PDF files in a single operation.
+</item>
+<item>
+PassiveTeX shows how TeX can remain the formatter of choice for XML, while
+hiding the details of its operation from the user.
+</item>
+</list>
+</div>
+<div><head>How does it work?</head>
+<p>
+PassiveTeX relies heavily on work by David Carlisle
+(his namespace-aware XML parser written in 
+TeX, <code>xmltex</code>), and was developed from my
+<xref url="http://www.tug.org/applications/jadetex/">JadeTeX</xref>
+macros for processing DSSSL via Jade.
+</p>
+<p>
+Taking the XML version of the TEI Lite guidelines
+(<xref url="test/teiu5.xml">teiu5.xml</xref>, with DTD
+<xref url="/Lite/DTD/teixlite.dtd">teixlite.dtd</xref>), we apply an XSL stylesheet
+(see my page of <xref url="/Stylesheets/teixsl.html">TEI style sheets</xref>),
+and run it through Mike Kay's Saxon XSL processor:
+<eg>
+  java com.icl.saxon.StyleSheet -o teiu5.fo teiu5.xml tei.xsl 
+</eg>
+(assuming you have <code>saxon.jar</code> and <code>sax.jar</code>
+on your CLASSPATH). This creates the new XML file
+<xref url="test/teiu5.fo">teiu5.fo</xref>. We now run XMLTeX on this
+<eg>
+ pdfxmltex teiu5.fo
+</eg>
+which creates <xref url="test/teiu5.pdf">teiu5.pdf</xref>. Voila! 
+Actually, we need to do
+<eg>
+ pdfxmltex teiu5.fo
+</eg>
+again, to resolve page-number references in the table of contents. For a comparison
+with an HTML rendering of the same document (using XSL again),
+see <xref url="/Lite/teiu5.html">teiu5.html</xref>
+on the TEI pages. </p>
+</div>
+<div>
+<head>Installation</head>
+<p>
+The PassiveTeX macros should be downloaded (as a ZIP file,
+<xptr url="passivetex.zip"/>), unpacked, and installed in a TeX system (eg in 
+<code>texmf/tex/latex/passivetex</code>) in the normal place where you put
+macros. Consult your local documentation or local expert if you do not know
+how to install a new package; on a web2c-based system, don't forget to
+	  run <code>mktexlsr</code> when you have the files in place,
+	  to update the file lookup table.
+</p>
+<p>
+What about that <code>pdfxmltex</code> command we saw in the last section? 
+You don't have it on your system? You need to download 
+<xref url="ftp://ftp.tex.ac.uk/tex-archive/macros/xmltex/base.zip">xmltex</xref> 
+(that link gives you a ZIP archive of the system) and install it in the your TeX system.
+It too is just a set of TeX macro packages. 
+<hi>IMPORTANT NOTE. You need a
+copy of xmltex.tex latex than 2001/11/30.</hi></p>
+
+<p>
+Now you can use xmltex on a file called (eg) <code>teiu5.fo</code> in one of two ways:
+<list type="ordered">
+<item>Build an <code>xmltex</code> format file for pdfTeX with
+<eg>
+pdftex -ini "&amp;pdflatex" pdfxmltex.ini
+</eg>
+and process your file with
+<eg>
+pdflatex "&amp;pdfxmltex" teiu5.fo
+</eg>
+The command <code>pdfxmltex</code> used above is just a script
+which does
+<eg>
+tex -fmt=pdfxmltex -progname=pdfxmltex
+</eg>
+Or,
+</item>
+<item>
+Make a wrapper file called (eg) <code>teiu5.tex</code> looking like this:
+<eg>
+\def\xmlfile{teiu5.fo}
+\input xmltex
+</eg>
+and run pdfTeX on it as normal with
+<eg>
+pdflatex teiu5.tex
+</eg> 
+</item>
+</list>
+Do not worry, <code>xmltex</code> knows how to find the PassiveTeX macros as
+it needs them. You will likely need to increase TeX memory
+values (in the file <code>texmf.cnf</code> if you use a Web2c-based TeX);
+I use:
+<eg>
+main_memory = 2500000
+param_size = 1500
+stack_size = 1500
+hash_extra = 50000
+string_vacancies = 45000
+pool_free = 47500
+nest_size = 500
+save_size = 10000
+pool_size = 500000
+max_strings = 55000
+</eg>
+</p>
+
+<p>
+For reference, the PassiveTeX package consists of the following files:
+<list>
+<item>The core xmltex `style' files for XSL FO XML:
+<eg>
+ fotex.xmt
+ fotex.sty
+</eg>
+</item>
+<item>
+Support for direct formatting of TEI XML with xmltex
+<eg>
+ tei.xmt        
+ teixml.sty
+</eg>
+</item>
+<item>
+Some support files, shared with JadeTeX:
+<eg>
+ unicode.sty
+ ucharacters.sty
+ mlnames.sty 
+ dummyels.sty
+ nomulticol.sty
+</eg>
+</item>
+</list>
+</p>
+<p>
+NOTE: TeX has a limit
+on the length of line it can read, 
+and some .fo files you generate may cause
+TeX to die with an message about increasing buf_size. 
+If you get that, edit your
+<code>texmf.cnf</code> file,  increase the size of <code>buf_size</code> (mine is
+200000), and remake any format files.
+</p>
+<div><head>LaTeX package dependencies</head>
+<p>This setup assumes you have a decent modern TeX setup. The TeX Live 6 CD-ROM
+is what I use, and it is up to date 
+(see <xptr url="http://www.tug.org/texlive/"/>).
+</p>
+<p> Here is a
+	    list of the packages loaded in a typical run of
+	    PassiveTeX, with their version numbers where known:
+<table  rend="rules">
+<row><cell>  amsbsy.sty </cell><cell>   1999/11/29 v1.2d</cell></row>
+<row><cell>amsfonts.sty </cell><cell>   1997/09/17 v2.2e</cell></row>
+<row><cell>  amsgen.sty </cell><cell>   1999/11/30 v2.0</cell></row>
+<row><cell> amsmath.sty </cell><cell>   2000/03/29 v2.08 AMS math features</cell></row>
+<row><cell>  amsopn.sty </cell><cell>   1999/12/14 v2.01 operator names</cell></row>
+<row><cell> amssymb.sty </cell><cell>   1996/11/03 v2.2b</cell></row>
+<row><cell> amstext.sty </cell><cell>   1999/11/15 v2.0</cell></row>
+<row><cell>   array.sty </cell><cell>   1998/05/13 v2.3m Tabular extension package (FMi)</cell></row>
+<row><cell> article.cls </cell><cell>   1999/09/10 v1.4a Standard LaTeX document class</cell></row>
+<row><cell>      bm.sty </cell><cell>   1999/07/05 v1.0g Bold Symbol Support (DPC/FMi)</cell></row>
+<row><cell>   color.sty </cell><cell>   1999/02/16 v1.0i Standard LaTeX Color (DPC)</cell></row>
+<row><cell> fontenc.sty </cell><cell>   (version not available)</cell></row>
+<row><cell>graphics.sty </cell><cell>   1999/02/16 v1.0l Standard LaTeX Graphics (DPC,SPQR)</cell></row>
+<row><cell>graphicx.sty </cell><cell>   1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)</cell></row>
+<row><cell> hpdftex.def </cell><cell>   2000/05/08 v6.70f Hyperref driver for pdfTeX</cell></row>
+<row><cell>hyperref.sty </cell><cell>   2000/05/08 v6.70f Hypertext links for LaTeX</cell></row>
+<row><cell>  ifthen.sty </cell><cell>   1999/09/10 v1.1b Standard LaTeX ifthen package (DPC)</cell></row>
+<row><cell>  keyval.sty </cell><cell>   1999/03/16 v1.13 key=value parser (DPC)</cell></row>
+<row><cell>longtable.sty </cell><cell>   1998/05/13 v4.09 Multi-page Table package (DPC)</cell></row>
+<row><cell>multicol.sty </cell><cell>   1999/10/21 v1.5w multicolumn formatting (FMi)</cell></row>
+<row><cell> nameref.sty </cell><cell>   2000/05/08 v2.18 Cross-referencing by name of section</cell></row>
+<row><cell>  ot1phv.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 scalable font definitions for OT1/phv.</cell></row>
+<row><cell>  pd1enc.def </cell><cell>   2000/05/08 v6.70f Hyperref: PDFDocEncoding definition (HO)</cell></row>
+<row><cell>  pifont.sty </cell><cell>   2000/01/12 PSNFSS-v8.1 Pi font support (SPQR) </cell></row>
+<row><cell>rotating.sty </cell><cell>   1997/09/26, v2.13 Rotation package</cell></row>
+<row><cell>  size10.clo </cell><cell>   1999/09/10 v1.4a Standard LaTeX file (size option)</cell></row>
+<row><cell>stmaryrd.sty </cell><cell>   1994/03/03 St Mary's Road symbol package</cell></row>
+<row><cell>   t1enc.def </cell><cell>   1999/12/08 v1.9x Standard LaTeX file</cell></row>
+<row><cell>   t1phv.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 scalable font definitions for T1/phv.</cell></row>
+<row><cell>   t1ptm.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for T1/ptm.</cell></row>
+<row><cell>  t2acmr.fd </cell><cell>   1999/01/07 v1.0 Computer Modern Cyrillic font definitions</cell></row>
+<row><cell>  t2aenc.def </cell><cell>   1999/11/29 v1.0c Cyrillic encoding definition file</cell></row>
+<row><cell>   t3enc.def </cell><cell>   (version not available)</cell></row>
+<row><cell>textcomp.sty </cell><cell>   1999/12/08 v1.9x Standard LaTeX package</cell></row>
+<row><cell>   times.sty </cell><cell>   2000/01/12 PSNFSS-v8.1 Times font as default roman (SPQR) </cell></row>
+<row><cell>    tipa.sty </cell><cell>   1996/06/10 TIPA version 1.0</cell></row>
+<row><cell>    trig.sty </cell><cell>   1999/03/16 v1.09 sin cos tan (DPC)</cell></row>
+<row><cell>  ts1cmr.fd </cell><cell>   1999/05/25 v2.5h Standard LaTeX font definitions</cell></row>
+<row><cell>  ts1enc.def </cell><cell>   1998/06/12 v3.0d (jk/car/fm) Standard LaTeX file</cell></row>
+<row><cell>  ts1ptm.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for TS1/ptm.</cell></row>
+<row><cell>    ulem.sty </cell><cell>   1997/04/21</cell></row>
+<row><cell>    umsa.fd </cell><cell>   1995/01/05 v2.2e AMS font definitions</cell></row>
+<row><cell>    umsb.fd </cell><cell>   1995/01/05 v2.2e AMS font definitions</cell></row>
+<row><cell>    upsy.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for U/psy.</cell></row>
+<row><cell>    upzd.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for U/pzd.</cell></row>
+<row><cell>     url.sty </cell><cell>   1999/03/28  ver 1.5x  Verb mode for urls, etc.</cell></row>
+<row><cell>  Ustmry.fd </cell><cell>  (version not available)</cell></row>
+<row><cell>   uwasy.fd </cell><cell>   1999/05/13 v1.0iWasy-2 symbol font definitions</cell></row>
+<row><cell> wasysym.sty </cell><cell>   1999/05/13 v1.0i Wasy-2 symbol support package</cell></row>
+</table>
+</p>
+</div>
+</div>
+<div>
+<head>LICENSE</head>
+<p>Copyright 2003 Sebastian Rahtz/Oxford University 
+(sebastian.rahtz@oucs.ox.ac.uk)</p>
+
+<p>Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and any associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:</p>
+
+<p>The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.</p>
+   </div>
+
+<div>
+<head>Extensions</head>
+<p>
+PassiveTeX interprets MathML natively (elements must use the MathML namespace).
+I also support a <code>bookmark</code> element in the
+<code>fotex</code> namespace, used to make PDF bookmarks. Usage is like this:
+<eg>
+&lt;xsl:template match="div2">
+     &lt;xsl:apply-templates select="head"/>
+     &lt;fotex:bookmark  
+	xmlns:fotex="http://www.tug.org/fotex" 
+	fotex-bookmark-level="2"
+	fotex-bookmark-label="{@id}">
+        &lt;xsl:value-of select="head"/>
+     &lt;/fotex:bookmark>
+  &lt;/fo:block>
+&lt;/xsl:template>
+</eg>
+</p>
+</div>
+
+
+<div>
+<head>Notes on conformance to the XSL specification</head>
+&properties;
+</div>
+
+<div>
+<head>Sample files</head>
+<p>
+<list>
+<item> The TEI Lite description (<xref
+url="test/teiu5.xml">teiu5.xml</xref>) converted PDF as <xref
+url="test/teiu5.pdf">teiu5.pdf</xref></item>
+<item> A TEI test file  (<xref
+url="test/exercise.xml">exercise.xml</xref>) 
+converted to PDF as <xref
+url="test/exercise.pdf">exercise.pdf</xref></item>
+<item> A physics paper (<xref url="test/teimath.xml">teimath.xml</xref>) containing a fair
+     amount of MathML markup, originally
+     translated from LaTeX into XML.
+     It is used extensively as an example in the
+     <xref url="http://cseng.awl.com/bookpage.taf?ISBN=0-201-43311-7&amp;ptype=0&amp;catid=&amp;navmin=&amp;ctype=author&amp;catpage=&amp;seriesid=">LaTeX Web Companion</xref>.
+Here we see it
+      converted to <xref url="test/teimath.pdf">teimath.pdf</xref> using
+      <xref url="test/teimath.xsl">test/teimath.xsl</xref></item>
+<item> James Tauber prepared a simple XSL spec (<xref
+url="test/darkness.xsl">darkness.xsl</xref>) for Joseph Conrad's 
+<xref url="test/darkness.xml"><emph>Heart of
+Darkness</emph></xref>, which I ran to PDF as <xref
+url="test/darkness.pdf">darkness.pdf</xref></item>
+</list>
+</p>
+</div>
+  
+<div>
+<head>Concerns and problems</head>
+<p>
+Some points to bear in mind
+<list type="ordered">
+  <item> This is an experimental system to check whether the
+       idea works. Expect something more polished eventually.</item>
+  <item> You need a modern TeX setup (like
+    <xref url="http://www.tug.org/teTeX/">teTeX</xref> or
+   <xref url="http://www.tug.org/texlive/">TeX Live</xref>) 
+to get to grips with it.</item>
+  <item> Quite a few flow objects and characteristics are not dealt with yet.
+       I will add support for more things as needed or requested.</item>
+  <item> I do not have any objective check that what I think XSL FOs are
+       supposed to do is actually right :-}</item>
+  <item> I have only worked so far with the TEI Lite (XML version) and
+    Docbook DTDs,  and probably misinterpreted half of what they say.</item>
+</list>
+</p>
+</div>
+
+<div>
+<head>Things for LaTeX users to remember</head>
+<p>
+<list type="unordered">
+<item> No use is made of LaTeX high-level constructs. No sections,
+  no lists, no cross-refs, no bibliographies; on the other hand, 
+ some extensions in the <code>fotex:</code> namespace are supported 
+(eg to get Acrobat bookmarks)
+</item>
+<item> XSL FO's underlying character set is Unicode; by default,
+  entities are mapped to their Unicode position;
+</item>
+<item> All vertical and horizontal space is explicit in the
+  specification
+</item>
+<item> Page and line breaking is left to TeX: the rest is up to you.
+</item>
+</list>
+</p>
+</div>
+
+<div>
+<head>Future directions</head>
+<p>
+<list type="unordered">
+<item>Complete the MathML handling</item>
+<item>Handle more variety in property values (eg colors, fonts) </item>
+<item>Deal with more complex tables</item>
+<item>Support SVG. How?
+ <list type="unordered">
+   <item>By direct intepretation and mapping to raw PDF</item>
+   <item>By translation to MetaPost, and spawning a MetaPost process</item>
+   <item>By pre-processing to existing TeX graphics languages</item>
+ </list>
+In any case, SVG fragments need to be recognized directly to perform in-line
+graphical functions (setting text at an angle?)
+</item>
+<item>Use Unicode-based TeX variant (Omega) to handle non-Latin material
+more naturally</item>
+</list>
+</p>
+<p>
+I will be very glad to discuss details with anyone. Contact me (Sebastian Rahtz) as
+<xref url="mailto:sebastian.rahtz@oucs.ox.ac.uk">sebastian.rahtz@oucs.ox.ac.uk</xref>
+</p>
+</div>
+</body>
+</text>
+</TEI.2>
+
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/mlnames.sty tetex-src-2.0.1/xmltex/contrib/passivetex/mlnames.sty
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/mlnames.sty	2002-06-25 22:51:00.000000000 +0200
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/mlnames.sty	2003-02-11 00:00:00.000000000 +0100
@@ -1,10 +1,10 @@
-%% File: $Id: //depot/Master/texmf/tex/xmltex/passivetex/mlnames.sty#20 $ $Date: 2002/06/25 $  Copyright 1999 Sebastian Rahtz
+%% File: $Id: //TEI/web/Software/passivetex/mlnames.sty#17 $ $Date: 2003/02/11 $  Copyright 1999 Sebastian Rahtz
 %%
 %% This package may be distributed under the terms of the LaTeX Project Public
 %% License, as described in lppl.txt in the base LaTeX distribution.
 %% Either version 1.0 or, at your option, any later version.
 %%
-\ProvidesPackage{mlnames}[2001/01/10, some XSL and Unicode support material, Sebastian Rahtz]
+\ProvidesPackage{mlnames}[2002/07/31, some XSL and Unicode support material, Sebastian Rahtz]
 %
 \DeclareFontFamily{T1}{pzd}{}  
 \DeclareFontShape{T1}{pzd}{m}{n}{<->pzdr}{} 
@@ -137,7 +137,7 @@
 \def\Weight@medium{}
 \def\Weight@normal{}
 \def\Weight@semibold{sb}
-\def\Weight@bold{bx}
+\def\Weight@bold{b}
 \def\Weight@extrabold{eb}
 \def\Weight@ultrabold{ub}
 \def\Weight@false{}
@@ -252,6 +252,8 @@
 \def\L@SH{\selectlanguage{serbocroat}}
 \def\L@SI{\selectlanguage{slovene}}
 \def\L@SK{\selectlanguage{slovak}}
+\expandafter\def\csname L@en_GB\endcsname{\selectlanguage{ukenglish}}
+\expandafter\def\csname L@en_US\endcsname{\selectlanguage{english}}
 \def\L@US{\selectlanguage{english}}
 \def\L@none{\selectlanguage{english}}
 \def\L@br{\selectlanguage{portuguese}}
@@ -351,9 +353,16 @@
 \let\Q@justify\Q@justified
 \let\startQ@\startQ@justified
 \let\endQ@\endQ@justified
+
 \def\Q@end{% raggedleft, I hope
+%  \let\newline\@centercr
+%  \leftskip\StartIndent plus 1fill%
+%  \parfillskip\z@skip
+%
   \let\newline\@centercr
-  \leftskip\StartIndent plus 1fil%
+  \leftskip\StartIndent plus 1fill %
+  \rightskip\EndIndent
+  \@rightskip\rightskip
   \parfillskip\z@skip
 }
 \def\Q@centered{%
@@ -365,9 +374,9 @@
 }
 \def\Q@center{%
   \let\newline\@centercr
-  \rightskip-\StartIndent plus 1fil%
+  \rightskip-\StartIndent plus 1fill%
   \@rightskip\rightskip
-  \leftskip-\EndIndent plus 1fil%
+  \leftskip-\EndIndent plus 1fill%
   \parfillskip\z@skip
 }
 \let\Q@left\Q@start
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/nomulticol.sty tetex-src-2.0.1/xmltex/contrib/passivetex/nomulticol.sty
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/nomulticol.sty	1970-01-01 01:00:00.000000000 +0100
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/nomulticol.sty	2003-01-10 00:00:00.000000000 +0100
@@ -0,0 +1,1065 @@
+%%
+%% This is file `nomulticol.sty',
+%% a tweak in package multicol.sty [2000/07/10 v1.5z  multicolumn formatting (FMi)]
+%% Tweaked by Dirk Roorda 2003/01/09
+%%
+%% purpose: to have the \begin{multicols} \end{multicols} functionality without
+%% putting the material inside a group
+%%
+%% reason: in PassiveTeX a fo:flow is embedded in a multicols environment.
+%% But the fo:block span="all" must be able to interrupt this.
+%% However, sayin \end{multicols} just before and \begin{multicols}{N} just after
+%% does not work, because it makes the attributes, set between the start of the flow
+%% and the beginning of the block, invisible.
+%% That's why a grouping-transparent multicol setup is needed.
+%%
+%% method:
+%% providing macros \nobeginmulticols \noendmulticols that do essentially the same
+%% but do not create a group.
+%% I just removed the crucial \begingroup and \endgroup from \mult@@cols and \endmulticols.
+%% Instead of relying on the TeX group restore mechanism, I have added macros
+%% \save@mult@settings and \restore@mult@settings to mimick the grouping as far
+%% as the settings for the multicol package are concerned.
+
+%%
+%% This is file `multicol.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% multicol.dtx  (with options: `package,badness,check,marktrace,nobalance,colbreak')
+%% 
+%% This is a generated file.
+%% 
+%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000
+%% The LaTeX3 Project and any individual authors listed elsewhere
+%% in this file.
+%% 
+%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
+%% --------------------------------------------------------------------------
+%% 
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.2
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%    http://www.latex-project.org/lppl.txt
+%% and version 1.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%% 
+%% This file may only be distributed together with a copy of the LaTeX
+%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
+%% without such generated files.
+%% 
+%% The list of all files belonging to the LaTeX `Tools Bundle' is
+%% given in the file `manifest.txt'.
+%% 
+%% Package `multicol' to use with LaTeX2e
+%% Copyright 1989-2000 Frank Mittelbach
+%%
+%%  In addition to the terms of LPPL any distributed version
+%%  (unchanged or modified) of multicol has to keep the statement
+%%  about the moral obligation for using multicol. In case of major
+%%  changes where this would not be appropriate the author of the
+%%  changed version should contact the copyright holder.
+%%
+%%
+%%  Moral obligation for using multicol:
+%%  ------------------------------------
+%%
+%%  Users of multicol who wish to include or use multicol or a modified
+%%  version in a proprietary and commercially market product are asked
+%%  under certain conditions (see below) for the payment of a license
+%%  fee.  The size of this fee is to be determined, in each instance,
+%%  by the commercial user, depending on his/her judgment of the value of
+%%  multicol for his/her product.
+%%
+%%
+%%  The conditions for this are as follows:
+%%
+%%   The producer of a proprietary and commercially market product
+%%   that involves typesetting using multicol is asked to determine
+%%   the value of a license fee for using multicol if
+%%
+%%   - the product is a document and the producer has decided to
+%%     include multicol to typeset (parts of) the document or has
+%%     directed the author of the document to include multicol (for
+%%     example, by providing a class file to be used by the author)
+%%
+%%   - the product is a LaTeX class or package that includes multicol
+%%
+%%
+%%   There is no moral obligation in case
+%%
+%%   - the product is a document but producer has not directed
+%%     the author to include multicol (in that case the moral obligation
+%%     lies with the author of the document)
+%%
+%%   - the product does not involve typesetting, e.g., consists, for
+%%     example, of distributing multicol and its documentation.
+%%
+%%   - the product is not proprietary, i.e., is made available as free
+%%     software itself (which doesn't prohibit its commercial marketing)
+%%
+%%   - multicol is used for non-commercial purposes
+%%
+%%
+%% Determinating a license fee might result in a license fee of zero
+%% (i.e., no payment) in case a producer has determined that the use
+%% of multicol has no enhancing effect on the product. This is a
+%% plausible scenario, i.e., in the above two cases the producer is
+%% only asked to evaluate the value of multicol for the product
+%% not for the payment of a license fee per se (which might or might
+%% not follow from this evaluation).
+%%
+%% The license fee, if any, can be payed either to the LaTeX3 fund
+%% (see ltx3info.txt in the base LaTeX distribution) or to the author of
+%% the program who can be contacted at
+%%
+%%     Frank.Mittelbach@latex-project.org
+%%
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{nomulticol}
+          [2003/01/09 v1.5z  multicolumn formatting (FMi)]
+%% \CheckSum{1451}
+%% \CharacterTable
+%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%%
+\DeclareOption{twocolumn}
+   {\PackageWarning{nomulticol}{May not work
+             with the twocolumn option}}
+\newcount\c@tracingmulticols
+\DeclareOption{errorshow}
+    {\c@tracingmulticols\z@}
+\DeclareOption{infoshow}
+    {\c@tracingmulticols\@ne}
+\DeclareOption{balancingshow}
+    {\c@tracingmulticols\tw@}
+\DeclareOption{markshow}
+    {\c@tracingmulticols\thr@@}
+\DeclareOption{debugshow}
+    {\c@tracingmulticols5\relax}
+\ProcessOptions
+
+%%
+%% Start Additions by Dirk Roorda
+%%
+
+\def\show@mult@settings{%
+   \typeout{LINEWIDTH=SAVED=\sav@linewidth; CURRENT=\the\linewidth}%
+   \typeout{COLUMNWIDTH=SAVED=\sav@columnwidth; CURRENT=\the\columnwidth}%
+   \typeout{FULL@WIDTH=SAVED=\sav@full@width; CURRENT=\the\full@width}%
+   \typeout{HSIZE=SAVED=\sav@hsize; CURRENT=\the\hsize}%
+   \typeout{VSIZE=SAVED=\sav@vsize; CURRENT=\the\vsize}%
+   \typeout{BASELINESKIP=SAVED=\sav@baselineskip; CURRENT=\the\baselineskip}%
+   \typeout{EMERGENCYSTRETCH=SAVED=\sav@emergencystretch; CURRENT=\the\emergencystretch}%
+   \typeout{PRETOLERANCE=SAVED=\sav@pretolerance; CURRENT=\the\pretolerance}%
+   \typeout{TOLERANCE=SAVED=\sav@tolerance; CURRENT=\the\tolerance}%
+   \typeout{HBADNESS=SAVED=\sav@hbadness; CURRENT=\the\hbadness}%
+   \typeout{VBADNESS=SAVED=\sav@vbadness; CURRENT=\the\vbadness}%
+   \typeout{PARSHAPE=SAVED=\sav@parshape; CURRENT=\the\parshape}%
+   \typeout{@TOTALLEFTMARGIN=SAVED=\sav@totalleftmargin; CURRENT=\the\@totalleftmargin}%
+   \typeout{MULTICOL@LEFTMARGIN=SAVED=\sav@multicol@leftmargin; CURRENT=\the\multicol@leftmargin}%
+   \typeout{@COLROOM=SAVED=\sav@colroom; CURRENT=\the\@colroom}%
+   \typeout{DOUBLECOL@NUMBER=SAVED=\sav@doublecol@number; CURRENT=\the\doublecol@number}%
+   \typeout{@TEMPDIMA=SAVED=\sav@tempdima; CURRENT=\the\@tempdima}%
+   \typeout{FOOTINS=SAVED=\sav@count@footins; CURRENT=\the\count\footins}%
+   \typeout{FOOTINS=SAVED=\sav@skip@footins; CURRENT=\the\skip\footins}%
+%
+   \typeout{COL@NUMBER=SAVED=\sav@col@number; CURRENT=\the\col@number}%
+   \typeout{PAGE@FREE=SAVED=\sav@page@free; CURRENT=\the\page@free}%
+   \typeout{@TEMPSKIPA=SAVED=\sav@tempskipa; CURRENT=\the\@tempskipa}%
+}
+
+\def\explain@mult@settings{%
+	\typeout{linewidth=\meaning\linewidth}%
+	\typeout{columnwidth=\meaning\columnwidth}%
+	\typeout{full-width=\meaning\full@width}%
+	\typeout{hsize=\meaning\hsize}%
+	\typeout{vsize=\meaning\vsize}%
+	\typeout{baselineskip=\meaning\baselineskip}%
+	\typeout{emergencystretch=\meaning\emergencystretch}%
+	\typeout{pretolerance=\meaning\pretolerance}%
+	\typeout{tolerance=\meaning\tolerance}%
+	\typeout{hbadness=\meaning\hbadness}%
+	\typeout{vbadness=\meaning\vbadness}%
+	\typeout{parshape=\meaning\parshape}%
+	\typeout{-totalleftmargin=\meaning\@totalleftmargin}%
+	\typeout{multicol-leftmargin=\meaning\multicol@leftmargin}%
+	\typeout{-colroom=\meaning\@colroom}%
+	\typeout{doublecol-number=\meaning\doublecol@number}%
+	\typeout{-tempdima=\meaning\@tempdima}%
+	\typeout{-tempskipa=\meaning\@tempskipa}%
+	\typeout{page-free=\meaning\page@free}%
+	\typeout{col-number=\meaning\col@number}%
+}
+
+\def\save@mult@settings{%
+   \xdef\sav@linewidth{\the\linewidth}%
+   \xdef\sav@columnwidth{\the\columnwidth}%
+   \xdef\sav@full@width{\the\full@width}%
+   \xdef\sav@hsize{\the\hsize}%
+   \xdef\sav@vsize{\the\vsize}%
+   \xdef\sav@baselineskip{\the\baselineskip}%
+   \xdef\sav@emergencystretch{\the\emergencystretch}%
+   \xdef\sav@pretolerance{\the\pretolerance}%
+   \xdef\sav@tolerance{\the\tolerance}%
+   \xdef\sav@hbadness{\the\hbadness}%
+   \xdef\sav@vbadness{\the\vbadness}%
+   \xdef\sav@parshape{\the\parshape}%
+   \xdef\sav@totalleftmargin{\the\@totalleftmargin}%
+   \xdef\sav@multicol@leftmargin{\the\multicol@leftmargin}%
+   \xdef\sav@colroom{\the\@colroom}%
+   \xdef\sav@doublecol@number{\the\doublecol@number}%
+   \xdef\sav@tempdima{\the\@tempdima}%
+   \xdef\sav@count@footins{\the\count\footins}%
+   \xdef\sav@skip@footins{\the\skip\footins}%
+   \global\let\sav@dblfloat\@dblfloat
+   \global\let\sav@end@dblfloat\end@dblfloat
+   \xdef\sav@output{\the\output}%
+   \global\let\sav@reserved@c\reserved@c
+%
+   \xdef\sav@col@number{\the\col@number}%
+   \xdef\sav@page@free{\the\page@free}%
+   \xdef\sav@tempskipa{\the\@tempskipa}%
+   \global\let\sav@reserved@a\reserved@a
+   \global\let\sav@reserved@b\reserved@b
+   \global\let\sav@reserved@d\reserved@d
+   \global\let\sav@let@token\@let@token
+   \global\let\sav@footnotetext\@footnotetext
+   \global\let\sav@orig@footnotetext\orig@footnotetext
+}
+
+\def\restore@mult@settings{%
+	\global\linewidth\sav@linewidth\relax
+	\global\columnwidth\sav@columnwidth\relax
+	\global\full@width\sav@full@width\relax
+	\global\hsize\sav@hsize\relax
+	\global\vsize\sav@vsize\relax
+	\global\baselineskip\sav@baselineskip\relax
+	\global\emergencystretch\sav@emergencystretch\relax
+	\global\pretolerance\sav@pretolerance\relax
+	\global\tolerance\sav@tolerance\relax
+	\global\hbadness\sav@hbadness\relax
+	\global\vbadness\sav@vbadness\relax
+	\global\parshape\sav@parshape\relax
+	\global\@totalleftmargin\sav@totalleftmargin\relax
+	\global\multicol@leftmargin\sav@multicol@leftmargin\relax
+	\global\@colroom\sav@colroom\relax
+	\global\doublecol@number\sav@doublecol@number\relax
+	\global\@tempdima\sav@tempdima\relax
+	\global\count\footins\sav@count@footins\relax
+	\global\skip\footins\sav@skip@footins\relax
+	\global\let\@dblfloat\sav@dblfloat
+	\global\let\end@dblfloat\sav@end@dblfloat
+	\global\expandafter\output\expandafter{\sav@output}%
+	\global\let\reserved@c\sav@reserved@c
+%
+	\global\col@number\sav@col@number\relax
+	\global\page@free\sav@page@free\relax
+	\global\@tempskipa\sav@tempskipa\relax
+	\global\let\reserved@a\sav@reserved@a
+	\global\let\reserved@b\sav@reserved@b
+	\global\let\reserved@d\sav@reserved@d
+	\global\let\@let@token\sav@let@token
+	\global\let\@footnotetext\sav@footnotetext
+	\global\let\orig@footnotetext\sav@orig@footnotetext
+}
+
+\def\nobeginmulticols#1{%
+\typeout{^^JSTART #1 COLUMNS}%
+	\save@mult@settings
+	\global\col@number#1\relax
+  \ifnum\col@number<\tw@
+     \PackageWarning{multicol}%
+      {Using `\number\col@number'
+       columns doesn't seem a good idea.^^J
+       I therefore use two columns instead}%
+     \global\col@number\tw@ \fi
+  \ifnum\col@number>10
+     \PackageError{multicol}%
+      {Too many columns}%
+      {Current implementation doesn't
+       support more than 10 columns.%
+       \MessageBreak
+       I therefore use 10 columns instead}%
+     \global\col@number10 \fi
+     \global\let\orig@footnotetext\@footnotetext
+     \long\gdef\@footnotetext##1{\begingroup
+         \columnwidth\textwidth
+         \orig@footnotetext{##1}\endgroup}%
+  \@ifnextchar[\nomult@cols{\nomult@cols[]}}
+
+\def\nomult@cols[#1]{\@ifnextchar[%
+  {\nomult@@cols{#1}}%
+  {\nomult@@cols{#1}[\premulticols]}}
+
+\def\nomult@@cols#1[#2]{%
+  \par
+  \ifinner \global\@boxedmulticolstrue
+  \else
+    \ifnum \doublecol@number>\z@
+       \global\@boxedmulticolstrue
+    \fi
+  \fi
+  \mult@info\z@
+      {Starting environment with
+       \the\col@number\space columns%
+        \if@boxedmulticols\MessageBreak
+           (boxed mode)\fi
+      }%
+   \enough@room{#2}%
+   #1\par\addvspace\multicolsep
+%   \begingroup
+     \prepare@multicols
+     \if@boxedmulticols
+       \global\setbox\mult@box\vbox\bgroup
+     \fi
+     \ignorespaces}
+
+\def\noendmulticols{\par
+  \if@boxedmulticols
+    \egroup
+    %\balance@columns
+    \return@nonemptymark{first}%
+                 \kept@firstmark
+    \return@nonemptymark{bot}%
+                  \kept@botmark
+    \page@sofar
+    \global\let\kept@firstmark\l@kept@firstmark
+    \global\let\kept@botmark\l@kept@botmark
+    \mult@info\tw@
+      {Restore kept marks to\MessageBreak
+       first: \meaning\kept@firstmark
+       \MessageBreak bot\space\space:
+                     \meaning\kept@botmark }%
+  \else
+   \penalty\z@
+    \global\output{\balance@columns@out}\eject
+    \ifvbox\partial@page
+         \unvbox\partial@page\fi
+     \global\let\kept@firstmark\@empty
+     \global\let\kept@botmark\@empty
+     \mult@info\tw@
+       {Make kept marks empty}%
+  \fi
+%  \@checkend{multicols}%
+%  \endgroup
+  \global\c@unbalance\z@
+  \if@boxedmulticols\else
+    \reinsert@footnotes
+    \ifdim \pagegoal=\maxdimen
+      \global\vsize\@colroom
+    \else
+      \enough@room\postmulticols
+    \fi
+  \fi
+  \addvspace\multicolsep
+  \mult@info\z@
+     {Ending environment
+             \if@boxedmulticols
+                \space(boxed mode)\fi
+              }%
+\typeout{^^JSTOP \the\col@number\space COLUMNS}%
+	   \restore@mult@settings
+}
+
+%%
+%% End Additions by Dirk Roorda
+%%
+
+%%
+%% The following code is unmodified, except that many local
+%% statements have been globalized
+%%
+
+\newif\if@boxedmulticols
+\global\@boxedmulticolsfalse
+
+\newbox\mult@box
+
+\def\enough@room#1{%
+   \if@boxedmulticols\else
+   \par
+   \bgroup\@nobreakfalse\addpenalty\z@\egroup
+   \global\page@free\pagegoal
+   \global\advance\page@free -\pagetotal
+     \global\@tempskipa#1\relax
+   \mult@info\z@
+       {Current page:\MessageBreak
+        height=%
+        \the\pagegoal: used \the\pagetotal
+        \space -> free=\the\page@free
+        \MessageBreak
+        needed \the\@tempskipa
+              \space(for #1)}%
+   \ifdim\page@free<#1\newpage \fi
+  \fi}
+
+\newif\ifmult@just@prepared
+
+\def\prepare@multicols{%
+  \global\multicol@leftmargin\@totalleftmargin
+  \global\@totalleftmargin\z@
+  \global\parshape\z@
+  \global\doublecol@number\col@number
+  \global\multiply\doublecol@number\tw@
+  \global\advance\doublecol@number\mult@rightbox
+  \if@boxedmulticols
+    \global\let\l@kept@firstmark\kept@firstmark
+    \global\let\l@kept@botmark\kept@botmark
+    \global\let\kept@firstmark\@empty
+    \global\let\kept@botmark\@empty
+  \else
+    \nointerlineskip {\global\topskip\z@\null}%
+    \global\output{%
+      \global\setbox\partial@page\vbox
+        {%
+         \ifvoid\partial@page\else
+           \PackageError{multicol}%
+            {Error saving partial page}%
+            {The part of the page before
+             the multicols environment was
+             nearly full with^^Jthe result
+             that starting the environment
+             will produce an overfull
+             page.  Some^^Jtext may be lost!
+             Please increase \premulticols
+             either generally or for this%
+             ^^Jenvironment by specifying a
+             suitable value in the second
+             optional argument to^^Jthe
+             multicols environment.}
+           \unvbox\partial@page
+           \box\last@line
+         \fi
+         \unvbox\@cclv
+         \global\setbox\last@line\lastbox
+        }%
+           \prep@keptmarks
+           \global\let\kept@topmark\firstmark
+          }\eject
+    \global\advance\@colroom-\ht\partial@page
+    \set@mult@vsize\relax
+    \global\output{\multi@column@out}%
+    \init@mult@footins
+    \reinsert@footnotes
+  \fi
+  \global\vbadness\@Mi \global\hbadness5000
+  \global\tolerance\multicoltolerance
+  \global\pretolerance\multicolpretolerance
+  \setemergencystretch\col@number\hsize
+  \set@floatcmds
+  \global\advance\baselineskip\multicolbaselineskip
+  \global\hsize\linewidth \global\advance\hsize\columnsep
+  \global\advance\hsize-\col@number\columnsep
+  \global\divide\hsize\col@number
+  \global\full@width\linewidth
+  \global\linewidth\hsize
+  \global\columnwidth\hsize
+  \global\mult@just@preparedtrue
+%\typeout{SETTING JUSTPREPARED to TRUE}%
+}
+
+\def\refreshmulticols{%
+%\typeout{REFRESH?}%
+  \ifmult@just@prepared
+%\typeout{NO, JUSTPREPARED!}%
+  \else
+%\typeout{YES}%
+	\global\multicol@leftmargin\@totalleftmargin
+	\global\@totalleftmargin\z@
+	\global\parshape\z@
+	\global\doublecol@number\col@number
+	\global\multiply\doublecol@number\tw@
+	\global\advance\doublecol@number\mult@rightbox
+	\if@boxedmulticols
+		\global\let\l@kept@firstmark\kept@firstmark
+		\global\let\l@kept@botmark\kept@botmark
+		\global\let\kept@firstmark\@empty
+		\global\let\kept@botmark\@empty
+	\else
+		\nointerlineskip {\global\topskip\z@\null}%
+		\global\advance\@colroom-\ht\partial@page
+		\set@mult@vsize\relax
+		\init@mult@footins
+	%   \reinsert@footnotes
+	\fi
+	\global\vbadness\@Mi \global\hbadness5000
+	\global\tolerance\multicoltolerance
+	\global\pretolerance\multicolpretolerance
+	\setemergencystretch\col@number\hsize
+	\set@floatcmds
+	%  \global\advance\baselineskip\multicolbaselineskip
+	\global\hsize\linewidth \global\advance\hsize\columnsep
+	\global\advance\hsize-\col@number\columnsep
+	\global\divide\hsize\col@number
+	\global\full@width\linewidth
+	\global\linewidth\hsize
+	\global\columnwidth\hsize
+	\global\mult@just@preparedtrue
+%\typeout{SETTING JUSTPREPARED to TRUE}%
+  \fi
+}
+
+\def\init@mult@footins{%
+    \global\multiply\count\footins\col@number
+    \global\multiply\skip \footins\col@number
+}
+
+\def\set@mult@vsize#1{%
+    \global\vsize\@colroom
+    \global\@tempdima\baselineskip
+    \global\advance\@tempdima-\topskip
+    \global\advance\vsize\@tempdima
+    \global\vsize\col@number\vsize
+    \global\advance\vsize-\@tempdima
+    #1\global\advance\vsize\c@collectmore\baselineskip}
+
+\newdimen\multicol@leftmargin
+\newcount\c@unbalance
+\newcount\c@collectmore
+\newcount\doublecol@number
+\newcount\multicoltolerance
+\newcount\multicolpretolerance
+\newdimen\full@width
+\newdimen\page@free
+\newdimen\premulticols
+\newdimen\postmulticols
+\newskip\multicolsep
+\newskip\multicolbaselineskip
+\newbox\partial@page
+\newbox\last@line
+\global\c@unbalance   = 0
+\global\c@collectmore = 0
+\global\col@number = 1
+\global\multicoltolerance = 9999
+\global\multicolpretolerance = -1
+\global\premulticols = 50pt
+\global\postmulticols= 20pt
+\global\multicolsep = 12pt plus 4pt minus 3pt
+\global\multicolbaselineskip=0pt
+
+\def\process@cols#1#2{\global\count@#1\relax
+     \loop
+      #2%
+     \global\advance\count@\tw@
+     \ifnum\count@<\doublecol@number
+   \repeat}
+
+\def\page@sofar{%
+   \process@cols\mult@rightbox
+       {\ifvoid\count@
+          \setbox\count@\hbox to\hsize{}%
+        \else
+          \wd\count@\hsize
+        \fi}%
+   \mult@info\z@
+    {Column spec:\MessageBreak
+       (\the\multicol@leftmargin\space -->
+        \the\full@width\space = \the\hsize
+        \space x \the\col@number)%
+     }%
+\ifvmode\else\errmessage{Multicol Error}\fi
+   \moveright\multicol@leftmargin
+    \hbox to\full@width{%
+     \process@cols\mult@gfirstbox{\box\count@
+       \hss{\normalcolor\vrule\@width\columnseprule}\hss}%
+     \box\mult@rightbox
+      \rlap{\phantom p}%
+    }%
+}
+
+\def\reinsert@footnotes{\ifvoid\footins\else
+         \insert\footins{}\fi}
+
+\def\multi@column@out{%
+	\ifnum\outputpenalty <-\@M
+   		\speci@ls
+	\else
+		\global\mult@just@preparedfalse
+%\typeout{SETTING JUSTPREPARED TO FALSE}%
+   		\ifvoid\colbreak@box
+		\else
+     		\mult@info\@ne{Re-adding forced
+               break(s) for splitting}%
+     		\setbox\@cclv\vbox{%
+        	\unvbox\colbreak@box
+        	\penalty-\@Mv\unvbox\@cclv}%
+   		\fi
+   		\splittopskip\topskip
+   		\splitmaxdepth\maxdepth
+   		\global\dimen@\@colroom
+   		\global\divide\skip\footins\col@number
+   		\ifvoid\footins
+		\else
+      		\leave@mult@footins
+   		\fi
+   		\process@cols\mult@gfirstbox{%
+        	\setbox\count@\vsplit\@cclv to\dimen@
+        	\set@keptmarks
+   			\ifshr@nking
+       			\setbox\count@\vbox to\dimen@{\unvbox\count@\vfill}%
+      		\fi
+    	}%
+   		\global\setbox\mult@rightbox\vsplit\@cclv to\dimen@
+   		\set@keptmarks
+   		\ifshr@nking
+      		\global\setbox\mult@rightbox\vbox to\dimen@{\unvbox\mult@rightbox\vfill}%
+   		\fi
+   		\ifvoid\@cclv
+		\else
+       		\unvbox\@cclv
+       		\penalty\outputpenalty
+       		\ifvoid\footins
+			\else
+         		\PackageWarning{multicol}%
+          				{I moved some lines to
+           				the next page.\MessageBreak
+           				Footnotes on page
+           				\thepage\space might be wrong}%
+       		\fi
+       		\ifnum \c@tracingmulticols>\thr@@
+       			\hrule\allowbreak
+			\fi
+   		\fi
+   		\ifx\@empty\kept@firstmark
+      		\global\let\firstmark\kept@topmark
+      		\global\let\botmark\kept@topmark
+   		\else
+      		\global\let\firstmark\kept@firstmark
+      		\global\let\botmark\kept@botmark
+   		\fi
+   		\global\let\topmark\kept@topmark
+   		\mult@info\tw@
+        	{Use kept top mark:\MessageBreak
+          	\meaning\kept@topmark
+         	\MessageBreak
+         	Use kept first mark:\MessageBreak
+          	\meaning\kept@firstmark
+        	\MessageBreak
+         	Use kept bot mark:\MessageBreak
+          	\meaning\kept@botmark
+        	\MessageBreak
+         	Produce first mark:\MessageBreak
+          	\meaning\firstmark
+        	\MessageBreak
+        	Produce bot mark:\MessageBreak
+          	\meaning\botmark
+         	\@gobbletwo}%
+   		\setbox\@cclv\vbox{\unvbox\partial@page\page@sofar}%
+   		\@makecol\@outputpage
+     	\global\let\kept@topmark\botmark
+     	\global\let\kept@firstmark\@empty
+     	\global\let\kept@botmark\@empty
+     	\mult@info\tw@
+        	{(Re)Init top mark:\MessageBreak
+         	\meaning\kept@topmark
+         	\@gobbletwo}%
+   		\global\@colroom\@colht
+   		\process@deferreds
+   		\@whilesw\if@fcolmade\fi{\@outputpage
+      		\global\@colroom\@colht
+      		\process@deferreds}%
+   		\mult@info\@ne
+     		{Colroom:\MessageBreak
+      		\the\@colht\space
+              	after float space removed
+              	= \the\@colroom \@gobble}%
+    	\set@mult@vsize \global
+  	\fi
+}
+
+\def\leave@mult@footins{%
+   \global\advance\dimen@-\skip\footins
+   \global\advance\dimen@-\ht\footins
+}
+
+\def\speci@ls{%
+ \ifnum\outputpenalty <-\@Mi
+  \ifnum \outputpenalty<-\@MM
+   \PackageError{multicol}{Document end
+           inside multicols environment}\@ehd
+   \@specialoutput
+  \else
+     \ifnum\outputpenalty = -\@Mv
+         \mult@info\@ne{Forced column
+                        break seen}%
+         \global\advance\vsize-\pagetotal
+         \global\setbox\colbreak@box
+                \vbox{\ifvoid\colbreak@box
+                      \else
+                        \unvbox\colbreak@box
+                        \penalty-\@Mv
+                      \fi
+                      \unvbox\@cclv}
+         \reinsert@footnotes
+     \else
+        \PackageWarning{multicol}%
+           {Floats and marginpars not
+            allowed inside `multicols'
+            environment!
+           \@gobble}%
+        \unvbox\@cclv\reinsert@footnotes
+       \xdef\@freelist{\@freelist\@currlist}%
+       \gdef\@currlist{}%
+     \fi
+  \fi
+ \else \@doclearpage \fi
+}
+
+\def\process@deferreds{%
+   \@floatplacement
+   \@tryfcolumn\@deferlist
+   \if@fcolmade\else
+     \begingroup
+    \let\@tempb\@deferlist
+      \gdef\@deferlist{}%
+      \let\@elt\@scolelt
+        \@tempb \endgroup
+   \fi}
+
+\newif\ifshr@nking
+
+\def\raggedcolumns{%
+   \@bsphack\global\shr@nkingtrue\@esphack}
+
+\def\flushcolumns{%
+   \@bsphack\global\shr@nkingfalse\@esphack}
+
+\def\balance@columns@out{%
+   \global\setbox\mult@box\vbox{%
+       \ifvoid\colbreak@box\else
+         \unvbox\colbreak@box\break
+         \mult@info\@ne{Re-adding
+           forced break(s) in balancing}%
+       \fi
+       \unvbox\@cclv}%
+   \balance@columns
+   \global\vsize\@colroom
+   \global\advance\vsize\ht\partial@page
+   \unvbox\partial@page
+   \return@nonemptymark{first}\kept@firstmark
+   \return@nonemptymark{bot}\kept@botmark
+   \page@sofar
+   \penalty\z@
+}
+
+\def\balance@columns{%
+   \get@keptmarks\mult@box
+   \global\setbox\mult@box\vbox{%
+        \penalty-\@M
+        \unvbox\mult@box
+        \remove@discardable@items
+        }%
+   \global\@tempdima\topskip
+   \global\splittopskip\@tempdima
+       \@plus\multicolundershoot
+       \@minus\multicolovershoot
+   \splitmaxdepth\maxdepth
+   \setbox\@tempboxa\vsplit\mult@box to\z@
+   \global\@tempdima\ht\mult@box
+   \global\advance\@tempdima\dp\mult@box
+   \global\divide\@tempdima\col@number
+   \global\count@\@tempdima
+   \global\divide\count@\baselineskip
+   \global\dimen@\count@\baselineskip
+   \global\advance\dimen@\topskip
+   \ifdim \dimen@ >\@tempdima
+     \global\advance\dimen@-\baselineskip
+   \fi
+   \global\advance\dimen@\c@unbalance\baselineskip
+   \mult@info\@ne
+      {Balance columns\on@line:
+        \ifnum\c@unbalance=\z@\else
+       (off balance=\number\c@unbalance)\fi
+      \@gobbletwo}%
+   \ifnum\dimen@<\topskip
+     \mult@info\@ne
+       {Start value
+          \the\dimen@  \space ->
+          \the\topskip \space (corrected)}%
+     \global\dimen@\topskip
+   \fi
+   \global\vbadness\@M
+   \global\vfuzz \col@number\baselineskip
+   \global\last@try-\p@
+   \loop
+    {\process@cols\mult@grightbox
+           {\global\setbox\count@
+                   \box\voidb@x}}%
+    \global\setbox\mult@grightbox
+           \copy\mult@box
+   \global\too@badfalse
+   {\process@cols\mult@firstbox{%
+         \global\setbox\count@
+         \vsplit\mult@grightbox to\dimen@
+         \ifnum\c@tracingmulticols>\@ne
+           \@tempcnta\count@
+           \advance\@tempcnta-\mult@grightbox
+           \divide\@tempcnta \tw@
+           \message{^^JColumn
+              \number\@tempcnta\space
+               badness: \the\badness\space}%
+         \fi
+         \ifnum\badness>\c@columnbadness
+           \ifnum\c@tracingmulticols>\@ne
+             \message{too bad
+                  (>\the\c@columnbadness)}%
+           \fi
+           \global\too@badtrue
+         \fi
+                        }}%
+   \global\boxmaxdepth\maxdepth
+   \global\setbox\mult@grightbox
+      \vbox{\unvbox\mult@grightbox}%
+   \global\setbox\mult@nat@firstbox
+      \vbox{\unvcopy\mult@firstbox}%
+    \ifnum\c@tracingmulticols>\@ne
+       \message{^^JFirst column
+           = \the\dimen@\space
+           (\the\ht\mult@nat@firstbox)}\fi
+    \ifnum\c@tracingmulticols>\@ne
+      \message{<> last column =
+               \the\ht\mult@grightbox^^J}%
+     \fi
+    \ifdim\ht\mult@grightbox >\dimen@
+      \global\too@badtrue
+      \ifnum\c@tracingmulticols>\@ne
+         \typeout{Rejected: last
+                 column too large!}%
+      \fi
+    \else
+      \setbox\@tempboxa
+           \copy\mult@grightbox
+      \setbox\z@\vsplit\@tempboxa to\maxdimen
+      \ifvoid\@tempboxa
+        \global\setbox\mult@grightbox
+           \vbox to\dimen@
+              {\unvbox\mult@grightbox}%
+        \ifnum\c@tracingmulticols>\@ne
+          \message{Final badness:
+                   \the\badness}%
+        \fi
+        \ifnum\badness>\c@finalcolumnbadness
+          \global\setbox\mult@grightbox
+           \vbox to\dimen@
+              {\unvbox\mult@grightbox\vfill}%
+           \ifnum\c@tracingmulticols>\@ne
+             \message{ setting natural
+              (> \the\c@finalcolumnbadness)}%
+           \fi
+        \fi
+      \else
+        \global\too@badtrue
+        \ifnum\c@tracingmulticols>\@ne
+          \typeout{Rejected: unprocessed
+            forced break(s) in last column!}%
+        \fi
+      \fi
+    \fi
+    \ifdim\ht\mult@nat@firstbox<\dimen@
+      \ifdim\ht\mult@nat@firstbox>\last@try
+        \global\too@badtrue
+        \ifnum\c@tracingmulticols>\@ne
+           \typeout{Retry: using natural
+                    height of first column!}%
+        \fi
+        \global\dimen@\ht\mult@nat@firstbox
+        \global\last@try\dimen@
+        \global\advance\dimen@-\p@
+      \fi
+    \fi
+    \iftoo@bad
+      \global\advance\dimen@\p@
+    \repeat
+   \if@boxedmulticols\else
+     \ifdim\dimen@>\@colroom
+       \global\dimen@\@colroom
+     \fi
+   \fi
+   \process@cols\mult@rightbox
+       {\@tempcnta\count@
+        \advance\@tempcnta\@ne
+        \setbox\count@\vbox to\dimen@
+           {%
+            \vskip \z@
+              \@plus-\multicolundershoot
+              \@minus-\multicolovershoot
+            \unvbox\@tempcnta
+            \ifshr@nking\vfill\fi}}%
+}
+
+\newbox\mult@rightbox
+\newbox\mult@grightbox
+\newbox\mult@gfirstbox
+\newbox\mult@firstbox
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa
+
+\global\let\@tempa\relax
+
+\@ifundefined{emergencystretch}
+     {\newdimen\emergencystretch}{}
+
+\def\setemergencystretch#1#2{%
+   \global\emergencystretch 4pt
+   \global\multiply\emergencystretch#1}
+
+\def\set@floatcmds{%
+ \global\let\@dblfloat\@dbflt
+ \gdef\end@dblfloat{\par
+   \vskip\z@
+   \egroup
+   \color@endbox
+   \@largefloatcheck
+   \outer@nobreak
+   \ifnum\@floatpenalty<\z@
+     \@cons\@deferlist\@currbox
+   \fi
+   \ifnum\@floatpenalty=-\@Mii
+     \@Esphack
+   \fi}}
+
+\def\kept@topmark{{}{}}
+
+\global\let\kept@firstmark\@empty
+\global\let\kept@botmark\@empty
+
+\def\return@nonemptymark#1#2{%
+  \ifx#2\@empty
+  \else
+    \mult@info\tw@
+      {Returned #1 mark:\MessageBreak
+       \meaning#2}%
+    \toks@\expandafter{#2}%
+    \mark{\the\toks@}%
+    \nobreak
+  \fi}
+
+\def\get@keptmarks#1{%
+  \begingroup
+   \vbadness\@M
+   \setbox#1\copy#1%
+   \setbox#1\vsplit#1to\maxdimen
+   \set@keptmarks
+ \endgroup
+}
+
+\def\set@keptmarks{%
+   \ifx\kept@firstmark\@empty
+     \expandafter\gdef\expandafter
+        \kept@firstmark
+        \expandafter{\splitfirstmark}%
+     \ifx\kept@firstmark\@empty\else
+       \mult@info\tw@
+         {Set kept first mark:\MessageBreak
+          \meaning\kept@firstmark%
+          \@gobbletwo}%
+     \fi
+   \fi
+   \expandafter\gdef\expandafter\@tempa
+      \expandafter{\splitbotmark}%
+   \ifx\@tempa\@empty\else
+      \global\let\kept@botmark\@tempa
+      \mult@info\tw@
+        {Set kept bot mark:\MessageBreak
+         \meaning\kept@botmark%
+         \@gobbletwo}%
+   \fi}%
+
+\def\prep@keptmarks{%
+   \if@boxedmulticols \else
+     \get@keptmarks\partial@page
+   \fi}
+
+\def\remove@discardable@items{%
+        \unskip\unpenalty\unkern
+        \unskip\unpenalty\unkern
+        \unskip\unpenalty\unkern
+        \unskip\unpenalty\unkern
+}
+
+\newif\iftoo@bad
+\newcount\c@columnbadness
+\global\c@columnbadness=10000
+
+\newcount\c@finalcolumnbadness
+\global\c@finalcolumnbadness=9999
+
+\newdimen\last@try
+\newdimen\multicolovershoot
+\global\multicolovershoot=2pt
+
+\newdimen\multicolundershoot
+\global\multicolundershoot=2pt
+
+\newbox\mult@nat@firstbox
+
+\def\mult@info#1#2{%
+  \ifnum\c@tracingmulticols>#1%
+   \GenericWarning
+       {(multicol)\@spaces\@spaces}%
+       {Package multicol: #2}%
+  \fi
+}
+
+\@namedef{multicols*}{%
+   \ifinner
+     \PackageWarning{multicol}%
+       {multicols* inside a box does
+        not make sense.\MessageBreak
+        Going to balance anyway}%
+   \else
+     \global\let\balance@columns@out
+         \multi@column@out
+   \fi
+   \begin{multicols}
+}
+\@namedef{endmulticols*}{\vfill
+   \end{multicols}}
+
+\mathchardef\@Mv=10005
+
+\def\columnbreak{%
+ \ifnum\col@number<\tw@
+  \PackageError{multicol}%
+   {\noexpand\columnbreak outside multicols}%
+   {This command can only be used within
+    a multicols or multicols* environment.}%
+ \else
+  \ifvmode
+    \penalty -\@Mv\relax
+  \else
+    \@bsphack
+    \vadjust{\penalty -\@Mv\relax}%
+    \@esphack
+  \fi
+ \fi}
+
+\newbox\colbreak@box
+
+\global\let\interbeginmulticols\nobeginmulticols
+\global\let\interendmulticols\noendmulticols
+\endinput
+%%
+%% End of file `multicol.sty'.
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/ucharacters.sty tetex-src-2.0.1/xmltex/contrib/passivetex/ucharacters.sty
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/ucharacters.sty	2002-06-25 22:51:00.000000000 +0200
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/ucharacters.sty	2002-12-20 00:00:00.000000000 +0100
@@ -13,7 +13,7 @@
 \DefineCharacter{172}{AC}{\ensuremath{\lnot }}
 \DefineCharacter{173}{AD}{\ensuremath{\-}}
 \DefineCharacter{174}{AE}{\ifmmode \circledR \else \textregistered \fi}% 
-\DefineCharacter{175}{AF}{\textasciimacron }
+\DefineCharacter{175}{AF}{\ifmmode\mbox{\textasciimacron}\else\textasciimacron\fi}
 \DefineCharacter{176}{B0}{\ifmmode \mbox{\textdegree}\else \textdegree \fi}% 
 \DefineCharacter{177}{B1}{\ensuremath{\pm }}
 \DefineCharacter{178}{B2}{\ensuremath{{^2}}}
@@ -591,6 +591,8 @@
 \DefineCharacter{1249}{4E1}{\cyrchar\cyrabhdze }
 \DefineCharacter{1256}{4E8}{\cyrchar\CYROTLD }
 \DefineCharacter{1257}{4E9}{\cyrchar\cyrotld }
+\DefineCharacter{8192}{2000}{\,\fbox{\vrule height1.5ex depth0pt width0pt \hspace{0.5em}}\,}
+\DefineCharacter{8193}{2001}{\,\fbox{\vrule height1.5ex depth0pt width0pt \hspace{1em}}\,}
 \DefineCharacter{8194}{2002}{\hspace{0.6em}}
 \DefineCharacter{8195}{2003}{\hspace{1em}}
 \DefineCharacter{8196}{2004}{\hspace{0.33em}}
diff -uN tetex-src-2.0.1/xmltex/contrib/passivetex.orig/unicode.sty tetex-src-2.0.1/xmltex/contrib/passivetex/unicode.sty
--- tetex-src-2.0.1/xmltex/contrib/passivetex.orig/unicode.sty	2002-06-25 22:51:00.000000000 +0200
+++ tetex-src-2.0.1/xmltex/contrib/passivetex/unicode.sty	2003-01-14 00:00:00.000000000 +0100
@@ -26,7 +26,7 @@
   \IfFileExists{t2aenc.def}
    {\RequirePackage[T3,T2A,T1]{fontenc}}
    {\RequirePackage[T3,T1]{fontenc}}
-   \RequirePackage[noenc,safe]{tipa}
+   \RequirePackage[safe,noenc]{tipa}
    \RequirePackage{tone}
    \DeclareFontSubstitution{T3}{ptm}{m}{n}
  }{