Codebase list latex-coffee-stains / a915328
Add random bleeding coffee stains Anthony Mirand 5 years ago
2 changed file(s) with 54 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2525 % http://www.thp.uni-koeln.de/~ses/ ses@thp.uni-koeln.de
2626 %
2727 % November, 2018
28 % Added: random bleeding splash
28 % Added: random bleeding splash \cofeBleed{} (requires ifthen)
29 % Added: package option to put random bleeding splash throughout pages
2930 % by Anthony Mirand
3031 % https://anthonymirand.github.io anthonypmirand@gmail.com
3132 %
548549
549550
550551
552 %generate bleeding cofe splash:
553 \newcommand{\cofeBleed}[7]{
554 \pgfmathsetmacro{\alpha}{#1 - #7 * \value{depth}}
555 \pgfmathsetmacro{\scale}{#2}
556 \pgfmathsetmacro{\angle}{#3}
557 \pgfmathsetlengthmacro{\xoff}{#4}
558 \pgfmathsetlengthmacro{\yoff}{#5}
559 \pgfmathtruncatemacro{\variety}{#6}
560
561 \ifthenelse{\variety<2}{
562 \ifthenelse{\variety=0}{
563 \cofeAm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
564 }{
565 \cofeBm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
566 }
567 }{
568 \ifthenelse{\variety=2}{
569 \cofeCm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
570 }{
571 \cofeDm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
572 }
573 }
574
575 \addtocounter{depth}{1}
576 }%end bleed command
577
578
579
551580 \ifthenelse{\boolean{coffee@bleed}}{
552581 %bleed random splash across multiple pages:
553582 \RequirePackage{eso-pic}
554 \AddToShipoutPicture{\cofeAm{1}{1.0}{0}{5.5cm}{3cm}}
583
584 \newcounter{depth}\setcounter{depth}{0}
585
586 \pgfmathsetmacro{\alpha}{0.9 + 0.1 * rand}
587 \pgfmathsetmacro{\scale}{0.7 + 0.5 * rand}
588 \pgfmathsetmacro{\angle}{360 * rand}
589 \pgfmathsetlengthmacro{\xoff}{rand * 2cm}
590 \pgfmathsetlengthmacro{\yoff}{rand * 5cm}
591
592 \pgfmathtruncatemacro{\variety}{4 * rand}
593 \pgfmathsetmacro{\bleed}{0.1 + 0.1 * rand}
594
595 \AddToShipoutPicture{\cofeBleed{\alpha}{\scale}{\angle}{\xoff}{\yoff}{\variety}{\bleed}}
555596 }{}
556597
557598
5353 \usepackage[onEveryPage]{coffee}
5454 \end{verbatim}
5555
56 \medskip
57 Since version 6, you may also use
58 \begin{verbatim}
59 \cofeBleed{alpha}{scale}{angle}{xoff}{yoff}{bleed}{variety}
60 \end{verbatim}
61 to place a \texttt{variety} $\in [0,4]$ with random parameters on the current
62 page. There is now also a package option to put a bleeding coffee throughout the pages like
63 \begin{verbatim}
64 \usepackage[bleed]{coffee}
65 \end{verbatim}
66
5667
5768 \section{Copyright}
5869 You can freely distribute this package as I do not believe in imaginary property. All stains are self-made, photographed by myself, processed with gimp and traced with Inkscape.