Graphics, Figures & TablesTorn paper tearout example

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Erik_Schiegg
Posts: 3
Joined: Sun Apr 01, 2018 12:03 pm

Torn paper tearout example

Post by Erik_Schiegg »

Hi folks, happy easter,

I found this beautiful example making a fractal paper tear out text box, but I can't get it to work, when I open it in overleaf
:D
http://www.texample.net/tikz/examples/torn-paper/
The code looks like this, please open the original from the link

Code: Select all

Code, edit and compile here:
% Torn paper with matching torn edges
% Author: Jose Luis Diaz
\documentclass[a5paper]{article}
\usepackage{lipsum} % To generate test text
\usepackage{framed}
\usepackage{ifthen}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{center}
\setlength\PreviewBorder{10pt}%
%%%>
\begin{comment}
:Title: Torn paper with matching torn edges
:Tags: Styles;Fractals;Decorative drawings;Fun
:Author: Jose Luis Diaz
:Slug: torn-paper
This example is similar to: http://texample.net/tikz/examples/framed-tikz/
Fractal decorations are used to achieve a torn paper effect.
The bottom of one piece matched the top of the next one.
This is done by resetting the random seed before drawing each border.
However, you get the "same" random border in all your fragments,
which is not nice. You want randomness in each new bottom border,
but exactly the same randomness in the next top border. In order to get this,
you need a global counter which is increased in each "paper fragment",
and which is used as seed for the bottom border.
It is neccesary to use \pgfextra to be able of setting the seed in the middle
of the path (i.e: between top and bottom borders).
In addition, there is the problem that both paths (top and bottom) have to be
drawn in the same direction in order to get the same contour.
In order to fill the piece of paper with a background, it is not possible
to draw both top and bottom borders in the same direction (eg. left to right).
So the solution involves drawing one piece of paper visiting its corners in
clockwise direction, and the following one in counter-clockwise direction.
I use the counter mathseed and draw in one direction or the other based
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
:shock:
Overleaf throwing error:

Code: Select all

Package pgfkeys Error: Choice 'bilinear interpolation' unknown
in choice key '/tikz/shade'. I am going to ignore this key.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.146 }
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Although there is a special overleaf link...
As I am still quite a greenLaTeXhorn, I would be glad for a helping hand getting this example to work. Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Torn paper tearout example

Post by Stefan Kottwitz »

Hi Erik,

welcome to the forum!

It seems that TikZ key has been renamed: use shading=bilinear interpolation instead of shade=bilinear interpolation.

Stefan
LaTeX.org admin
Erik_Schiegg
Posts: 3
Joined: Sun Apr 01, 2018 12:03 pm

Torn paper tearout example

Post by Erik_Schiegg »

Thank you Stefan,

so I have to change this passage:

Code: Select all

Code, edit and compile here:
% define some styles
\tikzset{
paper/.style={draw=black!10, blur shadow, every shadow/.style={opacity=1, black}
shade=bilinear interpolation,
lower left=black!10, upper left=black!5, upper right=white, lower right=black!5, fill=none},
irregular cloudy border/.style={decoration={irregular fractal line, amplitude=0.2},
decorate,
},
irregular spiky border/.style={decoration={irregular fractal line, amplitude=-0.2},
decorate,
},
ragged border/.style={ decoration={random steps, segment length=7mm, amplitude=2mm},
decorate,
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I will try it out in overleaf and will report if it works

Next error:

Code: Select all

Package pgfkeys Error: I do not know the key '/tikz/paper' and
I am going to ignore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.146 }
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And where can I look up the actual keys of packages on my own?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Torn paper tearout example

Post by Stefan Kottwitz »

Yes, indeed you just need to change the single word.

I tested also on Overleaf, the code then works for me. The second error was just a consequence: since the first error was in the paper style, it could not be created, and the compiler continued, so later it was not able to find a paper style. Just fix this single word. :-)

Stefan
LaTeX.org admin
Erik_Schiegg
Posts: 3
Joined: Sun Apr 01, 2018 12:03 pm

Torn paper tearout example

Post by Erik_Schiegg »

Thank you Stefan, I got it to work :D in the VerbTeX editor,
overleaf is not working well from a tablet, no copy paste for example! I have to work the overleaf handling out, connecting a keyboard... or repair my regular laptop, broken DC connecter, no big deal...

You helped me like a Boss!
Post Reply