1

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}

\begin{equation}
\myBoxed{
a + b = c
}
\end{equation}
\begin{equation}
\myBoxed{
a + b = c
}
\end{equation}
\begin{equation}
\myBoxed{
a + b = c
}
\end{equation}

\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).

Peeter Joot
  • 3,025
  • 2
  • 25
  • 35
  • 2
    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 02: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 04: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 04:13

0 Answers0