7

I have the following code

 \documentclass[12pt]{article}
 \usepackage{tikz}
 \usetikzlibrary{calc,shapes.callouts,shapes.arrows}
 \newcommand{\bubblethis}[2]{
    \tikz[remember picture,baseline]{\node[anchor=base,inner sep=0,outer sep=0]%
    (#1) {\underline{#1}};\node[overlay,cloud callout,callout relative pointer={(0.2cm,-0.7cm)},%
    aspect=2.5,fill=yellow!90] at ($(#1.north)+(-0.5cm,1.6cm)$) {#2};}%
}%

 \begin{document}
 \bubblethis{B}{I know X}
 \end{document}

This creates a talking bubble but I want to create bubble over bubbles. I tried using \bubblethis function twice but it makes second balloon twice. To see what I mean by typing \bubblethis{B}{\bubblethis{I know X}{I know a}}. If someone makes a good tweak the code that would be great. Thanks for any help

This picture is sort of what I want.

enter image description here

  • It is not exactly clear how you want the result to look. Two bubbles side by side? One small bubble sitting inside the other larger bubble? Based on your proposed syntax, I am thinking the latter, but a clarification would help. – Steven B. Segletes Jun 5 '14 at 17:48
  • 1
    Is this closer to what you want??: \setbox0=\hbox{\bubblethis{B}{I know X}}\bubblethis{A}{\box0{I know a}} or else \bubblethis{B}{\bubblethis{A}{I know B}I know X} – Steven B. Segletes Jun 5 '14 at 17:52
  • @StevenB.Segletes: The first one is want I wanted except positioning, but I will figure out that. Thanks very much! – user64066 Jun 5 '14 at 18:04
  • 1
    @user64066, why don't you upload an image of what you are trying to achieve so that the others would know what do you exactly mean bubble over bubble? Even a hand-drawn image would suffice. – Pouya Jun 5 '14 at 19:29
  • You may want to take a look at this question: tex.stackexchange.com/questions/38805/… – schmendrich Jun 6 '14 at 14:07
7

I am putting my answer for someone who is struggling with same type of question in order to save his/her time.

 \documentclass[12pt]{article}
 \usepackage{tikz}
 \usetikzlibrary{calc,shapes.callouts,shapes.arrows}
 \newcommand{\bubblethis}[2]{
\tikz[remember picture,baseline]{\node[anchor=base,inner sep=0,outer sep=0]%
(#1) {#1};\node[overlay,cloud callout,callout relative pointer={(-0.2cm,-0.2cm)},%
aspect=1.5,fill=yellow!90] at ($(#1.north)+(0.8cm,0.4cm)$) {#2};}%
}%

\newcommand{\bubble}[3]{
\tikz[remember picture,baseline]{\node[anchor=base,inner sep=0,outer sep=0] %
(#1)  {#1};\node[overlay,cloud callout,callout relative pointer= {(0.2cm,-0.4cm)},aspect=2.5,fill=red] at($(#1.north)+(-0.5cm,1.6cm)$) {#2};\node[overlay,cloud callout, callout relative pointer={((-0.4,-0.3))},aspect=3,fill=green] at($(#1.north)+(2cm,4cm)$) {#3};}


}

\begin{document}
\vspace*{4cm}
\centering
\bubble{B}{I know}{\bubblethis{A}{B}}
\end{document}

speech bubble

| improve this answer | |

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.