1

Using the empheq environment from the empheq package in a TikZ node is throwing errors for me (although it seems to be plotted correctly):

\documentclass{scrartcl}

\usepackage{empheq}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
        \node at (0,0)
        { % empheq is plotted but throws errors
            \begin{empheq}[left=\empheqlbrace]{align*}
                a = b
            \end{empheq}
        };
    \end{tikzpicture}
\end{document}

Errors

  1. Bad math environment delimiter.
  2. \begin{equation*} on input line ... ended by \end{AmSequation*}.

What I already know

From Aligned equations inside of TikZ node. I have learned that align environment can be replaced by aligned:

    % --- align does not work ---
    \node at (0,0) {  \begin{align*} a = b \end{align*}  };

    % --- aligned does ---        
    \node at (0,0) {  $\begin{aligned} a = b \end{aligned}$  };

Please note that I depend on empheq's functionality although the minimal working examples here do not reveal that.

matheburg
  • 1,279
  • I believe would be great to know why you're inserting equations in a TikZ node: if you wish to add arrows or other elements, there are simpler ways, i.e. tikzmarking (see http://tex.stackexchange.com/a/76507/13304) or using the hf-tikz package (which its main functionality is exactly formula highlighting). BTW: align has to be treated carefully: see Numbering equations within dynblocks environment. – Claudio Fiandrino Nov 07 '13 at 07:40
  • For example to arbitrarily arrange formulas, text, arrows and pictures on beamer slides. – matheburg Nov 07 '13 at 07:45
  • Your links are great but they are not solving my problem. I didn't want a proof for Tikz not to be needed. I use it for other purposes than tikzmark etc. are made for... – matheburg Nov 07 '13 at 07:59
  • I see your point, that's why I was asking which is your purpose. Clearly, I misunderstood the question. People more skilled than me will provide you a good working solution even if I'm quite sure whatever you're doing can be done, easily from my view, in a tikzmark fashion. – Claudio Fiandrino Nov 07 '13 at 08:05
  • 1
    No idea why it does this, tikz is an interesting beast. However, it works if you wrap the empheq in a minipage or \parbox. equivalently you could set the text width on the node. – daleif Nov 07 '13 at 08:37
  • Great! This works for me :-) I prefer the text width version, it seems to be the most elegant one. If you post this as an anwer I will accept it. – matheburg Nov 07 '13 at 11:27
  • @ClaudioFiandrino First of all, thanks for your help! It is just the fact that I am now right into Tikz and I like all the ways to manipulate it and I am not too interested in going back to some second level solutions which are even new to me. I hope this is ok :-) – matheburg Nov 07 '13 at 11:37

1 Answers1

2

tikz is an interesting beast. In this case empheq need to know the size of the area it is in. tikz nodes does not normally set such a size.

You can either put the empheq inside minipage or \parbox. or use the text width node option.

daleif
  • 54,450