1

When I compile the following code

\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}

with the lualatex compiler I get a strange error message:

! Package pgf Error: No shape named intcurrent path bounding box is known.
l.29 ...c (int) {integrator=$x_1(k)$ and $B_{coil}$};

When I remove the name prefix everything compiles fine.

Edit: I tried the workaround from the linked questions, by adding .center to every node, but that gives me the same error message as before. I also tested the passing of the name to the pic and resetting the name prefix inside the draw command. Also the same error persists.

9
  • It's a known bug and reported to the PGF/TikZ bug tracker. You can check the duplicate for a workaround
    – percusse
    Aug 10 '17 at 11:18
  • I did try your workaround, but the error persists. I'm pretty sure this is another problem, possibly related to the mentioned one
    – Reza
    Aug 10 '17 at 11:35
  • 2
    Don't do this: \def\a{1cm} outside the picture!
    – cfr
    Aug 10 '17 at 13:24
  • @cfr what is the reason for doing this inside the picture environment?
    – Reza
    Aug 10 '17 at 13:42
  • 1
    If you say \def\a outside the picture, you will overwrite any existing macro \a with no warning. If you want it to be global, use \newcommand or, better, \newlength and \setlength. If you want to set \a regardless, do it in the tikzpicture so it doesn't affect your entire document. \def\<single letter> is very, very likely to be overwriting something LaTeX or TeX has already defined and \def does no checking whatsoever. Stuff will just break.
    – cfr
    Aug 10 '17 at 23:16
1

This is why:

pic
sum
drop shadow
general shadow
(current path bounding box.center)
\pgfpointanchor{intcurrent path bounding box}{center}
intcurrent path bounding box is not a valid name.

See How to give a name to \pic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.