#!/usr/bin/perl # -*-latex-*- # # This program creates customized equipment lists in PDF format. It is a LaTeX # file embedded in a Perl script (the Perl code lives mostly after the LaTeX). # # Copyright (c) 2008-09 Reid Priedhorsky. This work is distributed under the # terms of the Creative Commons-Attribution ShareAlike 3.0 license. This means # that you are free to share and modify it, but you must retain appropriate # authorship credit, and you may only distribute your modifications under the # same or similar terms. Note that as this program largely reformats its own # source code, the resulting output files fall under the same license. See # http://creativecommons.org/licenses/by-sa/3.0/us/legalcode for details. # # Usage: # # 1. Run this program. # 2. Answer the questions. # 3. equipment.{ps,pdf} will be created in the current directory. use strict; use warnings; open(FP, '>/tmp/equipment.tex'); # here-doc delimiter carefully chosen to not mess up LaTeX-mode fontification. print FP <<'>>'; \documentclass[10pt]{article} \usepackage{enumitem} \usepackage{latexsym} \usepackage{multicol} \usepackage{sectsty} \usepackage{soul} \usepackage{textcomp} \usepackage{vmargin} % margin setting commands \usepackage{url} % Version number. See changelog at end of file. \newcommand{\VERSION}{6} % These commands are discussed on p. 89 of The LaTeX Companion. \setpapersize{USletter} % rubber: paper letter % left top rt bot hht hsp fht fsp \setmarginsrb{48pt}{30pt}{48pt}{24pt}{0pt}{0pt}{0in}{18pt} >> my @CUSTOM = qw[backpacking buggy canoeing carcamping cold crampons daypack gaiters swimsuit wetshoes]; # Customization by command-line? my %args; if (@ARGV > 0) { foreach my $arg (@ARGV) { if ($arg eq 'help' or $arg eq '--help') { print "Customizations:\n ", join("\n ", @CUSTOM), "\n"; print "or 'all' for everything.\n"; exit(0); } $args{$arg} = 1; } } # Insert customization commands foreach my $pref (qw[backpacking buggy canoeing carcamping cold crampons daypack gaiters swimsuit wetshoes]) { my $include = 0; if (scalar(keys %args) > 0) { # customizing by command-line $include = (exists $args{all} or exists $args{$pref}); } else { # customizing interactively while (1) { print "Include $pref items? (y/n) "; my $answer = substr(lc(<>), 0, 1); if ($answer eq 'y') { $include = 1; last; } elsif ($answer eq 'n') { $include = 0; last; } } } if ($include) { print FP "\\newcommand{\\$pref}[1]{\\item #1}\n"; } else { print FP "\\newcommand{\\$pref}[1]{\\item[] \\st{#1}}\n"; } } print FP <<'>>'; \allsectionsfont{\large\sffamily\sectionrule{2ex}{0.2pt}{0pt}{0pt}} \setitemize{nolistsep} \setitemize[2]{topsep=2pt} \renewcommand{\labelitemi}{\raisebox{0.5pt}{\footnotesize$\Box$}} \renewcommand{\labelitemii}{\raisebox{0.5pt}{\scriptsize$\Box$}} \setcounter{secnumdepth}{-1} \pagestyle{empty} \setlength{\columnsep}{15pt} %\setlength{\columnseprule}{0.1pt} \begin{document} %\maketitle %\thispagestyle{empty} \begin{center} \sffamily {\LARGE\bfseries Generic Overnight Outdoor Equipment List} {\small v.\VERSION} \\ {\scriptsize Copyright \textcopyright\ 2009 Reid Priedhorsky. Distributed under the terms of the Creative Commons Attribution-ShareAlike License 3.0 US.} \vspace{6pt} \end{center} %\vspace{12pt} \begin{multicols}{3} \section{About this List} \noindent This comprehensive list is designed for people who more or less know what they are doing; use your judgement. If you find it useful, or have comments or suggestions, I would be very grateful to hear from you. \vspace{2pt} \hfill \begin{tabular}{r@{ }l@{}} --- & Reid Priedhorsky\\ & \texttt{reid@reidster.net} \end{tabular} \section{Big Stuff} % \begin{itemize} \backpacking{Frame pack} \daypack{Day pack} \item Sleeping bag \item Sleeping pad \canoeing{Paddle} \canoeing{Life vest} \wetshoes{Wading/paddle shoes} \item Hiking boots \item Camp shoes \end{itemize} \section{Clothing} \begin{itemize} \item Shirts \item Pants \item Shorts \item Underwear, incl.\ sports bra \item Hiking socks, thick and thin \item Pajamas \item Rain gear \item Warm hat \item Windbreaker \item Warm top(s) \cold{Warm pants} \cold{Mittens / Gloves} \cold{Long underwear} \item Bandanna \swimsuit{Swimsuit} \item Camp towel \buggy{Bug headnet} \buggy{Light cotton gloves (for bugs)} \gaiters{Gaiters} \canoeing{Paddling gloves} \crampons{Snow/ice traction aids} \end{itemize} \section{Body and Hygiene} \begin{itemize} \item Camelbak / Water bottles \item Water bottle (non-Camelbak) \item Sun hat \item Sunglasses \item Sunscreen \buggy{Bug dope} \item Drugs w/ spare course \item Mess kit: \begin{itemize} \item Mug \item Bowl \carcamping{Plate} \item Spoon \item Fork \carcamping{Knife} \end{itemize} \item Toilet kit (nothing scented): \begin{itemize} \item Toothbrush \item Toothpaste \item Dental floss \item Soap \item Alcohol hand sanitizer \item Toilet paper \item Wash cloth \item Comb / Hairbrush \item Pee rag \item Tampons / Pads \item Condoms \item Lotion \item Chapstick \item Nail clippers \item Contact lenses \item Contact lens case \item Contact lens fluid \item Spare glasses \item Mirror \end{itemize} \end{itemize} \section{Miscellaneous} \begin{itemize} \item Flashlight w/ spare batteries \item Lighter / Matches \item Multitool \item Compass \item GPS w/ spare batteries \item Camera gear w/ spare batteries \item Journal / Sketchbook \item Books \item Camp chair kit \item Plastic bags \item Caribiners \item Walking stick \item Survival / repair kit: \begin{itemize} \item Whistle \item Flashlight w/ spare batt. \item Mini saw \item Mini multitool \item Knife \item Magnesium fire starter \item Water purification tablets \item Signal mirror \item String / Cord \item Thread \& Needles \item Safety pins \item Wire \item Duct tape \end{itemize} \end{itemize} \section{Group gear} \begin{itemize} \item Car shovel \item Car water \item Spare car keys \item Maps \item First aid kit \item Tent(s) w/ poles \item Tent pegs \item Tarp \item Water carrier \item Trowel \item Deck of cards \item Thermarest patch kit \item Rope and string \carcamping{Clothes pins} \item Water filter w/ spare filter \item Wildlife book(s) \canoeing{Canoe(s)} \canoeing{Duluth packs} \item Cook kit: \begin{itemize} \item Stove(s) \item Fuel bottles \item Fuel \item Stove repair kit \item Cooking pot \item Water boiling pot \item Spatula \item Big spoon \carcamping{Dish pan} \item Dish sponge \item Dish soap \item Dish towel \item Critter defense \carcamping{Paper towels} \carcamping{Hand sanitizer} \carcamping{Knives (sharp)} \carcamping{Can opener} \carcamping{Measuring spoons} \carcamping{Vegetable peeler} \carcamping{Cheese grater} \carcamping{Cutting board} \carcamping{Tongs} \carcamping{Spatula} \carcamping{Cast iron skillet w/ lid} \carcamping{Spice kit} \carcamping{Tin foil} \carcamping{Tablecloth} \carcamping{Portable grill} \carcamping{Bun griller} \carcamping{Grilling forks} \carcamping{Cooler} \end{itemize} \carcamping{Hatchet} \carcamping{Leather gloves} \carcamping{Lantern} \carcamping{Duct tape} \carcamping{Folding chairs} \end{itemize} \end{multicols} \end{document} >> sub do_cmd { my $cmd = shift; print "*** $cmd\n"; (not system($cmd)) or die "$cmd failed: $!"; } do_cmd('rubber --ps /tmp/equipment.tex'); do_cmd('ps2pdf equipment.ps'); ### CHANGELOG # # Version 6 (2010-Jul-27, Reid): # - Warm top becomes unconditional and plural # # Version 5 (2009-Sep-20, Reid): # - Add customizing by command line argument # - Remove: binoculars, tripod # - Add: pee rag, condoms, walking stick # # Version 4 (2009-Jan-04, Reid): # - Omit checkboxes for struck-out items. # # Version 3 (2008-Jan-12, Reid): # - Implement interactivity. # - Add instep crampons. # # Version 2 (2007-Aug-12, Reid): # - Make LaTeX code better. # - Add nifty strikeout logic. # - Add nifty LaTeX-within-Perl logic. # - Add some personal items for completeness.