2

The newest versions of the package xy-pic does not work properly with LuaLaTeX, version 0.95.0. Consider the following simple example:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[all]{xy}

\begin{document}

\[
\xymatrix {
  A\ar[r]\ar[d] & B\ar[d]\\
  C\ar[r] & D
}
\]

\end{document}

The first error message, which appears while compiling this with lualatex is

Package xypdf Error: pdfTeX version 1.40.0 or higher is needed for the xypdf

It’s possible to avoid this error message by adding the following line at the beginning of /usr/share/texlive/texmf-dist/tex/generic/xypic/xypdf.tex

\input /usr/share/texmf/tex/generic/context/luatex/luatex-pdf.tex

However, even then LuaLaTeX produces errors:

ERROR: Undefined control sequence.
\line@ ->\setboxz@h {\xP@setsolidpat \xP@stroke 
                                                {0 0 m \xP@coor {\cosDirecti... 
l.13 }

and the result looks like this:

The attempt of plotting a commutative diagram with LuaLaTeX

  • I'd also recommned having a look at switching to tikz-cd, IMO it ends up looking better and is more flexible. – daleif Sep 8 '16 at 14:57
  • Just do \input{luatex-pdf} immediately after the \documentclass line. And don't modify distributed files. – egreg Sep 8 '16 at 15:05
4

Until xypic is updated, you can use the luatex85 compatibility package:

enter image description here

\RequirePackage{luatex85}
\documentclass{article}
% no not with luatex \usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[all]{xy}
\listfiles

\begin{document}

\[
\xymatrix {
  A\ar[r]\ar[d] & B\ar[d]\\
  C\ar[r] & D
}
\]

\end{document}

with log:

 *File List*
luatex85.sty    2016/06/15 v1.4 pdftex aliases for luatex
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
fontspec.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
   expl3.sty    2016/05/18 v6512 L3 programming layer (loader) 
expl3-code.tex    2016/05/18 v6512 L3 programming layer 
l3pdfmode.def    2016/03/26 v6465 L3 Experimental driver: PDF mode
  xparse.sty    2016/05/18 v6512 L3 Experimental document command parser
luaotfload.sty    2016/06/16 v2.7 OpenType layout system
fontspec-luatex.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty
  eu2enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
  eu2lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many othe
r characters in Unicode lower plane
 eu2lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2016/07/10 v1.0t Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  luatex.def    2016/08/17 v0.01g Graphics/Color for luaTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
fontspec.cfg
      xy.sty    2013/10/06 Xy-pic version 3.8.9
   ifpdf.sty    2016/05/14 v3.1 Provides the ifpdf switch
   t3cmr.fd    2001/12/31 TIPA font definitions
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
luatex-loader.sty    2016/05/16 v0.6 Lua module loader (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********
  • Thank you for the quick response, but this doesn’t work either; the errors are the same. – FKranhold Sep 8 '16 at 14:36
  • @FKranhold worked for me without error, let me do an update to see if xypic changed recently... – David Carlisle Sep 8 '16 at 14:38
  • Oh, sorry: I commented out a line in xypdf.tex wrongly. – FKranhold Sep 8 '16 at 14:43
  • @FKranhold :-) anyway I updated with the output and the \listfiles output showing file versions used. – David Carlisle Sep 8 '16 at 14:46
  • work around still needed (Fedora) – PeptideChain May 7 '18 at 8:18
3

You might also consider the use of tikz-cd, which runs your example using LuaLaTeX virtually without change:

% !TEX TS-program = LuaLaTeX

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}
  A\ar[r]\ar[d] & B\ar[d]\\
  C\ar[r] & D
\end{tikzcd}
\]

\end{document}

Example run from tikz-cd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.