我有以下代码
\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}
这创建了一个会说话的气泡,但我想在气泡上创建气泡。我尝试使用\bubblethis
函数两次,但它会生成第二个气泡两次。要了解我的意思,请键入\bubblethis{B}{\bubblethis{I know X}{I know a}}
。如果有人对代码进行很好的调整,那就太好了。感谢您的帮助
这张照片正是我想要的。
答案1
我为那些正在努力解决同类问题的人提供答案,以节省他/她的时间。
\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}