我刚刚安装了 TeX Live 2015 vanilla,并尝试编译一些旧源代码,以确保一切正常。TeX Live 可以工作,但我对一些代码有问题,这些代码是我毫无羞耻地从网上的几个来源偷来的。我得到了一个
! Package PGF Math Error: You've asked me to divide `18.70836' by `0.0', but I cannot divide any number by `0.0' (in ' 18.70836pt/ int(18.70836pt/\pgfdecorationsegmentlength )')
与该部分相关的内容wavy bond
。文件中没有波浪形的债券,没有错误。这是 WE,尽可能简约(不多):
\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{calc,decorations.pathmorphing}
% From https://tex.stackexchange.com/questions/134259/custom-decoration-along-curved-paths
\pgfdeclaredecoration{complete sines}{initial}{% tex.stackexchange.com/questions/25678/nicer-wavy-line-with-tikz/
\state{initial}[
width=+0pt,
next state=sine,
persistent precomputation={\pgfmathsetmacro\matchinglength{
\pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
\setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
}] {}
\state{sine}[width=\pgfdecorationsegmentlength]{
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
}
\state{final}{}
}
% From http://www.texdev.net/2012/08/25/exploring-chemfig-customising-appearance/
% and http://www.texdev.net/2012/08/26/exploring-chemfig-going-further/
\newcommand{\bondwidth}{0.06642 em} % 'Line Width'
\setbondstyle{line width = \bondwidth}
\newcommand*{\bondboldwidth}{0.22832 em} %'Bold Width'
\newcommand*{\bondhashlength}{0.25737 em} % 'Hash Spacing'
\tikzset{
wavy bond/.style =
{
decorate,
decoration =
{
complete sines,
amplitude = \bondboldwidth,
post length = 0 pt,
pre length = 0 pt,
% Use the atom spacing: saved
segment length =
\the\dimexpr\csname CF@atom@sep\endcsname/5\relax
}
}
}
\begin{document}
\chemfig{A-[,,,,wavy bond]B}
\end{document}
被告人的说法:
chemfig.sty 2015/11/20 v1.2c Draw molecule with an easy syntax
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
之前我从 Ubuntu repos 上使用了 TeX Live 2014。
答案1
我无法追踪变化的原因,但问题出在你的代码中,而不是在chemfig
。
除非发出,否则宏\CF@atom@sep
将扩展为。使用以前版本的 TikZ/PGF,您的3em
\setatomsep
segment length=\the\dimexpr\csname CF@atom@sep\endcsname/5\relax
是在当前字体为标准文本字体时进行评估的;对于当前版本,当时当前字体为\nullfont
,因此 3em 与零相同。
确实,如果我这么做
segment length=6pt
该示例有效。