31

Is it possible to anchor a TiKZ-pic on an internal anchor?

I know (more or less) how to use TiKZ pics and know that they are draw arround their origin. What I would like to be sure is that it's not possible to use another internal coordinate as origin.

As an example consider next code.

\tikzset{
    mytest/.pic = {
         \node  (-A) at (0,0) {A};
         \node  (-B) at (0,1) {B};
             \node[fit=(-A) (-B),draw] (-C) {};
    }
}

It defines a pic with three nodes: A, B and C being A.center the pic origin. A command like

\draw pic (T) at (2,1) {mytest};

draws the pic with A.center at (2,1).

Now, I would like to draw this pic but selecting B.center (or any other internal anchor like C.120) as anchoring (pic-origin) point. Is it possible?

In case you needed, there is some complete code:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{fit}

\tikzset{
    mytest/.pic = {
         \node  (-A) at (0,0) {A};
         \node  (-B) at (0,1) {B};
             \node[fit=(-A) (-B),draw] (-C) {};
    }
}

\begin{document}
\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\draw pic (S) at (0,0) {mytest};

\draw pic (T) at (2,1) {mytest};

\draw (S-A.north) to [out=90,in=-90] (T-B.south);

\end{tikzpicture}
\end{document}

Question updates:

  • I would like a general solution. For this particular case I know that node B.center is 1cm above A.center and it's easy to shift the whole picture, but it's more difficult to shitf it if the origin must be at C.120 or C.100-|B.35. Consider also some pic with variable size nodes.
  • The example is just an example. I'm not trying to solve a particular problem. The question is more ... conceptual(?).
  • The answer could be no, it's not possible. But, please, with some explanation as I always ask to my students ;-)
7
  • What about scoping the pic code with a shift option? Commented Jun 17, 2014 at 12:39
  • How "dynamic" are your anchors? As far as I'm aware, the way to do this is to internally shift the whole pic so that a given point is now at (0,0) (in the pics coordinate system). But doing this involved knowing at the start of the pic where the desired anchor point is going to be. Is that easily computable in your use-cases (as it is in your example)? Commented Jun 17, 2014 at 12:41
  • @ClaudioFiandrino Imagin a pic with not fixed dimensions, can I also shift it? I've updated the question.
    – Ignasi
    Commented Jun 17, 2014 at 12:59
  • @LoopSpace My user-case doesn't exist but the first time I thought about it was trying to replace avoid using a pgfnewshape and using a pic.
    – Ignasi
    Commented Jun 17, 2014 at 13:02
  • @Ignasi: I posted as answer what I was proposing. If this is what you are looking for, I can add more details. Commented Jun 17, 2014 at 13:10

4 Answers 4

26

Apparently, the idea of scoping the relevant code in pics works.

Here is an example:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{fit}

\tikzset{pic shift/.store in=\shiftcoord,
    pic shift={(0,0)},
    mytest/.pic = {
             \begin{scope}[shift={\shiftcoord}]
         \node  (-A) at (0,0) {A};
         \node  (-B) at (0,1) {B};
             \node[fit=(-A) (-B),draw] (-C) {};
         \end{scope}
    }
}

\begin{document}
\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\draw pic (S) at (0,0) {mytest};

\draw pic (T) at (2,1) {mytest};

\draw (S-A.north) to [out=90,in=-90] (T-B.south);

\end{tikzpicture}
\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\draw[pic shift={(1,1)}] pic (S) at (0,0) {mytest};

\draw pic (T) at (2,1) {mytest};

\draw (S-A.north) to [out=90,in=-90] (T-B.south);

\end{tikzpicture}
\end{document}

The result without shifts:

enter image description here

while shifting the first pic (S):

enter image description here

EDIT

Trying to answer to last Ignasi's comment: Can I still use your code to place any internal pic coordinate on a desired place?

Probably, the answer is: yes, to some extent. Meaning that in a tikzpicture, while referring to a pic, you are actually taking into account his origin, namely whatever is placed in the coordinate (0,0). In the current case, node A. So, you can shift the complete pic with respect to this point, but I suspect you can not place any internal pic coordinate on a desired place. You can place any pic coordinate on a desired place as a consequence of having shifted the pic with respect to its origin.

