I think my question is quite similar to this and this, however I didn't manage to modify the provided solutions to fit my problem.

In the following MWE I am trying to define 8 pin anchors in a \foreach loop. What I am doing is obviously wrong, as I am getting an "Undefined control sequence" error when I try to reference one of this pins.

Can someone provide a minimal example for a defining anchors in a loop?



% BEGIN myic definition


    % The following code does not work as expected.
    % I am looking for a way to define \n anchors in a loop.
    \foreach \n in {0,...,7}

        % RECTANGLE

        % PIN NAMES
        \foreach \n in {0,...,7}
            {\pgftext[right,at={\pgfpoint{.5*\w-.1cm}{7*.25cm-\n*.5cm}}]{\scriptsize IN\n}}
% END myic definition


    \draw (0,0) node[myic] (u0) {U0};
    \draw (u0.in0) to[short,-o] ++(1,0); % <- ERROR: Undefined control sequence.


Here is what I have so far, the red line with a circle is what I am not able to create:

tikzcircuit ic

  • How about this tex.stackexchange.com/questions/65192/… ? – percusse Jun 28 '14 at 14:34
  • @percusse Many thanks. It's one of the links in my question -- and I finally figured out how to modify your answer to fit my problem. – sergej Jun 28 '14 at 15:30
  • Oh must have clicked the link twice and confused myself. – percusse Jun 28 '14 at 18:59

I have finally managed to apply percusee's answer (here) to my problem. It works with the following loop:

\foreach \n in {0,...,7}{

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.