Codebase list latex-coffee-stains / ededa64
prettier ifs Sebastian Schmittner 9 years ago
2 changed file(s) with 44 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
1919 % http://nepsweb.co.uk/homeapr/
2020 %
2121 % December, 2014
22 % Added random \cofeSplash{} (requires ifthen)
22 % Added: -random \cofeSplash{} (requires ifthen)
23 % -package option to put random splashes onEveryPage
2324 % by Sebastian Schmittner
2425 % http://www.thp.uni-koeln.de/~ses/ ses@thp.uni-koeln.de
2526 %
2627
28
29 \NeedsTeXFormat{LaTeX2e}
30 \ProvidesPackage{coffee}[2014/12/17 Coffe Staints Version 5]
31
2732 \RequirePackage{kvoptions}
2833
34 \RequirePackage{tikz}
35
36 \RequirePackage{ifthen}
37
38
2939 \SetupKeyvalOptions{family=coffee,prefix=coffee@}
3040
41 \DeclareBoolOption{onEveryPage}
42
3143 \ProcessKeyvalOptions*\relax
3244
33 \RequirePackage{tikz}
34
35 \RequirePackage{ifthen}
3645
3746 \definecolor{coffee1}{rgb}{0.80784315,0.68627453,0.60392159}
3847 \definecolor{coffee2}{rgb}{0.77254903,0.58039218,0.43921569}
500509 %generate random cofe splash:
501510 \newcommand{\cofeSplash}{
502511 \pgfmathsetmacro{\alpha}{0.5*rnd+0.2}
503 \pgfmathsetmacro{\scale}{1.0 + 0.5*rand}
512 \pgfmathsetmacro{\scale}{0.7 + 0.5*rand}
504513 \pgfmathsetmacro{\angle}{360*rnd}
505514 \pgfmathsetlengthmacro{\xoff}{rand*2cm}
506515 \pgfmathsetlengthmacro{\yoff}{rand*5cm}
507516
508517 \pgfmathtruncatemacro{\variety}{4*rnd}
509518
510 \ifthenelse{\variety=0}{
511 \cofeAm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
519 \ifthenelse{\variety<2}{
520 \ifthenelse{\variety=0}{
521 \cofeAm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
522 }{
523 \cofeBm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
524 }
512525 }{
513 \ifthenelse{\variety=1}{
514 \cofeBm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
526 \ifthenelse{\variety=2}{
527 \cofeCm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
515528 }{
516 \ifthenelse{\variety=2}{
517 \cofeCm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
518 }{
519 \cofeDm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
520 }
529 \cofeDm{\alpha}{\scale}{\angle}{\xoff}{\yoff}
521530 }
522531 }
523532
524 }
525
533 }%end splash command
534
535
536
537 \ifthenelse{\boolean{coffee@onEveryPage}}{
538 %put splashes on every page:
539 \RequirePackage{eso-pic}
540 \AddToShipoutPicture{\cofeSplash{}}
541 }{}
542
543
544 \endinput
00 \documentclass{article}
1 \usepackage{tikz}
1 \usepackage[onEveryPage]{coffee}
2
3
24 \usepackage{verbatim}
3 \usetikzlibrary{arrows,shapes}
4
5 \usepackage{coffee5}
6
7 \usepackage{eso-pic}
8 \AddToShipoutPicture{%
9 \cofeSplash{}
10 }
115 \usepackage{lipsum}
126
137
3024 \end{enumerate}
3125
3226 \section{Usage}
33 To use the package, simply place the \texttt{coffee5.sty} file in the directory with all of your
27 To use the package, simply place the \texttt{coffee.sty} file in the directory with all of your
3428 other \texttt{.tex} files \textit{or} install it properly (consult your distribution's manual).
3529 Then include the following line in the header of your document:
3630 \begin{verbatim}
37 \usepackage{coffee5}
31 \usepackage{coffee}
3832 \end{verbatim}
3933 To place a coffee stain on a page, put one of the following commands in the source code of the relevant page:
4034 \begin{verbatim}
5347 \begin{verbatim}
5448 \cofeSplash{}
5549 \end{verbatim}
56 to place a random splash with random parameters on the current page or
57 e.g.
50 to place a random splash with random parameters on the current
51 page. There is now also a package option to put coffee on every page like
5852 \begin{verbatim}
59 \usepackage{eso-pic}
60 \AddToShipoutPicture{%
61 \cofeSplash{}
62 }
53 \usepackage[onEveryPage]{coffee}
6354 \end{verbatim}
64 to put a random splash on every page.
6555
6656
6757 \section{Copyright}
7666 \end{quote}
7767 See more coffee stains on the next pages.
7868 \newpage
79
69 \section{Nonsense text with coffee splashes - just as in real papers}
8070 \lipsum[1-42]
8171
8272 \end{document}