Let us consider the following example:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{fit,positioning}

% code by Andrew:
% https://tex.stackexchange.com/a/33765/13304
\makeatletter
\newcommand{\gettikzxy}[3]{%
  \tikz@scan@one@point\pgfutil@firstofone#1\relax
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}
\makeatother

\tikzset{pic shift/.store in=\shiftcoord,
    pic shift={(0,0)},
    pic-a min height/.store in=\picaminheight,
    pic-a min height=0pt,
    pic-a min width/.store in=\picaminwidth,
    pic-a min width=0pt,
    mytest/.pic = {
         \begin{scope}[shift={\shiftcoord}]
         \node[minimum height=\picaminheight,
               minimum width=\picaminwidth,
               draw]  (-A) at (0,0) {A};
         \node  (-B) at (0,1) {B};
             \node[fit=(-A) (-B),draw] (-C) {};
         \end{scope}
    }
}

\begin{document}

\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\draw[pic-a min height=1cm,
 pic-a min width=1cm,
 pic shift={(1,1)}] pic (S) at (0,0) {mytest} node[coordinate] (sn){};

\gettikzxy{(S-C.east)}{\sbx}{\sby}

\draw[red,pic shift={(\sbx,\sby)}] pic (T) at (0,0) {mytest};

\gettikzxy{(S-C.south)}{\sdx}{\sdy}
\draw[blue,pic shift={(\sdx,\sdy)}] pic (T) at (0,0) {mytest};

\gettikzxy{(S-C.east)}{\sex}{\sey}
\draw[pic-a min width=0cm,green!75!black,pic shift={(\sex,\sey)}] pic (O) at (1,0) {mytest};

\end{tikzpicture}
\end{document}

which leads to:

enter image description here

Recalling that the origin of mytest is node -A, we have the first pic (S) with increased size denoted in black. It will be our reference.

Thanks to Andrew's \gettikzxy, we can grab coordinates of (S-C.east). The second mytest pic (T), in red, is placed in position (0,0) (of the general tikzpicture) and we operate a shift into (S-C.east) coordinates. As expected, (T-A) is put in (S-C.east). The same happens for pic M. However, apparently it is not possible to anchor pics with respect to their C node points. What you can do, is to take advantage of both pic shift and coordinate placement for anchoring a pic with respect to his C node (I admit, is not that elegant). For example the green (O) mytest pic is anchored with respect to his -C.south east point in (1,3).

9
  • Thanks for the code. It's nice but I'm not sure if it solves all problems. Can I use it to place C.south west (from a third pic) on right=2cm and 3mm of S-A.30?
    – Ignasi
    Commented Jun 17, 2014 at 13:31
  • @Ignasi: you're welcome! I'm not sure to understand 100% the question. Are you looking for a way to place only part of your pic (C node fitting A and B)? In the answer, shifting operation always need a pair of coordinates, namely you can't set pic shift={(S-A.north)} because, you know, a pic prefixes his name. Commented Jun 17, 2014 at 13:39
  • 2
    Let me try again. How can I use your code to place a complete pic with its internal -C.30 anchor on (2,3)? More complex, imagin a pic with args which modifiy A (or B) width and height, C will vary accordingly and I don't know exact dimensions. Can I still use your code to place any internal pic coordinate on a desired place?
    – Ignasi
    Commented Jun 17, 2014 at 14:09
  • @Ignasi: I investigated a bit, please see my updated answer. Commented Jun 18, 2014 at 8:13
  • Thank you again for your effort. I'll need some time to understand it but I think it doesn't solve my intended question. Although I admit that my written question could be different from my intended one. That's the problem when someone tries to express ideas in a non mother tongue. I'll study your code and if I need more help will make a follow-up question.
    – Ignasi
    Commented Jun 18, 2014 at 9:02
6

Here's a tikzmark solution. The point of tikzmark is that it writes the location of a position on the page to the aux file so that it can be read in on the next compilation. So to figure out where to locate the pic, we write out the location of the desired anchor and then on the next compilation we use that to shift the pic.

Of course, this then shifts the pic and so the location of the anchor point. But actually what we want is the relative displacement of the anchor point from the pic's origin and that doesn't change so we write both the origin and anchor point.

This does mean that the shift code has to be included in the pic code. If you have complete control over the pic code then this is easy. If not, you can wrap the existing pic in a new one with the shift code.

Now, I figured that this was quite a useful thing to be able to do so I've added it to the latest version of tikzmark which is (at time of writing - I'll update this when it gets uploaded to CTAN) available from github (download tikzmark.dtx and run tex tikzmark.dtx).

Here's an example of it with your code. The red dots are the points where the pics are located. Note that the pic anchor is specified in internal coordinates, so if there is a pic name then it isn't used.

\documentclass[tikz,border=2mm]{standalone}
%\url{https://tex.stackexchange.com/q/185279/86}
\usetikzlibrary{fit,tikzmark}

\tikzset{
  mytest/.pic = {
    \begin{scope}[adjust pic position]
    \node  (-A) at (0,0) {A};
    \node  (-B) at (0,1) {B};
    \node[fit=(-A) (-B),draw] (-C) {};
    \end{scope}
  }
}

\begin{document}
\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\fill[red] (0,0) circle[radius=3pt];
\fill[red] (2,1) circle[radius=3pt];

\draw[pic anchor=(-B.center)] pic (S) at (0,0) {mytest};

\draw[pic anchor=(-C.120)] pic (T) at (2,1) {mytest};

\draw (S-A.north) to [out=90,in=-90] (T-B.south);

\end{tikzpicture}
\end{document}

Relocating pics

1
  • Just to note that I'm experimenting with the exact syntax of this for inclusion in the tikzmark library. Please check the documentation for whatever version of tikzmark you have for the correct syntax to use. Commented Aug 31, 2021 at 19:24
5

As though Claudio has given a complete answer, I think there's a simpler one, which may be either a bug or an undocumented feature of TikZ (because it's not in the Manual). It's not a complete answer because you cannot use all internal coordinates of the pic but rather just the coordinates from the node placed at the origin.

Out of curiosity I tried to put a node at the pic's origin and access its anchors through the pic command, and guess what? It works. So, apperantly just make a pic with a node as bounding box and you can place it with respect to its anchors!

\documentclass[tikz,border=2mm]{standalone}

\tikzset{mytest/.pic = {\node[draw, minimum height=1.5cm, minimum width=.5cm] (-box) at (0,0) {};
                   \node[above] (-A) at (-box.south) {A};
                   \node[below] (-B) at (-box.north) {B};}
}

\begin{document}
\begin{tikzpicture}

\draw[blue!20] (0,0) grid (3,3);

\draw pic[anchor=south west] (S) at (0,0) {mytest};

\draw pic[below left=1mm] (T) at (2,2) {mytest};

\draw (S-A.north) to [out=90,in=-90] (T-B.south);

\end{tikzpicture}
\end{document}

enter image description here

2
  • I don't think that's what happens here. Instead, with \draw pic[anchor=south west] {mytest}; the pic code inherits the anchor=south west so the -box node is anchored south west. It works here but if you draw another node in the pic it will also be anchored south west. A solution would be to reset anchor after making the first node.
    – jeremie
    Commented Nov 3, 2021 at 7:53
  • 1
    I don't think I understood you correctly. However, the main idea here is to have a bounding box node, one that would act as the pics anchor points. Perhaps if you could share an example where this fails I'd be glad to see it! Commented Nov 3, 2021 at 19:28
4

This extends the answer of Claudio Fiandrino which uses the \gettikzxy by Andrew.

I missed the possibility of anchoring a pic with any internal coordinate, at some other pic internal coordinate. E.g. placing the lower left corner of my pic in the middle of the diamond of another pic.

New solution:

This is done using my new coommand \placePic:

\placePic{<new pic name>}
         {<placement coord.>}
         {<pic type>}
         {<anchor, internal coord. extension>}
         {<pic actions>}

It requires that:

  • The internal coordinates are defined before drawing
  • The internal coordinates to be defined within the scope which shifts the pic

The drawing must be done within

\ifnum\drawit = 1
    % Drawing of the pic
\fi

As with this pic:

Example pic

