2

I have some trouble reproducing an equation in LaTeX. I have tried a little, but I still have trouble around how to properly anchor the path from and to nodes. I am trying to reproduce the image.

Also, is there an option to have the first equation be centered in the middle and the cloud one aligned to the left? Centering as an environment always centers the whole figure, not just one node.

What I am trying to reproduce

I got two arcs so far, both not quite what I am looking for:

\begin{tikzpicture}
    \node (E) at (2,0) {$a^2=\Big(b\cdot \sin (\alpha)\Big)^2+n^2$};
    \node[cloud, cloud puffs=15.7, cloud ignores aspect, minimum width=3cm, minimum height=0.5cm, align=center, draw] (C) at (-5,-2.2) {$h=b\cdot \sin (\alpha)$};
    \draw [thick, ->] (C) to [out=30,in=270,in looseness=0.25] (E);
    \draw [->] (C) to [out=90,bend right=45] (E);
\end{tikzpicture}

Which gives me this result:

Enter image description here

2 Answers 2

5

You can do this with tikzmark. I added the bending library to get the arrow aligned nicer.

Make a displayed equation and mark the equals sign with \tikzmark{<name>}. Then add [remember picture, overlay] to your tikzpicture and draw the arrow to ({pic cs:<name>}). I added a shift to place the arrowhead.

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,tikzmark,bending}

\begin{document}

\[a^2\tikzmark{eq}=\big(b\cdot \sin (\alpha)\big)^2+n^2\]
\begin{tikzpicture}[remember picture, overlay]  
    \node[cloud, cloud puffs=15.7, cloud ignores aspect, minimum width=3cm, minimum height=0.5cm, align=center, draw] (C) at (2,-.5) {$h=b\cdot \sin (\alpha)$};
    \draw [thick, ->] (C.east) to [out=0,in=270,in looseness=0.25] ([shift={(.2,-.1)}]{pic cs:eq});
\end{tikzpicture}
\end{document}
4

This could achieve what you want. If you don't wanna some of the paths taking space, just put them in a scope and set the overlay option to that scope. However you need set appropriate vertical space after the tikz env to avoid the cloud node overlap the rest of the contents.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}
{\noindent\centering\begin{tikzpicture}
    \node (E) at (0,0) {$a^2=\Big(b\cdot \sin (\alpha)\Big)^2+n^2$};
    \begin{scope}[overlay]
    \node[cloud,cloud puffs=15.7, cloud ignores aspect, minimum width=3cm, minimum height=0.5cm, align=center, draw] (C) at (-2.8,-1) {$h=b\cdot \sin (\alpha)$};
    \draw [thick, ->] (C.10) to [out=0,in=-90] ([xshift=-1cm,yshift=0.3cm]E.south);
    \end{scope}
\end{tikzpicture}\par\vspace{1cm}}
\lipsum[1]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.