答案1
您可以在 Ti 中包含图形钾Z 图片和森林树木。因此,只需example-image-a
用汽车图像和example-image-b
树木图像替换即可。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{forest}
\usetikzlibrary{shapes.geometric,positioning}
\tikzset{elli/.style={ellipse,draw}}
\begin{document}
\begin{forest}
for tree={l sep+=1em,where level=2{elli}{}}
[{\includegraphics[width=1.5cm]{example-image-a}},alias=car
[{\{word\}},alias=wordL
[word,alias=elli1]
[word,alias=elli2]
[word,alias=elli3]
[word,alias=elli4]
]
]
\node[right=2em of elli4,elli] (elliR) {word};
\node (wordR) at (elliR|-wordL) {{\{word\}}};
\node (tree) at (elliR|-car) {\includegraphics[width=1.5cm]{example-image-b}};
\draw (tree) -- (wordR) foreach \X in {3,4,R}
{(wordR) -- (elli\X)};
\end{forest}
\end{document}
只是为了好玩:画汽车和树与 Ti钾Z。
\documentclass[border=3.14mm]{standalone}
\usepackage{forest}
\usepackage{tikzducks}
\usetikzlibrary{shapes.geometric,positioning}
\usetikzlibrary{decorations.pathmorphing,shapes}
\tikzset{elli/.style={ellipse,draw}}
\newsavebox\Car
\newsavebox\Tree
\begin{document}
\begin{lrbox}{\Car}
\begin{tikzpicture} see https://tex.stackexchange.com/users/101651/carlatex
\fill (-4.7,-0.8) arc(180:0:1.7 and 1.1) --cycle;
\fill (1.3,-0.8) arc(180:0:1.7 and 1.1) --cycle;
% right front wheel
\fill (-3.3,-0.1) circle (1.5cm);
% left front wheel
\shade[inner color=black,outer color=black!70] (-3,-0.7) circle (1.5cm);
\fill[black!20!white] (-3,-0.7) circle (0.8cm);
\foreach \X in {0,30,...,330} {\fill[black] (-3,-0.7) +({\X-5}:0.6) circle (1pt);}
% back wheel
\fill (2.7,-0.1) circle (1.5cm);
% back wheel left
\shade[inner color=black,outer color=black!70] (3,-0.7) circle (1.5cm);
\fill[black!20!white] (3,-0.7) circle (0.8cm);
\foreach \X in {0,30,...,330} {\fill[black] (3,-0.7) +({\X+11}:0.6) circle (1pt);}
% seat
\fill[top color=red,bottom color=red!20!black] (2.9,2.2) arc(0:360:3 and 0.3);
% driver
\begin{scope}[xshift=-2.3cm,yshift=1cm,scale=1.5]
\duck[squareglasses=blue!50!black,longhair=black];
\end{scope}
% right light
\shade[bottom color=red,top color=red!30] (-4.35,1) arc(-90:90:0.3 and 0.4) |-
cycle;
\shade[bottom color=yellow!30,top color=white] (-4.45,1) arc(-90:270:0.1 and
0.4);
% body
\shade[bottom color=red,top color=red!30] (-4.7,-0.8) arc(180:0:1.7) -- (-1.3,-0.8) -- (1.3,-0.8) arc(180:0:1.7)
-- (4.9,-0.8) arc(0:90:2 and 3)
arc(0:-180:3 and 0.3)
-- (-2.9,2.2) arc(90:180:2 and 3) -- cycle;
\shade[bottom color=red,top color=red!30] (-4.7,-0.8) arc(180:0:1.7 and 1.1) arc(0:180:1.7 and 1.8);
\shade[bottom color=red,top color=red!30] (1.3,-0.8) arc(180:0:1.7 and 1.1) arc(0:180:1.7 and 1.8);
% door
\draw[very thin] (1.1,1.9) to[out=-90,in=80] (1,-0.6) -- (-1,-0.6)
to[out=110,in=-90] (-1.1,1.9);
\node[blue,font=\sffamily\Huge] at (0,0.8) {\LaTeX};
% left light
\shade[bottom color=red,top color=red!30] (-4.4,0.8) arc(-90:90:0.3 and 0.4) |-
cycle;
\shade[bottom color=yellow!30,top color=white] (-4.4,0.8) arc(-90:270:0.1 and
0.4);
% windshield
\shade[bottom color=blue,top color=blue!20,opacity=0.3]
(-3.2,2.2) arc(180:130:3 and 0.3) arc(180:150:2.5 and 4)
arc(130:180:3 and 0.3) -- cycle;
\shade[bottom color=blue,top color=blue!20,opacity=0.3]
(-3.2,2.2) arc(180:230:3 and 0.3) arc(180:150:2.5 and 4)
arc(230:180:3 and 0.3) -- cycle;
\end{tikzpicture}
\end{lrbox}%
\begin{lrbox}{\Tree}
\begin{tikzpicture}[treetop/.style = {% from https://tex.stackexchange.com/a/101113/121799
decoration={random steps, segment length=0.4mm},
decorate
},
trunk/.style = {
decoration={random steps, segment length=2mm, amplitude=0.2mm},
decorate
}]
\foreach \w/\f in {0.3/30,0.2/50,0.1/70} {
\fill [brown!\f!black, trunk] (0,0) ++(-\w/2,0) rectangle +(\w,-3);
}
\foreach \n/\f in {1.4/40,1.2/50,1/60,0.8/70,0.6/80,0.4/90} {
\fill [green!\f!black, treetop] ellipse (\n/1.5 and \n);
}
\end{tikzpicture}
\end{lrbox}%
\begin{forest}
for tree={l sep+=1em,where level=2{elli}{}}
[{\usebox\Car},scale=0.2,alias=car
[{\{word\}},alias=wordL
[word,alias=elli1]
[word,alias=elli2]
[word,alias=elli3]
[word,alias=elli4]
]
]
\node[right=2em of elli4,elli] (elliR) {word};
\node (wordR) at (elliR|-wordL) {{\{word\}}};
\node[xscale=0.4,yscale=0.25] (tree) at (elliR|-car) {\usebox\Tree};
\draw (tree) -- (wordR) foreach \X in {3,4,R}
{(wordR) -- (elli\X)};
\end{forest}
\end{document}
不用担心,这是电动车,所以树应该没问题,而且使用起来很安全forest
。