代码永远在 tikz 图片中编译

代码永远在 tikz 图片中编译

我正在运行以下代码,但它不起作用,它一直在编译。情节与这篇文章相关,并归功于薛定谔的猫tikzpeople我只想用和 替换所有数字{\faFileTextO}

这是有效的原始代码:

\documentclass{standalone}
\usepackage{graphicx} % in real document remove option "demo"
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning}

\begin{document}

  \begin{tikzpicture}[
node distance = 4mm and 44mm,
start chain = A going below,
every node/.style = {inner sep=0pt, outer sep=2mm, rounded corners,
    text width=0.15\linewidth,
    on chain=A},
arr/.style = {color=#1, ultra thick, -{Straight Barb[angle=60:2pt 3]}}
]
\setkeys{Gin}{width=\linewidth}
 % I want to add bob, alice  here 
\node   {\includegraphics{girl.jpg}};    % A-1
\node   {\includegraphics{girl.jpg}};
\node   {\includegraphics{boy.jpg}};   % A-3
%
\node[above right=of A-1.east]
 %I want to add {\faFileTextO} here
{\includegraphics{pera.png}};         % A-4
\node   {\includegraphics{grapes.png}};
\node   {\includegraphics{strawberry.png}};
\node   {\includegraphics{naranja.jpeg}};    % A-7
%


\draw[red, ultra thick,
{Straight Barb[angle=60:2pt 3]}-{Straight Barb[angle=60:2pt 3]}
]  (A-4.east) to [bend left=45] (A-6.east);    


\foreach \i in {4,6,7}
\draw[arr=black] (A-1.east) -- (A-\i);

\draw[arr=blue!50!gray] (A-2.east) -- (A-4);
\draw[arr=blue!50!gray] (A-2.east) -- (A-6);
\foreach \i in {6}
\draw[arr=purple!50!gray] (A-3.east) -- (A-\i);
%
\draw[arr=orange,densely dashed] (A-4) -- (A-3);
%\draw[arr=brown,densely dashed] (A-7) -- (A-3);

\draw[arr=orange, ultra thick,dashed,
{}-{Straight Barb[angle=60:2pt 3]}
]  (A-7) to [bend left=45] (A-3);
\end{tikzpicture}

\end{document}

答案1

这是我修复节点的代码。另一件需要修复的事情是,由于标签也是节点,所以链条被搞乱了。chains 很有用,但我个人认为无论如何都不应该使用它们。不过我还是把它保留在这里并修复了这个问题。我还简化了箭头的使用,我认为没有必要重复几次,在我看来,如果所有箭头都应该是那种类型,{Straight Barb[angle=60:2pt 3]}那就简单多了。>={Straight Barb[angle=60:2pt 3]}

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning}
\usepackage{fontawesome}
\usepackage{tikzpeople}

\begin{document}

\begin{tikzpicture}[node distance = 8mm and 44mm,
    start chain = A going below,
    oh no/.style = {inner sep=0pt, rounded corners,scale=pi,
        on chain=A},
    >={Straight Barb[angle=60:2pt 3]},  
    arr/.style = {color=#1, ultra thick,->}
    ]
    \node[oh no,alice]  {};  % A-1
    \node[oh no,alice] {};
    \node[oh no,bob]  {};% A-3
    %
    \node[oh no,above right=of A-1.east,label=below:4]{\faFileTextO};         % A-4
    \node[oh no,label=below:4]  {\faFileTextO};
    \node[oh no,label=below:4]  {\faFileTextO};
    \node[oh no,label=below:4]   {\faFileTextO};    % A-7
% 
    \draw[red, ultra thick,<->]  (A-4.east) to [bend left=45] (A-6.east);    


    \foreach \i in {4,6,7}
    {\draw[arr=black] (A-1.east) -- (A-\i);}

    \draw[arr=blue!50!gray] (A-2.east) -- (A-4);
    \draw[arr=blue!50!gray] (A-2.east) -- (A-6);
    \foreach \i in {6}
    {\draw[arr=purple!50!gray] (A-3.east) -- (A-\i);}
    %
    \draw[arr=orange,densely dashed] (A-4) -- (A-3);
    %\draw[arr=brown,densely dashed] (A-7) -- (A-3);

    \draw[arr=orange, ultra thick,dashed,->]  (A-7) to [bend left=45] (A-3);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容