I wish to use pgfdeclareshape draw a file archive shape.

    \foreach \i in {center,north,south,east,west} {
    \anchor{text} {
        % store lower right in xa/ya and upper right in xb/yb
        \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
        \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
        % construct main path
        % my code
        \foreach \i [evaluate=\i as \j using int(\i*2)] in {1,...,2} {
            \pgf@xd=\pgf@xg \advance\pgf@xd by \j pt
            \pgf@yd=\pgf@yg \advance\pgf@yd by \j pt
            \pgf@xe=\pgf@xh \advance\pgf@xe by \j pt
            \pgf@ye=\pgf@yh \advance\pgf@ye by \j pt
            % add line
    \node[draw,mrects,minimum width=6em,minimum height=2em] (N1) {hello world};

enter image description here

But two issues need your help:

  1. The text not at the center.
  2. The north west and south east corner lines crossed together.sounds line the assignment at the end of foreach loop doesn't work.
  • I would be very careful with using a \foreach loop in a shape declaration. If you use the thing in another foreach loop over \i you will get even more surprised than you already are. – user121799 Jan 11 at 19:23
  • 1
    do you look 69.3.2 Copy Shadows in tikz & pgf manual, pp 757 (v 3.1)? there is described double copy shadow, which seem to do what you like to achieve ... – Zarko Jan 11 at 19:25
  • duplicate?: tex.stackexchange.com/questions/316455/… – Ignasi Jan 11 at 19:38

As Zarko pointed, a double copy shadow solves your problem:

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

    \node[double copy shadow,
        minimum width=6em,
        minimum height=2em] (N1) {Hello World};

enter image description here

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.