我想在加载 tikzling 包的动物时添加动物的绝对位置。像这样:
\draw(1.5,.5) node {\bear};
但不幸的是,这会导致错误。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikzlings}
\usepackage{tikzlings-marmots}
\usepackage{tikzlings-bears}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw(0,0) grid(9,4);
\bear
%\draw(2.5,.5)node {\bear};
\marmot at (3,1.5);
\end{tikzpicture}
\end{document}
答案1
您可以为您的动物添加xshift
和。yshift
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikzlings}
\usepackage{tikzlings-marmots}
\usepackage{tikzlings-bears}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw(0,0) grid(9,4);
\bear[xshift=5cm,yshift=2.5cm];
\marmot[xshift=3cm];
\end{tikzpicture}
\end{document}
答案2
您还可以使用 tikzlings 作为图片并将它们放置在路径上:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikzlings}
\usepackage{tikzlings-marmots}
\usepackage{tikzlings-bears,bearwear}
\tikzset{bear/.pic={\bear\bearwear}}
\tikzset{mole/.pic={\moles}}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw(0,0) grid(9,4);
\draw(0,0) --++(0.5,0.5)pic{bear}--++(1,1) pic{bear}--++(1,1)pic{mole};
\end{tikzpicture}
\end{document}
答案3
您可以将熊的绘图保存在框中,然后在节点内使用它
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikzlings}
\usepackage{tikzlings-marmots}
\usepackage{tikzlings-bears}
\newbox\bearbox
\begin{document}
\begin{tikzpicture}[scale=2]
\savebox{\bearbox}{\bear}
\draw(0,0) grid(9,4);
\bear
\draw(2.5,.5) node {\usebox{\bearbox}};
\marmot at (3,1.5);
\end{tikzpicture}
\end{document}