图形 tikz 没有出现。我想定位它

图形 tikz 没有出现。我想定位它

我没有办法定位我的人物 maclef。它根本就没有出现。

\begin{tikzpicture}
    \begin{scope}[xshift = 0.cm, yshift = 0.cm]
        \draw[fill = lightgray]  maclef; 
    \end{scope}
\end{tikzpicture}

我想将 maclef 图形放在另一个邮箱图形旁边。maclef 图形定义为:

\newcommand{\maclef}[1][(x,y)]{% 1 个可选参数,用于 tikz 图片的选项

    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm, scale = 0.5]

%\clip(-63.65625,-38.22000000000016) rectangle (71.66437500000004,28.30125000000011);

        \draw [shift={(6.9878812572759035,4.204062863795111)},line width=2.pt]  plot[domain=-0.6874558117651883:3.7890537974086786,variable=\t]({1.*0.6367477167910794*cos(\t r)+0.*0.6367477167910794*sin(\t r)},{0.*0.6367477167910794*cos(\t r)+1.*0.6367477167910794*sin(\t r)});

        \draw [line width=2.pt] (6.98,4.26) circle (0.2cm);

        \draw [line width=2.pt] (6.7,3.6)-- (6.7,1.86);

        \draw [line width=2.pt] (6.7,1.86)-- (7.28,1.84);

        \draw [line width=2.pt] (7.28,1.84)-- (7.1,2.18);

        \draw [line width=2.pt] (7.1,2.18)-- (7.32,2.42);

        \draw [line width=2.pt] (7.32,2.42)-- (7.1,2.72);

        \draw [line width=2.pt] (7.1,2.72)-- (7.4,3.);

        \draw [line width=2.pt] (7.4,3.)-- (7.18,3.42);

        \draw [line width=2.pt] (7.18,3.42)-- (7.587100914810832,3.9886946747272374);

        \draw [line width=2.pt] (6.7,3.6)-- (6.418409541646128,3.919195140217425);

    \end{tikzpicture}
}

答案1

不确定你最终的目标是什么,但看起来你想要的是\pic。你不应该嵌套tikzpictures。

\documentclass[border=19pt]{standalone}
\usepackage{tikz}

\tikzset{
    maclef/.pic={
        \begin{scope}[
            line width=2pt,
            line cap=round,
            line join=round,
            scale = 0.5,
            pic actions
        ]
        
            \draw[shift={(6.9878812572759035,4.204062863795111)}] 
                plot[domain=-0.6874558117651883:3.7890537974086786, variable=\t]
                ({1.*0.6367477167910794*cos(\t r)+0.*0.6367477167910794*sin(\t r)},
                 {0.*0.6367477167910794*cos(\t r)+1.*0.6367477167910794*sin(\t r)});
        
            \draw
                (6.98,4.26) circle (0.2cm)
                (6.7,3.6) -- (6.7,1.86)
                (6.7,1.86) -- (7.28,1.84)
                (7.28,1.84) -- (7.1,2.18)
                (7.1,2.18) -- (7.32,2.42)
                (7.32,2.42) -- (7.1,2.72)
                (7.1,2.72) -- (7.4,3)
                (7.4,3) -- (7.18,3.42)
                (7.18,3.42) -- (7.587100914810832,3.9886946747272374)
                (6.7,3.6) -- (6.418409541646128,3.919195140217425);
        \end{scope}
    }
}

\begin{document}

\begin{tikzpicture}

        \pic[draw=lightgray] {maclef}; 

        \pic[draw=red] at (2,0) {maclef}; 

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容