5

This question already has an answer here:

How to draw a shape like this using TikZ? enter image description here

marked as duplicate by Werner, user13907, user31729, Jesse, Bordaigorl Dec 11 '14 at 16:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    I think you can find a similar example in pgfmanual. If I'm not wrong is the example for \newshape. Some preaction will reproduce two or three times to look like your example. – Ignasi Dec 11 '14 at 15:02
5

enter image description here

Section 102.5.3 Command for Declaring New Shapes of the pgf manual contains an example declaring a document shape similar to the one you requested. Adding a double copy shadow to this shape gives you the desired result.

The code (adjust the settings according to your needs):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows}

\makeatletter
\pgfdeclareshape{document}{
\inheritsavedanchors[from=rectangle] % this is nearly a rectangle
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
% ... and possibly more
\backgroundpath{% this is new
% 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
% compute corner of ‘‘flipped page’’
\pgf@xc=\pgf@xb \advance\pgf@xc by-7.5pt % this should be a parameter
\pgf@yc=\pgf@yb \advance\pgf@yc by-7.5pt
% construct main path
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
\pgfpathclose
% add little corner
\pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
}
}
\makeatother

\begin{document}

\begin{tikzpicture}

\node[
  shape=document,
  double copy shadow={
    shadow xshift=-0.5ex,
    shadow yshift=-0.5ex
  },
  draw,
  fill=white,
  line width=1pt,
  text width=1cm,
  minimum height=1.7cm
  ] {};
\end{tikzpicture}

\end{document}

If this is to be used many times, you can define a style to simplify the code.

  • Thank you very much. This is what I am looking for! Thanks. – Anderson Dec 12 '14 at 3:01
  • Moreover, would you please give me the pgf manual link, the TeXample.net manual did not have the section 102.5.3. – Anderson Dec 12 '14 at 3:08
  • @Anderson You're welcome. Always look up documentation in CTAN. Here's the link to the manual: mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf – Gonzalo Medina Dec 12 '14 at 17:07
3

Here is one solution. If you want to reuse it many times you can put it in a pic.

\usetikzlibrary{shadings}
\usetikzlibrary{shadows}

\begin{tikzpicture}
  \foreach \i in {1,2,3} {
    \begin{scope}[shift={(.2*\i,.2*\i)}]
      \draw[bottom color=black!7, top color=white, drop shadow={shadow xshift=-.4ex}]
        (0,0) -- ++(3,0) -- ++(0,3)  -- ++(-1,1) -- ++(-2,0) -- cycle;
      \draw (3,3) -| (2,4);
    \end{scope}
  }
\end{tikzpicture}

enter image description here

  • @Anderson you are welcome. Even if is not clear by who it was solved ;) – Kpym Dec 12 '14 at 6:09

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