# TikZ based \boxed construct is causing pdflatex to hang [closed]

In standalone code this works for me, drawing a nice red colored box around my equations (based on TikX \underbrace like replacement that I use without any trouble):

\documentclass{article}

\usepackage{tikz}
\newcounter{tikzNodeNum}

\newcommand{\xmyBoxed}[2]{%
\tikz[baseline]{%
\node[draw=red,rounded corners,anchor=base] (m#2)%
{$\displaystyle#1$};%
}%
}

\newcommand{\myBoxed}[1]{%
\stepcounter{tikzNodeNum}%
\xmyBoxed{#1}{\thetikzNodeNum}%
}

\begin{document}

$$\myBoxed{ a + b = c }$$
$$\myBoxed{ a + b = c }$$
$$\myBoxed{ a + b = c }$$

\end{document}


However, in larger documents, pdfLaTeX hangs when it processes a use of this. I haven't been able to reproduce the hang in any sort of MWE. Could somebody who knows TikZ syntax take a look above and see if there are any syntax errors that could be causing this trouble (when it works, it does draw my boxed equations nicely).

-

## closed as too localized by percusse, Andrew Swann, Kurt, lockstep, egregMar 12 '13 at 15:17

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

You could have produced a MWE that is easily copyable … syntax looks could. (Though, you will need the remember picture option if you ever want to use the node name again.) What is the typical content that you use it with? You can’t use a & inside *align* environments and expect amsmath to align it correctly. Have you seen the hf-tikz package? It seems you’re re-inventing the wheel. –  Qrrbrbirlbel Feb 16 '13 at 2:07
As you said this works fine. There is something else in your document that is the culprit, not this code. –  Peter Grill Feb 16 '13 at 4:08
Sorry, made a MWE that is copyable. I use this typically with equation and dmath environments. I'll take a look at the hf-tikz package. –  Peeter Joot Feb 16 '13 at 4:13