1

In my drawings I use a hand drawn looking line style to indicate discontinuity. Therefore I use a random line style. Since you cannot change the decoration in between a path creation, I’m facing a problem. How do I fill an area that is defined by such a style? Or to rephrase it: how can I fill the second rectangle in the following example?

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\tikzset{handwritten/.style = {
    decorate, decoration={random steps, segment length=2mm, amplitude=0.3mm}
    }
}

\begin{document}
    \begin{tikzpicture}
        \draw[fill=green] (0,0) -- ++(left:3) --  ++(down:1) [handwritten] -- ++(right:3) -- cycle;
    \end{tikzpicture}
    \begin{tikzpicture}
        \draw (0,0) -- ++(left:3);
        \draw[handwritten] (-3,0) --  ++(down:1);
        \draw (-3,-1) -- ++(right:3);
        \draw[handwritten] (0,-1) -- (0,0);
    \end{tikzpicture}
\end{document}

enter image description here

quinmars
  • 5,477
  • I'm obviously being dumb so bear with me. Why can't you fill the second rectangle the same way you did the first? Is the point that you don't want all of the lines to be decorated but only the verticals? So you can't use the first method because that fills the rectangle but decorates all the lines; while you can't use the second because that only decorates the verticals but doesn't fill the shape? – cfr Sep 17 '14 at 22:12
  • @cfr, because the second one is not a close path. – quinmars Sep 17 '14 at 22:46
  • @percusse, indeed! That answers my question. Thanks. – quinmars Sep 17 '14 at 22:47
  • No problem, glad that it helped – percusse Sep 17 '14 at 22:51

0 Answers0