6

I realize this is almost certainly impossible; however, I would love to see the TeX wizardry hidden here (and I actually also really desperately want this feature).

So I have a tikzpicture, and inside this picture, I have some node. Inside this, node, I have a math equation, say:

    $$\left|
        \frac{
          \left(\sum_{i=1}^n a_i^2\right) \cdot
          \left(\sum_{i=1}^n b_i^2\right)
        }{ (\sum_{i=1}^n \underbrace{a_ib_i}_{HERE})^2} \right| \geq 1$

Now, the underbrace gives me a nice rotated "}", and I can label it "HERE". However, I don't want to label it "HERE".

I want to draw an arrow from a tikzNode to where the "HERE" is located. I want to be able to do something like:

    \draw [->] (cauchySchwarzLabelNode) -- (HERE);

So basically, I need to be able to "grab the location of where 'HERE' is in the equation" ... and somehow draw an arrow to it from tikz.

Is there any hack to make this possible?

3
  • 3
    PS: I promise not to self answer this question within the next 30 days :-) This requires an understanding of tex/tikz internals far beyond my comprehension. Commented Jun 3, 2013 at 9:50
  • 2
    search for tikzmark questions and answers on the main site. An example : tex.stackexchange.com/questions/60763/…
    – percusse
    Commented Jun 3, 2013 at 9:55
  • @percusse: nice, thanks! for some stupid reason I never thought it'd be named tikzmark Commented Jun 3, 2013 at 11:33

1 Answer 1

11

Here's a solution using the \subnode command from the tikzmark TikZ library.

\documentclass{article}
%\url{http://tex.stackexchange.com/q/117393/86}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\begin{tikzpicture}[remember picture]
\node {\(\displaystyle\left|
        \frac{
          \left(\sum_{i=1}^n a_i^2\right) \cdot
          \left(\sum_{i=1}^n b_i^2\right)
        }{ (\sum_{i=1}^n \underbrace{a_ib_i}_{\subnode{brace}{}})^2} \right| \geq 1\)};
\draw[->] (-3,-3) to[out=0,in=-90] (brace.north);
\end{tikzpicture}
\end{document}

I used brace.north because the subnode is actually the subscript of the underbrace, not the point of the underbrace itself. Note the remember picture on the containing environment.

arrow to underbrace

5
  • Unrelated stupid question: I see lots of image examples on tex.stackexchange -- are people just taking screen shots, or is there some webservice on tex.stackexchange that auto renders TeX and crops it online? Commented Jun 3, 2013 at 11:35
  • @interactive_tikz: I guess we all take screen shots, no web service.
    – juliohm
    Commented Jun 3, 2013 at 13:11
  • @interactive_tikz It used to be able to upload PDF, which led to many of us using the standalone class to generate the images. But that doesn't work any more so I just take a screenshot. Commented Jun 3, 2013 at 16:43
  • Can anyone tell me how can I do the same thing in TikzEdt? I've tried the code in a simple Latex code, and it worked.Thanks. Commented Jul 15, 2013 at 22:26
  • @user2536125 I've never used TikzEdt so can't help you on that, I'm afraid. Commented Jul 16, 2013 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .