如何从外部矢量图形制作符号以用于 TikZ 节点?

如何从外部矢量图形制作符号以用于 TikZ 节点?

我有一段生成文本框的代码,我有一个 .pdf 矢量图形,我想为其添加一个锚点定义,并使用类似的命令在任何我想要的地方使用它\myvectorimage

\begin{tikzpicture}[
    node distance = 3mm,
    box/.style = {inner sep=0pt},
    lbl/.style = {draw, line width=2pt, rounded corners=10pt, inner sep=3mm, text width=44mm}
                      ]
    \node (first) at (5,5) [lbl]  {This text box is pointing somewhere};
    \node[anchor=south] at (first.north west) {\myvectorimage}
%above is only to show how i'm intending to use my graphics.

\end{tikzpicture}

这是我想要使用的图形: https://i.stack.imgur.com/iWz5l.jpg https://i.stack.imgur.com/vHlwo.jpg

这或多或少就是我想要的样子: https://i.stack.imgur.com/vHlwo.jpg

答案1

在这里,我纠正了语法错误(缺失]、缺失;、杂散空白行),并且只使用了一个\includegraphics来包含图像。

\documentclass{article}
\usepackage{tikz}
\newcommand\myvectorimage{\includegraphics{xNiad3b}}
\begin{document}
\begin{tikzpicture}[
    node distance = 3mm,
    box/.style = {inner sep=0pt},
    lbl/.style = {draw, line width=2pt, rounded corners=10pt, inner sep=3mm, text width=44mm}]                      ]
    \node (first) at (5,5) [lbl]  {This text box is pointing somewhere};
    \node[anchor=south] at (first.north west) {\myvectorimage};
%above is only to show how i'm intending to use my graphics.
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容