Package list latex-coffee-stains / 4b4c296
Import upstream version 7+git20190313.1.9fd82c6 Debian Janitor 3 months ago
1 changed file(s) with 41 addition(s) and 53 deletion(s). Raw diff Collapse all Expand all
3030 % by Anthony Mirand
3131 % https://anthonymirand.github.io anthonypmirand@gmail.com
3232 %
33 % April, 2020
34 % To avoid stepping on it, rename \alpha ↦ \coffeealpha.
35 % See https://bugs.debian.org/958346
36 % These macros are being renamed, for extra safety:
37 % \alpha ↦ \coffeealpha
38 % \angle ↦ \coffeeangle
39 % \bleed ↦ \coffeebleed
40 % \scale ↦ \coffeescale
41 % \variety ↦ \coffeevariety
42 % \xoff ↦ \coffeexoff
43 % \yoff ↦ \coffeeyoff
44 %
4533
4634
4735 \NeedsTeXFormat{LaTeX2e}
48 \ProvidesPackage{coffee}[2020/04/21 Coffe Staints Version 7]
36 \ProvidesPackage{coffee}[2014/12/17 Coffe Staints Version 6]
4937
5038 \RequirePackage{kvoptions}
5139
527515
528516 %generate random cofe splash:
529517 \newcommand{\cofeSplash}{
530 \pgfmathsetmacro{\coffeealpha}{0.5*rnd+0.2}
531 \pgfmathsetmacro{\coffeescale}{0.7 + 0.5*rand}
532 \pgfmathsetmacro{\coffeeangle}{360*rnd}
533 \pgfmathsetlengthmacro{\coffeexoff}{rand*2cm}
534 \pgfmathsetlengthmacro{\coffeeyoff}{rand*5cm}
535
536 \pgfmathtruncatemacro{\coffeevariety}{4*rnd}
537
538 \ifthenelse{\coffeevariety<2}{
539 \ifthenelse{\coffeevariety=0}{
540 \cofeAm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
518 \pgfmathsetmacro{\alpha}{0.5*rnd+0.2}
519 \pgfmathsetmacro{\scale}{0.7 + 0.5*rand}
520 \pgfmathsetmacro{\angle}{360*rnd}
521 \pgfmathsetlengthmacro{\xoff}{rand*2cm}
522 \pgfmathsetlengthmacro{\yoff}{rand*5cm}
523
524 \pgfmathtruncatemacro{\variety}{4*rnd}
525
526 \ifthenelse{\variety<2}{
527 \ifthenelse{\variety=0}{
528 \cofeAm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
541529 }{
542 \cofeBm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
530 \cofeBm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
543531 }
544532 }{
545 \ifthenelse{\coffeevariety=2}{
546 \cofeCm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
533 \ifthenelse{\variety=2}{
534 \cofeCm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
547535 }{
548 \cofeDm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
536 \cofeDm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
549537 }
550538 }
551539
563551
564552 %generate bleeding cofe splash:
565553 \newcommand{\cofeBleed}[7]{
566 \pgfmathsetmacro{\coffeealpha}{#1 - #7 * \value{depth}}
567 \pgfmathsetmacro{\coffeescale}{#2}
568 \pgfmathsetmacro{\coffeeangle}{#3}
569 \pgfmathsetlengthmacro{\coffeexoff}{#4}
570 \pgfmathsetlengthmacro{\coffeeyoff}{#5}
571 \pgfmathtruncatemacro{\coffeevariety}{#6}
572
573 \ifthenelse{\coffeevariety<2}{
574 \ifthenelse{\coffeevariety=0}{
575 \cofeAm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
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}
576564 }{
577 \cofeBm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
565 \cofeBm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
578566 }
579567 }{
580 \ifthenelse{\coffeevariety=2}{
581 \cofeCm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
568 \ifthenelse{\variety=2}{
569 \cofeCm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
582570 }{
583 \cofeDm{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}
571 \cofeDm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
584572 }
585573 }
586574
595583
596584 \newcounter{depth}\setcounter{depth}{0}
597585
598 \pgfmathsetmacro{\coffeealpha}{0.9 + 0.1 * rand}
599 \pgfmathsetmacro{\coffeescale}{0.7 + 0.5 * rand}
600 \pgfmathsetmacro{\coffeeangle}{360 * rand}
601 \pgfmathsetlengthmacro{\coffeexoff}{rand * 2cm}
602 \pgfmathsetlengthmacro{\coffeeyoff}{rand * 5cm}
603
604 \pgfmathtruncatemacro{\coffeevariety}{4 * rand}
605 \pgfmathsetmacro{\coffeebleed}{0.1 + 0.1 * rand}
606
607 \AddToShipoutPicture{\cofeBleed{\coffeealpha}{\coffeescale}{\coffeeangle}{\coffeexoff}{\coffeeyoff}{\coffeevariety}{\coffeebleed}}
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}}
608596 }{}
609597
610598
611 \endinput
599 \endinput