placement square/.pic=
{

    \def\sideLen{4mm}
    \def\flapLen{0.7mm}
    \def\fillPercentage{0.8}
    \def\cornerMarkLen{1mm}

    \begin{scope}[thick, shift={\shiftcoord}, xscale=\xscaling, yscale=\yscaling]
        
        % Coordinates must be inside of scope which does the shifting.
        % All coordinates must be defined before drawing
        \coordinate (-center) at (0,0);
        \coordinate (-left) at (-\sideLen/2-\flapLen,0);
        \coordinate (-upper) at (0,\sideLen/2+\flapLen);
        \coordinate (-right) at (\sideLen/2+\flapLen,0);
        \coordinate (-lower) at (0,-\sideLen/2-\flapLen);
        \coordinate (-upper left) at (-\sideLen/2,\sideLen/2);
        \coordinate (-upper right) at (\sideLen/2,\sideLen/2);
        \coordinate (-lower left) at (-\sideLen/2,-\sideLen/2);
        \coordinate (-lower right) at (\sideLen/2,-\sideLen/2);
        
        % The drawing
        \ifnum\drawit = 1
            % Rectangle
            \draw[pic actions] (-\sideLen/2,-\sideLen/2) rectangle +(\sideLen,\sideLen);
            \fill[pic actions, very thin, opacity=0.2] (-\sideLen/2*\fillPercentage,-\sideLen/2*\fillPercentage) 
                rectangle +(\sideLen*\fillPercentage,\sideLen*\fillPercentage);
            % Cross
            \draw[pic actions] (-center.center)
                edge (-left)
                edge (-upper)
                edge (-right)
                edge (-lower);

            \node[opacity=1] at (-center) {a};

            % Orientation mark at corner
            \draw[pic actions, green!80!black, opacity=1] ([yshift=\cornerMarkLen]-lower right.center)
                -- (-lower right.center)
                -- +(-\cornerMarkLen,0);
        \fi

    \end{scope}
}

Here with a whole example, showing its benefits:

Whole example

