LuaLaTeX 和 xypic

LuaLaTeX 和 xypic

该软件包的最新版本xy-pic与 LuaLaTeX 0.95.0 版本不兼容。请考虑以下简单示例:

\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}

编译时出现的第一个错误消息lualatex

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

可以通过在开头添加以下行来避免此错误消息/usr/share/texlive/texmf-dist/tex/generic/xypic/xypdf.tex

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

然而,即使这样,LuaLaTeX 也会出现错误:

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

结果如下:

使用 LuaLaTeX 绘制交换图的尝试

答案1

直到xypic更新为止,您可以使用luatex85兼容包:

在此处输入图片描述

\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}

带有日志:

 *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
 ***********

答案2

您可能还考虑使用tikz-cd,它使用 LuaLaTeX 几乎不做任何改变地运行您的示例:

% !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}

从 tikz-cd 运行的示例

相关内容