我需要在 TikZ 中画几条线,其中一些线需要闭合。但我的代码在一台机器上编译成功,但在另一台机器上却出错,唯一的区别就是 LaTeX 的版本。
平均能量损失
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) to[out=90,in=135]
(0,1) to[out=315,in=120]
(1,1) to[out=315,in=270]
(0,0);
%\draw (0,0) to[out=90,in=135]
% (0,1) to[out=315,in=120]
% (1,1) to[out=315,in=270]
% cycle;
\end{tikzpicture}
\end{document}
该版本可在两台计算机上运行,但是,如果我注释第一台计算机\draw
并取消注释第二台计算机,则安装有旧版本 texlive 的计算机会遇到错误。
Runaway argument?
\tikz@@to@collect cycle; \end {tikzpicture}
! Paragraph ended before \tikz@collect@coordinate@onpath was complete.
我无法升级那台机器(工作电脑),因此出于兼容性原因,我放弃了该cycle
选项,而是使用显式坐标。我只是想知道是否有人知道这种行为的原因是什么?
顺便说一句,该cycle
选项适用于直线
\draw (0,0) -- (0,1) -- (1,1) cycle;
旧机器
$ latex --version
pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013)
kpathsea version 6.1.1
Copyright 2013 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.1; using libpng 1.6.1
Compiled with zlib 1.2.7; using zlib 1.2.7
Compiled with xpdf version 3.03
最新机器
$ latex --version
pdfTeX 3.1415926-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
谢谢
编辑:在未更新的系统中,\pgfversion
在文档中使用会打印 2.10,即 PGF 包的版本。并且\listfiles
在序言中调用会在日志中打印
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
答案1
根据评论,我检查了该pgf
软件包的 Changelog 文档,发现在我使用的版本之后发生了许多变化,包括以下内容
2013-06-18 Till Tantau <[email protected]>
- Fixed bug #236 "Scaled closed paths, start/end points dont exactly match":
"cycle" can now be used with all path operations where it
makes sense, not only with --. In particular, things like
".. cycle" or "to [bend right] cycle" are now allowed.
因此,我只是看到旧版本的软件包中有一个旧错误。
谢谢!