\documentclass[tikz,border=2cm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{shapes.geometric}


% code by Andrew:
% https://tex.stackexchange.com/a/33765/13304
\makeatletter
\newcommand{\gettikzxy}[3]{%
  \tikz@scan@one@point\pgfutil@firstofone#1\relax
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}
\makeatother

% #1 = name of new placement
% #2 = where to place (e.g. myA-star)
% #3 = pic type
% #4 = internal node to use as anchor (eg. -left point)
% #5 = pic actions (other settings than color e.g. xshift, opacity, ...)
\newcommand{\placePic}[5]
{
    \path pic[draw it=0] (#1-PATH) at (0,0) {#3};
    \gettikzxy{(#1-PATH#4)}{\sdx}{\sdy}
    \gettikzxy{#2}{\sbx}{\sby}
    \def\newX{\sbx - \sdx}
    \def\newY{\sby - \sdy}
    \path [draw it=1, pic shift={(\newX,\newY)}] pic[#5] (#1) at (0,0) {#3};
}

\tikzset
{
    % Relative positioning variables
    pic shift/.store in=\shiftcoord,
    pic shift={(0,0)},
    draw it/.store in=\drawit,
    draw it=1,
    xscaling/.store in=\xscaling,
    xscaling=1,
    yscaling/.store in=\yscaling,
    yscaling=1,
    %
    base rectangle/.pic=
    {
        \begin{scope}[shift={\shiftcoord}]
            \draw[very thick,pic actions] (0,0) rectangle (2,2);
            \node[draw,circle,minimum size=2mm,inner sep=0,thick,pic actions] (-circle) at (.5,.5) {};
            \node[draw,rectangle,minimum size=2mm,inner sep=0,thick,pic actions] (-square) at (.5,1.5) {};
            \node[draw,diamond,minimum size=2.5mm,inner sep=0,thick,pic actions] (-diamond) at (1.5,1.5) {};
            \node[draw,star,minimum size=2.5mm,inner sep=0,thick,pic actions] (-star) at (1.5,.5) {};
        \end{scope}
    },
    placement square/.pic=
    {

        \def\sideLen{4mm}
        \def\flapLen{0.7mm}
        \def\fillPercentage{0.8}
        \def\cornerMarkLen{1mm}

        \begin{scope}[thick, shift={\shiftcoord}, xscale=\xscaling, yscale=\yscaling]
            
            % Coordinates must be inside of scope which does the shifting. That is "shift={\shiftcoord}"
            % All coordinates must be defined before drawing
            \coordinate (-center) at (0,0);
            \coordinate (-left) at (-\sideLen/2-\flapLen,0);
            \coordinate (-upper) at (0,\sideLen/2+\flapLen);
            \coordinate (-right) at (\sideLen/2+\flapLen,0);
            \coordinate (-lower) at (0,-\sideLen/2-\flapLen);
            \coordinate (-upper left) at (-\sideLen/2,\sideLen/2);
            \coordinate (-upper right) at (\sideLen/2,\sideLen/2);
            \coordinate (-lower left) at (-\sideLen/2,-\sideLen/2);
            \coordinate (-lower right) at (\sideLen/2,-\sideLen/2);
            
            % The drawing
            \ifnum\drawit = 1
                % Rectangle
                \draw[pic actions] (-\sideLen/2,-\sideLen/2) rectangle +(\sideLen,\sideLen);
                \fill[pic actions, very thin, opacity=0.2] (-\sideLen/2*\fillPercentage,-\sideLen/2*\fillPercentage) 
                    rectangle +(\sideLen*\fillPercentage,\sideLen*\fillPercentage);
                % Cross
                \draw[pic actions] (-center.center)
                    edge (-left)
                    edge (-upper)
                    edge (-right)
                    edge (-lower);

                \node[opacity=1] at (-center) {a};

                % Orientation mark at corner
                \draw[pic actions, green!80!black, opacity=1] ([yshift=\cornerMarkLen]-lower right.center)
                    -- (-lower right.center)
                    -- +(-\cornerMarkLen,0);
            \fi

        \end{scope}
    }
}


\begin{document}
\begin{tikzpicture}
    % Help lines (grid)
    \draw[help lines,ultra thin,step=5mm] (-.5,-.5) grid (2.5,2.5);
    \draw[help lines,thin,step=10mm] (-.5,-.5) grid (2.5,2.5);

    \pic[black] (base) at (0,0) {base rectangle};

    % #1 = name of new placement
    % #2 = where to place (e.g. myA-star)
    % #3 = pic type
    % #4 = internal node to use as anchor (eg. -left point)
    % #5 = pic actions (other settings than color e.g. xshift, opacity, ...)
    \placePic{red square}
             {(base-circle)}{placement square}{-lower}
             {red, opacity=0.5}
    \placePic{cyan square}
             {(base-star)}{placement square}{-right}
             {cyan, opacity=0.5}
    \placePic{blue square}
             {(base-diamond)}{placement square}{-lower left}
             {blue, opacity=0.5,yscaling=-1}
    \placePic{orange square}
             {(base-square)}{placement square}{-left}
             {orange, opacity=0.5, xshift=2mm, xscaling=-1}

\end{tikzpicture}
\end{document}

Original solution:

Note: I have realised that this comes with some flaws as other commands such as \fill, edge, \node will require additional commands which will limit what the pic can draw. See updated answer above.

This is done using my new coommand \placePic:

\placePic{<new pic name>}
         {<placement coord.>}
         {<pic type>}
         {<anchor, internal coord. extension>}
         {<pic actions>}

It is required that the pic to place is not drawn automatically, it should require the draw option. That is; the pic should not be created with e.g. \draw but instead with \path without the draw option. See e.g.:

placement square/.pic=
{
    \begin{scope}[shift={\shiftcoord},thick]
        \def\sideLen{4mm}

        \path[pic actions] (-\sideLen/2,-\sideLen/2) rectangle +(\sideLen,\sideLen);
        \path[pic actions] (-\sideLen/2,0) -- +(-0.7mm,0) coordinate (-left point);
        \path[pic actions] (\sideLen/2,0) -- +(0.7mm,0) coordinate (-right point);
        \path[pic actions] (0,\sideLen/2) -- +(0,0.7mm) coordinate (-upper point);
        \path[pic actions] (0,-\sideLen/2) -- +(0,-0.7mm) coordinate (-lower point);

        \coordinate (-upper left) at (-\sideLen/2,\sideLen/2);
        \coordinate (-upper right) at (\sideLen/2,\sideLen/2);
        \coordinate (-lower left) at (-\sideLen/2,-\sideLen/2);
        \coordinate (-lower right) at (\sideLen/2,-\sideLen/2);
    \end{scope}
}

This is done with the cost of creating the paths two times. There is for certain some more efficient way of doing this, but I searched a lot without any success.

enter image description here

\documentclass[tikz,border=2cm]{standalone}
\usetikzlibrary{shapes.geometric}

% code by Andrew:
% https://tex.stackexchange.com/a/33765/13304
\makeatletter
\newcommand{\gettikzxy}[3]{%
  \tikz@scan@one@point\pgfutil@firstofone#1\relax
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}
\makeatother

% #1 = name of new placement
% #2 = where to place (e.g. myA-star)
% #3 = pic type
% #4 = internal node to anchor (eg. -left point)
% #5 = pic actions
\newcommand{\placePic}[5]
{
    \path pic (#1-PATH) at (0,0) {#3};
    \gettikzxy{(#1-PATH#4)}{\sdx}{\sdy}
    \gettikzxy{#2}{\sbx}{\sby}
    \def\newX{\sbx - \sdx}
    \def\newY{\sby - \sdy}
    \path [pic shift={(\newX,\newY)}] pic[draw,#5] (#1) at (0,0) {#3};
}

\tikzset
{
    pic shift/.store in=\shiftcoord,
    pic shift={(0,0)},
    base rectangle/.pic=
    {
        \begin{scope}[shift={\shiftcoord}]
            \draw[very thick,pic actions] (0,0) rectangle (2,2);
            \node[draw,circle,minimum size=2mm,inner sep=0,thick,pic actions] (-circle) at (.5,.5) {};
            \node[draw,rectangle,minimum size=2mm,inner sep=0,thick,pic actions] (-square) at (.5,1.5) {};
            \node[draw,diamond,minimum size=2.5mm,inner sep=0,thick,pic actions] (-diamond) at (1.5,1.5) {};
            \node[draw,star,minimum size=2.5mm,inner sep=0,thick,pic actions] (-star) at (1.5,.5) {};
        \end{scope}
    },
    placement square/.pic=
    {
        \begin{scope}[shift={\shiftcoord},thick]
            \def\sideLen{4mm}
            \path[pic actions] (-\sideLen/2,-\sideLen/2) rectangle +(\sideLen,\sideLen);
            \path[pic actions] (-\sideLen/2,0) -- +(-0.7mm,0) coordinate (-left point);
            \path[pic actions] (\sideLen/2,0) -- +(0.7mm,0) coordinate (-right point);
            \path[pic actions] (0,\sideLen/2) -- +(0,0.7mm) coordinate (-upper point);
            \path[pic actions] (0,-\sideLen/2) -- +(0,-0.7mm) coordinate (-lower point);
            \coordinate (-upper left) at (-\sideLen/2,\sideLen/2);
            \coordinate (-upper right) at (\sideLen/2,\sideLen/2);
            \coordinate (-lower left) at (-\sideLen/2,-\sideLen/2);
            \coordinate (-lower right) at (\sideLen/2,-\sideLen/2);
        \end{scope}
    }
}


\begin{document}
\begin{tikzpicture}
    % Help lines (grid)
    \draw[help lines,ultra thin,step=5mm] (-.5,-.5) grid (2.5,2.5);
    \draw[help lines,thin,step=10mm] (-.5,-.5) grid (2.5,2.5);

    \pic[black] (base) at (0,0) {base rectangle};

    % #1 = name of new placement
    % #2 = where to place (e.g. myA-star)
    % #3 = pic type
    % #4 = internal node to use as anchor (eg. -left point)
    % #5 = pic actions
    \placePic{red square}
             {(base-circle)}{placement square}{-lower point}
             {red, opacity=0.5}
    \placePic{blue square}
             {(base-diamond)}{placement square}{-lower left}
             {blue, opacity=0.5}
    \placePic{green square}
             {(base-star)}{placement square}{-right point}
             {green, opacity=0.5}
    \placePic{orange square}
             {(base-square)}{placement square}{-left point}
             {orange, opacity=0.5, xshift=2mm}

\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .