In dieser Frage auf TeX.SX geht es um die Darstellung von Text in Ausrisszetteln.
Hier zunächst eine sehr einfache Lösung basierend auf der TikZ-Bibliothek decorations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
documentclass{scrartcl} usepackage{tikz} usetikzlibrary{decorations.pathmorphing} definecolor{paper}{RGB}{239,227,157} usepackage{lipsum} begin{document} begin{tikzpicture}[pencildraw/.style={ % decorate, decoration={random steps,segment length=2pt,amplitude=1pt} } % ] node[ preaction={fill=black,opacity=.5,transform canvas={xshift=1mm,yshift=-1mm}}, pencildraw,draw,fill=paper,text width=.8textwidth,inner sep=5mm] {lipsum[1]}; end{tikzpicture} end{document} |
Der folgende Code ermöglicht einen echten Abrisszettel-Effekt:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
documentclass{scrartcl} usepackage{lipsum} % To generate test text usepackage{tikz} usetikzlibrary{decorations.pathmorphing,calc,shadows.blur,shadings} pgfmathsetseed{1} % To have predictable results % Define a background layer, in which the parchment shape is drawn pgfdeclarelayer{background} pgfsetlayers{background,main} % This is the base for the fractal decoration. It takes a random point between the start and end, and % raises it a random amount, thus transforming a segment into two, connected at that raised point % This decoration can be applied again to each one of the resulting segments and so on, in a similar % way of a Koch snowflake. pgfdeclaredecoration{irregular fractal line}{init} { state{init}[width=pgfdecoratedinputsegmentremainingdistance] { pgfpathlineto{pgfpoint{random*pgfdecoratedinputsegmentremainingdistance}{(random*pgfdecorationsegmentamplitude-0.02)*pgfdecoratedinputsegmentremainingdistance}} pgfpathlineto{pgfpoint{pgfdecoratedinputsegmentremainingdistance}{0pt}} } } % define some styles tikzset{ paper/.style={draw=black!10, blur shadow, shade=bilinear interpolation, lower left=black!20, upper left=black!15, upper right=white, lower right=black!10}, irregular border/.style={decoration={irregular fractal line, amplitude=0.2}, decorate, }, ragged border/.style={ decoration={random steps, segment length=7mm, amplitude=2mm}, decorate, } } % Macro to draw the shape behind the text, when it fits completly in the % page deftornpaper#1{ tikz{ node[inner sep=1em] (A) {#1}; % Draw the text of the node begin{pgfonlayer}{background} % Draw the shape behind fill[paper] % recursively decorate the bottom border decorate[irregular border]{decorate{decorate{decorate{decorate[ragged border]{ ($(A.south east) - (0, random*5mm)$) -- ($(A.south west) - (0, random*5mm)$) }}}}} -- (A.north west) -- (A.north east) -- cycle; end{pgfonlayer}} } begin{document} noindent tornpaper{parbox{.9textwidth}{lipsum[15]}} end{document} |
Und hier noch eine Kombination von beiden Ansätzen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
documentclass{scrartcl} usepackage{lipsum} % To generate test text usepackage{tikz} usetikzlibrary{decorations.pathmorphing,calc,shadows.blur,shadings} pgfmathsetseed{1} % To have predictable results % Define a background layer, in which the parchment shape is drawn pgfdeclarelayer{background} pgfsetlayers{background,main} % This is the base for the fractal decoration. It takes a random point between the start and end, and % raises it a random amount, thus transforming a segment into two, connected at that raised point % This decoration can be applied again to each one of the resulting segments and so on, in a similar % way of a Koch snowflake. pgfdeclaredecoration{irregular fractal line}{init} { state{init}[width=pgfdecoratedinputsegmentremainingdistance] { pgfpathlineto{pgfpoint{random*pgfdecoratedinputsegmentremainingdistance}{(random*pgfdecorationsegmentamplitude-0.02)*pgfdecoratedinputsegmentremainingdistance}} pgfpathlineto{pgfpoint{pgfdecoratedinputsegmentremainingdistance}{0pt}} } } % define some styles tikzset{ paper/.style={draw=black!10, blur shadow, shade=bilinear interpolation, lower left=black!20, upper left=black!15, upper right=white, lower right=black!10,pencildraw}, irregular border/.style={decoration={irregular fractal line, amplitude=0.2}, decorate}, ragged border/.style={decoration={random steps, segment length=7mm, amplitude=2mm}, decorate}, pencildraw/.style={decoration={random steps,segment length=2pt,amplitude=1pt}, decorate} } % Macro to draw the shape behind the text, when it fits completly in the % page deftornpaper#1{ tikz{ node[inner sep=1em] (A) {#1}; % Draw the text of the node begin{pgfonlayer}{background} % Draw the shape behind fill[paper] % recursively decorate the bottom border decorate[irregular border]{decorate{decorate{decorate{decorate[ragged border]{ ($(A.south east) - (0, random*5mm)$) -- ($(A.south west) - (0, random*5mm)$) }}}}} -- (A.north west) -- (A.north east) -- cycle; end{pgfonlayer}} } begin{document} noindent tornpaper{parbox{.9textwidth}{lipsum[15]}} end{document} |
Zu guter Letzt noch eine sehr schöne Lösung, bei der die jeweilige untere Abrisskante der nächsten oberen Abrisskante entspricht:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
documentclass{scrartcl} usepackage{lipsum} % To generate test text usepackage{ifthen} usepackage{tikz} usetikzlibrary{decorations.pathmorphing,calc,shadows.blur,shadings} newcounter{mathseed} setcounter{mathseed}{3} pgfmathsetseed{arabic{mathseed}} % To have predictable results % Define a background layer, in which the parchment shape is drawn pgfdeclarelayer{background} pgfsetlayers{background,main} % This is the base for the fractal decoration. It takes a random point between the start and end, and % raises it a random amount, thus transforming a segment into two, connected at that raised point % This decoration can be applied again to each one of the resulting segments and so on, in a similar % way of a Koch snowflake. pgfdeclaredecoration{irregular fractal line}{init} { state{init}[width=pgfdecoratedinputsegmentremainingdistance] { pgfpathlineto{pgfpoint{random*pgfdecoratedinputsegmentremainingdistance}{(random*pgfdecorationsegmentamplitude-0.02)*pgfdecoratedinputsegmentremainingdistance}} pgfpathlineto{pgfpoint{pgfdecoratedinputsegmentremainingdistance}{0pt}} } } % 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, } } deftornpaper#1{% ifthenelse{isodd{value{mathseed}}}{% tikz{ node[inner sep=1em] (A) {#1}; % Draw the text of the node begin{pgfonlayer}{background} % Draw the shape behind fill[paper] % recursively decorate the bottom border pgfextra{pgfmathsetseed{arabic{mathseed}}addtocounter{mathseed}{1}}% {decorate[irregular cloudy border]{decorate{decorate{decorate{decorate[ragged border]{ (A.north west) -- (A.north east) }}}}}} -- (A.south east) pgfextra{pgfmathsetseed{arabic{mathseed}}}% {decorate[irregular spiky border]{decorate{decorate{decorate{decorate[ragged border]{ -- (A.south west) }}}}}} -- (A.north west); end{pgfonlayer}} }{% tikz{ node[inner sep=1em] (A) {#1}; % Draw the text of the node begin{pgfonlayer}{background} % Draw the shape behind fill[paper] % recursively decorate the bottom border pgfextra{pgfmathsetseed{arabic{mathseed}}addtocounter{mathseed}{1}}% {decorate[irregular spiky border]{decorate{decorate{decorate{decorate[ragged border]{ (A.north east) -- (A.north west) }}}}}} -- (A.south west) pgfextra{pgfmathsetseed{arabic{mathseed}}}% {decorate[irregular cloudy border]{decorate{decorate{decorate{decorate[ragged border]{ -- (A.south east) }}}}}} -- (A.north east); end{pgfonlayer}} }} begin{document} noindent tornpaper{ parbox{.9textwidth}{lipsum[11]} } noindent tornpaper{ parbox{.9textwidth}{lipsum[15]} } noindent tornpaper{ parbox{.9textwidth}{lipsum[5]} } end{document} |
- Quelle: