# Update of TikZ/pgf has broken user-defined command

A recent update of TikZ/pgf seems to have broken a newly defined command that came out of an earlier question of mine about crossing out terms in an equation.

Here's an MWE that illustrates the problem:

\documentclass{article}

\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,tikzmark}

\newif\ifCancelToOverlay
\tikzset{CancelTo/.is family,
CancelTo,
angle/.initial=60,
name/.initial=tmp,
node/.style={},
arrow/.style={->},
topoffs/.initial=2pt,
nodeaboveoffs/.initial=1pt,
nodeleftoffs/.initial=0pt,
overlay/.is if=CancelToOverlay,
overlay=true
}

\newcommand{\CancelTo}[3][]{\bgroup\tikzset{CancelTo/.cd,#1}
\tikzmarknode{\pgfkeysvalueof{/tikz/CancelTo/name}}{#3}
\begin{tikzpicture}[overlay,remember picture]
\draw[/tikz/CancelTo/arrow] let \p1=($(\pgfkeysvalueof{/tikz/CancelTo/name}.north)-(\pgfkeysvalueof{/tikz/CancelTo/name}.south)$),\n1={0.5*\y1*cot(\pgfkeysvalueof{/tikz/CancelTo/angle})},\n2={\y1/sin(\pgfkeysvalueof{/tikz/CancelTo/angle})}
in ([xshift=-\n1]\pgfkeysvalueof{/tikz/CancelTo/name}.south) -- ++ (\pgfkeysvalueof{/tikz/CancelTo/angle}:\n2+\pgfkeysvalueof{/tikz/CancelTo/topoffs})
node[above left=\pgfkeysvalueof{/tikz/CancelTo/nodeaboveoffs} and \pgfkeysvalueof{/tikz/CancelTo/nodeleftoffs},inner sep=0pt,font=\scriptsize,/tikz/CancelTo/node] (tmplabel) {#2};
\path let \p1=($(tmplabel.north east)-(\pgfkeysvalueof{/tikz/CancelTo/name}.east)$) in
\pgfextra{\ifCancelToOverlay
\xdef\mydist{0pt}
\else
\xdef\mydist{\x1}
\fi};
\end{tikzpicture}\egroup\vphantom{\cancelto{#2}{#3}}\hspace{\mydist}}

\input{math-defs}

\begin{document}
\begin{equation*}
\CancelTo[nodeleftoffs=-11pt]{ignore}{\frac{x^2}{4}}
\end{equation*}
\end{document}


This code used to work, but now produces

! Package pgf Error: No shape named tmp is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.
...

l.39 ...nodeleftoffs=-11pt]{ignore}{\frac{x^2}{4}}


I'm running:

• pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019)
• pgf 2019/08/03 v3.1.4b (3.1.4b)
• tikz 2019/08/03 v3.1.4b (3.1.4b)
• Compile it twice. There's a bug in the current version of tikzmark where a mark in a maths environment isn't available on the first run. It's fixed in the github repository but I've yet to upload it to ctan. – Loop Space Sep 24 '19 at 6:03
• Compiling it multiple times makes no difference. (How could it when the first compilation does not complete?) – user1362373 Sep 24 '19 at 6:41
• @user1362373 compile the first run with ignoring errors with -interaction nonstopmode as command line parameters to pdflatex. – Skillmon likes topanswers.xyz Sep 24 '19 at 7:41
• @Skillmon: Thanks, that worked. – user1362373 Sep 24 '19 at 15:53
• Sorry! I forget that I have -interaction nonstopmode automatically set. – Loop Space Sep 24 '19 at 17:03