将人物添加到图形中

将人物添加到图形中

我需要用包裹来替换 3 个孩子\usepackage{tikzpeople} ,并且需要添加\faFileTextO水果放在哪里。

在此处输入图片描述

在此处输入图片描述

\documentclass{article}

\usepackage{graphicx}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\node[inner sep=0pt] (boy)  at (0,0)
{\includegraphics[width=.15\textwidth]{boy.jpg}};

\node[inner sep=0pt] (girl1) at (0,5)
{\includegraphics[width=.15\textwidth]{girl.jpg}};

\node[inner sep=0pt] (girl) at (0,10)
{\includegraphics[width=.150\textwidth]{girl.jpg}};





\node[inner sep=0pt] (tangerine) at (10,0)
    {\includegraphics[width=.15\textwidth]{tangerine.png}};
\node[inner sep=0pt] (grapes) at (10,3)
    {\includegraphics[width=.15\textwidth]{grapes.png}};
%%\draw[<->,thick] (pera) -- (grapes)
   ;
\node[inner sep=0pt] (strawberry) at (10,6)
 {\includegraphics[width=.15\textwidth]{strawberry.png}};
\node[inner sep=0pt] (pera) at (10,9)
 {\includegraphics[width=.15\textwidth]{pera.png}};

\draw[-latex,thick,blue] (girl1) -- (strawberry);


\draw[<->,thick] (girl.west) to[out=-120,in=120] (boy.west);
\draw[-latex,thick] (girl) -- (grapes);
\draw[-latex,thick] (girl) -- (strawberry);
\draw[-latex,thick] (girl) -- (pera);
\draw[-latex,thick,blue] (boy) -- (strawberry);
\draw[-latex,thick,blue,fill=blue] (boy) -- (grapes);
\draw[-latex,thick] (girl) -- (tangerine);
\draw[latex-,dashed,thick] (boy) -- (pera);
\draw[latex-,dashed,thick] (boy) -- (tangerine);
\end{tikzpicture}
\end{document}

在此处输入图片描述

我已经尝试过此代码,但是它看起来不太好:

\documentclass{article}
\usepackage{fontawesome}
\usepackage{graphicx}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}

    \node[inner sep=0pt] (boy)  at (0,0){\faFileTextO};

    \node[inner sep=0pt] (girl1) at (0,5){\faFileTextO};

    \node[inner sep=0pt] (girl) at (0,10){\faFileTextO};





    \node[inner sep=0pt] (tangerine) at (10,0){\faFileTextO};
    \node[inner sep=0pt] (grapes) at (10,3){\faFileTextO};
    %%\draw[<->,thick] (pera) -- (grapes)
    ;
    \node[inner sep=0pt] (strawberry) at (10,6){\faFileTextO};
    \node[inner sep=0pt] (pera) at (10,9){\faFileTextO};

    \draw[-latex,thick,blue] (girl1) -- (strawberry);


    \draw[<->,thick] (girl.west) to[out=-120,in=120] (boy.west);
    \draw[-latex,thick] (girl) -- (grapes);
    \draw[-latex,thick] (girl) -- (strawberry);
    \draw[-latex,thick] (girl) -- (pera);
    \draw[-latex,thick,blue] (boy) -- (strawberry);
    \draw[-latex,thick,blue,fill=blue] (boy) -- (grapes);
    \draw[-latex,thick] (girl) -- (tangerine);
    \draw[latex-,dashed,thick] (boy) -- (pera);
    \draw[latex-,dashed,thick] (boy) -- (tangerine);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

正如 @cfr 所说,用你想要的东西替换你已有的东西没有问题。这是为了回答为什么你的代码不起作用的问题。这是因为你将\includegraphics符号从 中换行fontawesome。而不是例如

\node[inner sep=0pt] (boy) at (0,0) {\includegraphics[width=.15\textwidth]{\faFileTextO}}; 

你应该使用

\node[inner sep=0pt] (boy) at (0,0) {\faFileTextO};

这是带有这些修正和节点的 MWE tikzpeople

\documentclass{article}
\usepackage{fontawesome}
\usepackage{tikz}
\usepackage{tikzpeople}

\begin{document}
    \begin{tikzpicture}[scale=0.8,nodes={scale=3},every label/.append
    style={scale={0.5}}]

    \node[inner sep=0pt,bob] (boy)  at (0,0)
    {};

    \node[inner sep=0pt,alice] (girl1) at (0,5)
    {};

    \node[inner sep=0pt,alice] (girl) at (0,10)
    {};





    \node[inner sep=0pt,label=below:1] (tangerine) at (10,0)
    {\faFileTextO};
    \node[inner sep=0pt,label=below:2] (grapes) at (10,3)
    {\faFileTextO};
    %%\draw[<->,thick] (pera) -- (grapes)
    ;
    \node[inner sep=0pt,label=below:3] (strawberry) at (10,6)
    {\faFileTextO};
    \node[inner sep=0pt,label=below:4] (pera) at (10,9)
    {\faFileTextO};

    \draw[-latex,thick,blue] (girl1) -- (strawberry);


    \draw[<->,thick] (girl.west) to[out=-120,in=120] (boy.west);
    \draw[-latex,thick] (girl) -- (grapes);
    \draw[-latex,thick] (girl) -- (strawberry);
    \draw[-latex,thick] (girl) -- (pera);
    \draw[-latex,thick,blue] (boy) -- (strawberry);
    \draw[-latex,thick,blue,fill=blue] (boy) -- (grapes);
    \draw[-latex,thick] (girl) -- (tangerine);
    \draw[latex-,dashed,thick] (boy) -- (pera);
    \draw[latex-,dashed,thick] (boy) -- (tangerine);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容