5

I want to create something like this:

enter image description here

By filling a rectangle.

NOTE: Ignore the borders of the image, I just want to give that texture to a tikz rectangle.

9
  • I haven't tried anything, I have no idea in how to make random colors over the fill... I saw examples where you can place lines or stars
    – hkviktor
    Commented Jan 7, 2015 at 22:24
  • Maybe you could use $\pgfmathrnd$ (see the TikZ/PGF manual, section 90.2.6) to create random coordinates on which you draw the details of the papery pattern? At the end you can clip it with a path (which may be random as well).
    – Turion
    Commented Jan 7, 2015 at 22:30
  • I'll take a look... Hmm, is there a way to create a grain or noise effect over a fill?
    – hkviktor
    Commented Jan 7, 2015 at 22:34
  • As a short way, clip the texture image with rectangle: tex.stackexchange.com/a/167568/31034
    – user31034
    Commented Jan 7, 2015 at 22:57
  • 3
    Do you know the cicada principle? Commented Jan 8, 2015 at 12:26

1 Answer 1

9

A brute-force attempt with pgfplots: there are surely better ways. :-)

The "coarseness" of the texture can be adjusted using the samples key value. For this fine of a texture, LuaLaTeX must be used (dynamic memory allocation). For samples=100 or fewer, any modern engine can be used.

\IfFileExists{luatex85.sty}{%
  \RequirePackage{luatex85}%
}{}
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  view={0}{90},
  hide axis=true,
  samples=200,
  colormap={papyrus}{
    cmyk(0cm)=(0.00,0.08,0.24,0); 
    cmyk(1cm)=(0.00,0.08,0.24,0.05)
  },
]
  \addplot3[surf,shader=interp] {rand};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

7
  • That's the effect I needed. I'll try it later :)
    – hkviktor
    Commented Mar 8, 2015 at 19:12
  • Hi Paul, I'm trying this minimal, but this show an error: !Package pgfkeys: Choice '1.12' unknown in key '/pgfplots/compat/labels'. Do you know what's going on?
    – MrSelberg
    Commented Sep 23, 2015 at 19:32
  • @MrSelberg you probably have an older version of pgfplots installed than 1.12. Commented Sep 23, 2015 at 19:52
  • 2013.84.1.7svn29531-17.1.7-noarch. That's my version.
    – MrSelberg
    Commented Sep 23, 2015 at 19:56
  • 1
    Thanks Paul. I tried it before (remove that line) did not work. But I solve the problem: I had an older version of the package. With the newest version everything is ok. :D
    – MrSelberg
    Commented Sep 23, 2015 at 20:22

You must log in to answer this question.

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