当我编译以下代码时
\documentclass[tikz]{standalone}
\usepackage{luatex85}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{quotes}
\usetikzlibrary{shadows}
\begin{document}
\begin{tikzpicture}[
rect/.style={rectangle},
sum/.style={draw,circle,minimum width=0.2cm,minimum height=0.2cm,fill=white,drop shadow={shadow xshift=.3ex,shadow yshift=-.3ex}},
dot/.style={fill,circle,inner sep=1pt,outer sep=0pt},
pics/integrator/.style args={#1 and #2}{
code={
\node[sum] (-in) {};
\node[dot,right=1.5*\a of -in.center,"above:#2"] (-out) {};
\node[rect,below=0.5*\a of $(-in.center)!0.5!(-out.center)$,
"left:#1"{font=\scriptsize,yshift=-0.25cm}] (-int) {$z^{-1}$};
\draw (-in.center) -- (-out.center);
\draw[-latex] (-int.center) -| (-in.center);
\draw[-latex] (-out.center) |- (-int.center);
}
}
]
\def\a{1cm}
\pic (int) {integrator=$x_1(k)$ and $B_{coil}$};
\end{tikzpicture}
\end{document}
使用 lualatex 编译器时我收到一个奇怪的错误消息:
! Package pgf Error: No shape named intcurrent path bounding box is known.
l.29 ...c (int) {integrator=$x_1(k)$ and $B_{coil}$};
当我删除名称前缀时,一切都编译正常。
编辑:我尝试了链接问题中的解决方法,即添加.center
到每个节点,但这给了我与以前相同的错误消息。我还测试了将名称传递给 pic 并在 draw 命令中重置名称前缀。同样的错误仍然存在。
答案1
这就是为什么:
pic
⟶ sum
⟶ drop shadow
⟶ general shadow
⟶ (current path bounding box.center)
⟶ \pgfpointanchor{intcurrent path bounding box}{center}
⟶intcurrent path bounding box
不是有效名称。