I've just installed TeX Live 2015 vanilla and I tried to compile some old sources just to be sure that everything worked. TeX Live works, but I have problems with some code that I've unashamedly stolen from a couple of sources on the net. I get a

! 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 )')

for something related to the wavy bond part. No wavy bonds in the document, no error. This is the WE, as minimal as it could get (not much):

% 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/
        next state=sine,
        persistent precomputation={\pgfmathsetmacro\matchinglength{
            \pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
            \setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
        }] {}
% 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'

  wavy bond/.style =
      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

\chemfig{A-[,,,,wavy bond]B}

Versions of the defendants:

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)

Previously I was on TeX Live 2014 from the Ubuntu repos.

  • I can confirm it works with vanilla TL 2014 and not 2015. (2014 updated to freeze, 2015 updated not that long ago.) – cfr Nov 30 '15 at 2:07
  • Probably useful to note that the code from the references TeX SE questions still compiles OK. – cfr Nov 30 '15 at 2:11
  • The problem is the setting of segment length. Without that, it compiles. – cfr Nov 30 '15 at 2:18
  • But it is not the changes to chemfig as the problem occurs if I drop the 2014 version into a 2015 compile. So, I guess this is a change to PGF/TikZ... – cfr Nov 30 '15 at 2:27
  • 1
    Use segment length without \dimexpr: segment length = \csname CF@atom@sep\endcsname/5 – cgnieder Nov 30 '15 at 10:27

I couldn't trace the cause for the change, but the problem is in your code and not in chemfig.

The macro \CF@atom@sep expands to 3em, unless \setatomsep is issued. What happens is that, with previous versions of TikZ/PGF, your

segment length=\the\dimexpr\csname CF@atom@sep\endcsname/5\relax

was evaluated when the current font was the standard text font; with the current version, at that time the current font is \nullfont, so 3em is the same as zero.

Indeed, if I do

segment length=6pt

the example works.

| improve this answer | |

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.