diff -u xypdf.orig/xypdf-co.tex xypdf/xypdf-co.tex
--- xypdf.orig/xypdf-co.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf-co.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -64,28 +64,75 @@
 \@ifdefinable\xP@colB\relax
 \@ifdefinable\xP@colC\relax
 \@ifdefinable\xP@colD\relax
+\@ifdefinable\xP@colE\relax
 \xP@hook{color}{newxycolor}
-\newcommand*\xP@newxycolor[2]{\def\xP@colorname{#1}\xP@parsecolor#2 @}
+\newcommand*\xP@newxycolor[2]{\def\xP@colorname{#1}\expandafter\xP@parsecolor\@firstofone#2 @}
 \xP@color@on
+\@ifdefinable\xP@parsetwo\relax
+\def\xP@parsetwo#1 #2@{\def\xP@colC{#1}\def\xP@colD{#2}}
+\@ifdefinable\xP@parsethree\relax
+\def\xP@parsethree#1 #2 #3@{\def\xP@colC{#1}\def\xP@colD{#2}\def\xP@colE{#3}}
 \@ifdefinable\xP@parsecolor\relax
-\def\xP@parsecolor#1 #2 #3@{\def\xP@colA{#1}\def\xP@colB{#2}\ifx\xP@colB\xP@gray
+\def\xP@parsecolor#1 #2 #3@{\def\xP@colA{#1}\def\xP@colB{#2}\ifx\xP@colA\xP@cmyk
+\xP@parsethree#3@\xP@newcolor\xP@colorname{\xP@colB,\xP@colC,\xP@colD,\xP@colE}\xP@cmyk
+\newxycolor
+\else
+\ifx\xP@colA\xP@CMYK
+\xP@parsethree#3@\xP@newcolor\xP@colorname{\xP@colB,\xP@colC,\xP@colD,\xP@colE}\xP@cmyk
+\newxycolor
+\else
+\ifx\xP@colA\xP@rgb
+\xP@parsetwo#3@\xP@newcolor\xP@colorname{\xP@colB,\xP@colC,\xP@colD}\xP@rgb\newxycolor
+\else
+\ifx\xP@colA\xP@RGB
+\xP@parsetwo#3@\xP@newcolor\xP@colorname{\xP@colB,\xP@colC,\xP@colD}\xP@rgb
+\newxycolor
+\else
+\ifx\xP@colA\xP@gray
+\xP@newcolor\xP@colorname\xP@colB\xP@gray\newxycolor
+\else
+\ifx\xP@colA\xP@GRAY
+\xP@newcolor\xP@colorname\xP@colB\xP@gray\newxycolor
+\else
+\ifx\xP@colB\xP@gray
+\xP@newcolor\xP@colorname\xP@colA\xP@gray\newxycolor
+\else
+\ifx\xP@colB\xP@GRAY
 \xP@newcolor\xP@colorname\xP@colA\xP@gray\newxycolor
 \else
 \xP@parsecolor@#3 @\fi
+\fi
+\fi
+\fi
+\fi
+\fi
+\fi
+\fi
 }
 \@ifdefinable\xP@parsecolor@\relax
 \def\xP@parsecolor@#1 #2 #3 #4@{\def\xP@colC{#1}\def\xP@colD{#2}\ifx\xP@colD\xP@rgb
 \xP@newcolor\xP@colorname{\xP@colA,\xP@colB,\xP@colC}\xP@rgb\newxycolor
 \else
+\ifx\xP@colD\xP@RGB
+\xP@newcolor\xP@colorname{\xP@colA,\xP@colB,\xP@colC}\xP@rgb\newxycolor
+\else
 \def\@tempa{#3}\ifx\@tempa\xP@cmyk
-\xP@newcolor\xP@colorname{\xP@colA,\xP@colB,\xP@colC,\xP@colD}{cmyk}\newxycolor
+\xP@newcolor\xP@colorname{\xP@colA,\xP@colB,\xP@colC,\xP@colD}\xP@cmyk\newxycolor
+\else
+\ifx\@tempa\xP@CMYK
+\xP@newcolor\xP@colorname{\xP@colA,\xP@colB,\xP@colC,\xP@colD}\xP@cmyk\newxycolor
 \else
 \PackageError{xypdf}{Syntax error in \string\newxycolor}{}\fi
 \fi
+\fi
+\fi
 }
 \newcommand*\xP@gray{gray}
 \newcommand*\xP@rgb{rgb}
 \newcommand*\xP@cmyk{cmyk}
+\newcommand*\xP@GRAY{GRAY}
+\newcommand*\xP@RGB{RGB}
+\newcommand*\xP@CMYK{CMYK}
 \xP@hook{color}{OBJECT@shape}
 \newcommand*\xP@OBJECT@shape[1]{\DN@{shape [#1]}\expandafter\let\expandafter\nextii@\csname\codeof\next@\endcsname
 \ifx\nextii@\relax\DN@{style [#1]}\expandafter\let\expandafter\nextii@\csname\codeof\next@\endcsname
@@ -120,10 +167,5 @@
 \xywithoption{crayon}{\xP@installCrayolaColors
 \renewcommand*\installCrayolaColors@{}}
 \xyendinput
-
-
-
-
-
 %%
 %% End of file `xypdf-co.tex'.
diff -u xypdf.orig/xypdf-cu.tex xypdf/xypdf-cu.tex
--- xypdf.orig/xypdf-cu.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf-cu.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -1178,10 +1178,5 @@
 \@for\@tempa:={#1}\do{\the\toks@}\xP@stroke{\the\@temptokena}}}
 \newcommand*\xP@paintbrokensquiggle[5]{\xP@squigglevectors{#1}\xP@append\@temptokena{\xP@coor\xP@posX\xP@posY m \xP@coor{\xP@posX+\Y@max}{\xP@posY+\X@max}}\xP@squigglevectors{#2}\xP@append\@temptokena{\xP@coor{\xP@posX-\D@p-\X@min}{\xP@posY+\R@p-\Y@min}\xP@coor{\xP@posX-\D@p}{\xP@posY+\R@p}c \xP@coor{\xP@posX-\D@p+\X@min}{\xP@posY+\R@p+\Y@min}}\xP@squigglevectors{#3}\xP@append\@temptokena{\xP@coor{\xP@posX-\X@max}{\xP@posY+\Y@max}\xP@coor\xP@posX\xP@posY c \xP@coor{\xP@posX+\X@max}{\xP@posY-\Y@max}}\xP@squigglevectors{#4}\xP@append\@temptokena{\xP@coor{\xP@posX+\D@p-\X@min}{\xP@posY-\R@p-\Y@min}\xP@coor{\xP@posX+\D@p}{\xP@posY-\R@p}c \xP@coor{\xP@posX+\D@p+\X@min}{\xP@posY-\R@p+\Y@min}}\xP@squigglevectors{#5}\xP@append\@temptokena{\xP@coor{\xP@posX-\Y@max}{\xP@posY-\X@max}\xP@coor\xP@posX\xP@posY c }}
 \xyendinput
-
-
-
-
-
 %%
 %% End of file `xypdf-cu.tex'.
diff -u xypdf.orig/xypdf-fr.tex xypdf/xypdf-fr.tex
--- xypdf.orig/xypdf-fr.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf-fr.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -429,10 +429,5 @@
 0 \xP@dim\B@ c }\@temptokena\expandafter{\@tempa}\xP@mirrorpath
 \xP@fillorstroke{\the\@temptokena}}
 \xyendinput
-
-
-
-
-
 %%
 %% End of file `xypdf-fr.tex'.
diff -u xypdf.orig/xypdf-li.tex xypdf/xypdf-li.tex
--- xypdf.orig/xypdf-li.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf-li.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -60,10 +60,5 @@
 \xycatcodes
 \expandafter\let\csname xypdf-li@loaded\endcsname\@empty
 \xyendinput
-
-
-
-
-
 %%
 %% End of file `xypdf-li.tex'.
diff -u xypdf.orig/xypdf-ro.tex xypdf/xypdf-ro.tex
--- xypdf.orig/xypdf-ro.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf-ro.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -124,10 +124,5 @@
 }\@tempdimb\dimen@i
 }
 \xyendinput
-
-
-
-
-
 %%
 %% End of file `xypdf-ro.tex'.
diff -u xypdf.orig/xypdf.tex xypdf/xypdf.tex
--- xypdf.orig/xypdf.tex	2016-11-19 12:24:53.457219331 +0100
+++ xypdf/xypdf.tex	2016-11-19 12:24:07.314492681 +0100
@@ -8,7 +8,7 @@
 %% 
 %% The xypdf package for TeX and LaTeX
 %% Copyright (c) 2010 by Daniel M�llner (M\"ullner)
-%% <http://math.stanford.edu/~muellner>
+%% <http://danifold.net>
 %% --------------------------------------------------------------------------
 %% 
 %% This program is free software: you can redistribute it and/or modify it
@@ -58,9 +58,9 @@
 %% (Muellner, M\"ullner).
 %% 
 \ifx\xyloaded\undefined\input xy \fi
-\xyprovide{pdf}{PDF driver}{1.7}{Daniel M\"ullner\newline}{\url{http://math.stanford.edu/~muellner}}{}
+\xyprovide{pdf}{PDF driver}{1.9}{Daniel M\"ullner\newline}{\url{http://danifold.net}}{}
 \ifx\makeatletter\undefined\input miniltx \fi
-\newcommand*\xypdfdate{2011/03/20}
+\newcommand*\xypdfdate{2016/07/25}
 \newdriver{\xyaddsupport{pdf}\xP@pdf@on
 \xyaddsupport{color}\xP@color@on
 \xyaddsupport{curve}\xP@curve@on
@@ -91,7 +91,10 @@
 \fi
 \newcommand*\xP@testpdfsave{\ifpdf
 \ifx\pdfsave\@undefined
-\PackageError{xypdf}{pdfTeX version 1.40.0 or higher is needed for the xypdf^^Jpackage with PDF output}{}\fi
+\ifx\pdfextension\@undefined
+\PackageError{xypdf}{LuaTeX or pdfTeX version 1.40.0
+or higher is needed for^^Jthe xypdf package with PDF output}{}\fi
+\fi
 \fi
 \let\xP@testpdfsave\@undefined
 }
@@ -120,12 +123,24 @@
 \expandafter\noexpand\csname xP@old@#2\endcsname
 }}
 \newcommand*\xP@defpdfliteral{\ifpdf
+\ifx\pdfextension\@undefined
 \newcommand*\xP@literal[1]{\pdfsave\pdfliteral{##1}\pdfrestore}
 \newcommand*\xP@cm[5]{\pdfsave
 \pdfsetmatrix{##1 ##2 ##3 ##4}##5\pdfrestore
 }
-\@ifundefined{@pdfcolorstack}{\def\@pdfcolorstack{\z@}}{}\newcommand*\xP@setcolor[3]{\pdfcolorstack\@pdfcolorstack push{##1 ##2 ##1 ##3}}
+\else
+\newcommand*\xP@literal[1]{\pdfextension save\pdfextension literal{##1}\pdfextension restore\relax
+}
+\newcommand*\xP@cm[5]{\pdfextension save\pdfextension setmatrix{##1 ##2 ##3 ##4}##5\pdfextension restore\relax
+}
+\fi
+\@ifundefined{@pdfcolorstack}{\def\@pdfcolorstack{\z@}}{}\ifx\pdfextension\@undefined
+\newcommand*\xP@setcolor[3]{\pdfcolorstack\@pdfcolorstack push{##1 ##2 ##1 ##3}}
 \newcommand*\xP@resetcolor{\pdfcolorstack\@pdfcolorstack pop\relax}\else
+\newcommand*\xP@setcolor[3]{\pdfextension colorstack\@pdfcolorstack push{##1 ##2 ##1 ##3}}
+\newcommand*\xP@resetcolor{\pdfextension colorstack\@pdfcolorstack pop\relax
+}\fi
+\else
 \newcommand*\xP@literal{\xP@warning{xypdf}{The produced DVI file is NOT PORTABLE. Convert it with^^Jdvipdfm(x) to the PDF format but do not expect the DVI file itself to be^^Jdisplayed correctly\@gobble}\global\let\xP@literal\xP@literal@
 \xP@literal
 }
@@ -145,14 +160,20 @@
 \next@
 {\RequirePackage{ifpdf}\xP@testpdfsave
 \xP@defpdfliteral}
+\@ifdefinable\xP@digits\relax
+\ifx\pdfvariable\@undefined
 \ifx\pdfdecimaldigits\@undefined
 \newcommand*\xP@digits{2}
 \else
-\@ifdefinable\xP@digits\relax
 \xdef\xP@digits{\the\pdfdecimaldigits}
-\ifnum\pdfdecimaldigits<2
-\xP@warning{xypdf}{The precision in \string\pdfdecimaldigits\space is only \xP@digits\space
-decimals.^^JIt is recommended to set \string\pdfdecimaldigits\space to 2 or 3 for best output quality\@gobble}
+\ifnum\xP@digits<2
+\xP@warning{xypdf}{The precision in \string\pdfdecimaldigits\space is only \xP@digits\space decimals.^^JIt is recommended to set \string\pdfdecimaldigits\space to 2 or 3 for best output quality\@gobble}
+\fi
+\fi
+\else
+\xdef\xP@digits{\the\pdfvariable decimaldigits}
+\ifnum\xP@digits<2
+\xP@warning{xypdf}{The precision in "\string\pdfvariable\space decimaldigits" is only \xP@digits^^Jdecimals. It is recommended to set "decimaldigits" to 2 or 3 for best output^^Jquality\@gobble}
 \fi
 \fi
 \newcommand*\xP@dim[1]{\expandafter\xP@removePT\the\dimexpr(#1)*800/803\relax\space}
@@ -329,10 +350,15 @@
 \fi
 ]\xP@precdim{\dimexpr\xP@preclw+\@tempdima/2\relax}d}}
 \newcommand*\xP@abs[1]{\ifdim#1<\z@\multiply#1\m@ne\fi}
-\newcommand*\xP@ifabsless[2]{\ifpdfabsdim#1<#2}
 \ifx\ifpdfabsdim\@undefined
-\renewcommand*\xP@ifabsless[2]{\ifdim\ifdim#1<\z@-\fi#1<\ifdim#2<\z@-\fi#2}
+\newcommand*\xP@ifabsless[2]{\ifdim\ifdim#1<\z@-\fi#1<\ifdim#2<\z@-\fi#2}
 \@gobble\fi
+\else
+\newcommand*\xP@ifabsless[2]{\ifpdfabsdim#1<#2}
+\fi
+\ifx\ifabsdim\@undefined
+\else
+\renewcommand*\xP@ifabsless[2]{\ifabsdim#1<#2}
 \fi
 \newcommand*\xP@swapdim[2]{\@tempdima#1#1#2#2\@tempdima}
 \newcommand*\xP@swapnum[2]{\@tempcnta#1#1#2#2\@tempcnta}