%%
%% This is file `savetrees.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% savetrees.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2013 by Scott Pakin <scott+st@pakin.org>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2006/05/20 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{savetrees}
    [2013/04/09 v2.1 Pack as much text as possible onto each page]
\newcommand*{\st@margin@width}{1.5cm}
\newcommand*{\st@parindent}{1em}
\newcommand*{\st@baselinestretch}{0.95}
\newcommand*{\st@char@shrink}{50}
\newcommand*{\st@cspace@shrink}{-25}
\newcommand*{\st@wspace@factor}{0.8}
\RequirePackage{xkeyval}
\def\st@more@packages{}
\newcommand*{\st@RequirePackage}[2][]{%
  \PassOptionsToPackage{#1}{#2}%
  \@cons\st@more@packages{{#2}}%
}
\AtEndOfPackage{%
  \let\@elt=\RequirePackage
  \st@more@packages
  \let\@elt=\relax
}
\newcommand*{\st@define@option}[1]{%
  \expandafter\newif\csname if@st@tight@#1\endcsname
  \csname @st@tight@#1true\endcsname
  \define@choicekey{savetrees}{#1}[\st@arg\st@arg@num]{tight,normal}[tight]{%
    \ifnum\st@arg@num=0
      \csname @st@tight@#1true\endcsname
    \else
        \csname @st@tight@#1false\endcsname
    \fi
  }%
  \DeclareOptionX{#1}[tight]{\csname KV@savetrees@#1\endcsname{##1}}%
}
\st@define@option{sections}
\st@define@option{margins}
\st@define@option{lists}
\st@define@option{floats}
\st@define@option{indent}
\st@define@option{title}
\st@define@option{leading}
\st@define@option{paragraphs}
\st@define@option{charwidths}
\st@define@option{tracking}
\st@define@option{wordspacing}
\st@define@option{bibliography}
\st@define@option{bibnotes}
\st@define@option{mathspacing}
\st@define@option{mathdisplays}
\define@choicekey{savetrees}{all}[\st@arg\st@arg@num]{tight,normal}[tight]{%
  \ifnum\st@arg@num=0
    \@st@tight@sectionstrue
    \@st@tight@marginstrue
    \@st@tight@liststrue
    \@st@tight@floatstrue
    \@st@tight@indenttrue
    \@st@tight@titletrue
    \@st@tight@leadingtrue
    \@st@tight@paragraphstrue
    \@st@tight@charwidthstrue
    \@st@tight@trackingtrue
    \@st@tight@wordspacingtrue
    \@st@tight@bibliographytrue
    \@st@tight@bibnotestrue
    \@st@tight@mathspacingtrue
    \@st@tight@mathdisplaystrue
  \else
    \@st@tight@sectionsfalse
    \@st@tight@marginsfalse
    \@st@tight@listsfalse
    \@st@tight@floatsfalse
    \@st@tight@indentfalse
    \@st@tight@titlefalse
    \@st@tight@leadingfalse
    \@st@tight@paragraphsfalse
    \@st@tight@charwidthsfalse
    \@st@tight@trackingfalse
    \@st@tight@wordspacingfalse
    \@st@tight@bibliographyfalse
    \@st@tight@bibnotesfalse
    \@st@tight@mathspacingfalse
    \@st@tight@mathdisplaysfalse
  \fi
}
\DeclareOptionX{all}[tight]{\KV@savetrees@all{#1}}
\define@key{savetrees}{subtle}{%
  \setkeys{savetrees}{%
    all=normal,
    paragraphs=tight,
    floats=tight,
    mathspacing=tight,
    wordspacing=tight,
    tracking=tight
  }%
}
\DeclareOptionX{subtle}{\KV@savetrees@subtle}
\define@key{savetrees}{moderate}{%
  \setkeys{savetrees}{%
    subtle=yes,
    charwidths=tight,
    mathdisplays=tight,
    lists=tight,
    indent=tight,
    leading=tight,
    bibnotes=tight
  }%
}
\DeclareOptionX{moderate}{\KV@savetrees@moderate}
\DeclareOptionX{extreme}{%
  \setkeys{savetrees}{all=tight}%
}
\DeclareOptionX{marginwidth}{\gdef\st@margin@width{#1}}
\DeclareOptionX{parindent}{\gdef\st@parindent{#1}}
\DeclareOptionX{leadingfraction}{\gdef\st@baselinestretch{#1}}
\DeclareOptionX{charwidthfraction}{%
  \@tempdima=#1pt
  \multiply\@tempdima by -1000
  \advance\@tempdima by 1000pt
  \divide\@tempdima by 65536
  \@tempcnta=\@tempdima
  \xdef\st@char@shrink{\the\@tempcnta}%
}
\DeclareOptionX{trackingfraction}{%
  \@tempdima=#1pt
  \advance\@tempdima by -1pt
  \multiply\@tempdima by 1000
  \divide\@tempdima by 65536
  \@tempcnta=\@tempdima
  \xdef\st@cspace@shrink{\the\@tempcnta}%
}
\DeclareOptionX{wordspacingfraction}{\gdef\st@wspace@factor{#1}}
\newcommand*{\st@mark@as@obsolete}[2]{%
  \define@key{savetrees}{#1}[tight]{%
    \PackageError{savetrees}{Package option `#1' is no longer supported}{%
      Rather than `#1', please specify `#2=normal'.\MessageBreak
      Instead of enabling all features by default and letting the\MessageBreak
      user selectively disable them, savetrees now provides the\MessageBreak
      ability to turn features on or off as desired, including all\MessageBreak
      features en masse.}%
    \csname @st@tight@#2false\endcsname
  }%
  \DeclareOptionX{#1}[tight]{\csname KV@savetrees@#1\endcsname{##1}}%
}
\st@mark@as@obsolete{normalsections}{sections}
\st@mark@as@obsolete{normalmargins}{margins}
\st@mark@as@obsolete{normallists}{lists}
\st@mark@as@obsolete{normalfloats}{floats}
\st@mark@as@obsolete{normalindent}{indent}
\st@mark@as@obsolete{normaltitle}{title}
\st@mark@as@obsolete{normalleading}{leading}
\st@mark@as@obsolete{normallooseness}{paragraphs}
\st@mark@as@obsolete{normalcharwidths}{charwidths}
\st@mark@as@obsolete{normalbib}{bibliography}
\st@mark@as@obsolete{normalbibnotes}{bibnotes}
\ProcessOptionsX\relax
\if@st@tight@sections
  \st@RequirePackage[tiny,compact]{titlesec}
\fi
\if@st@tight@margins
  \st@RequirePackage[lmargin=\st@margin@width,
                     rmargin=\st@margin@width,
                     tmargin=\st@margin@width,
                     bmargin=\st@margin@width,
                     includefoot,
                     footskip=2ex]{geometry}
\fi
\if@st@tight@lists
  \st@RequirePackage{calc}
  \def\itemize{%
    \ifnum \@itemdepth >\thr@@\@toodeep\else
      \advance\@itemdepth\@ne
      \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
      \expandafter
      \list
        \csname\@itemitem\endcsname
        {\def\makelabel##1{\hss\llap{##1}}%
         \settowidth{\leftmargin}{\csname\@itemitem\endcsname}%
         \addtolength{\leftmargin}{\labelsep * \@itemdepth}%
         \setlength{\partopsep}{0pt plus 4pt}%
         \setlength{\topsep}{0pt plus 4pt}%
         \setlength{\itemsep}{0pt}%
         \setlength{\parsep}{0pt}%
         \setlength{\listparindent}{\st@parindent}%
        }%
    \fi}
  \def\enumerate{%
    \ifnum \@enumdepth >\thr@@\@toodeep\else
      \advance\@enumdepth\@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
        \expandafter
        \list
          \csname label\@enumctr\endcsname
          {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}%
           \settowidth{\leftmargin}{\csname label\@enumctr\endcsname}%
           \addtolength{\leftmargin}{\labelsep * \@enumdepth}%
           \setlength{\partopsep}{0pt plus 4pt}%
           \setlength{\topsep}{0pt plus 4pt}%
           \setlength{\itemsep}{0pt}%
           \setlength{\parsep}{0pt}%
           \setlength{\listparindent}{\st@parindent}%
          }
    \fi}
  \renewenvironment{description}{%
    \begin{list}{}{\setlength{\leftmargin}{1pc}%
                   \setlength{\itemindent}{-\leftmargin}%
                   \setlength{\partopsep}{0pt plus 4pt}%
                   \setlength{\topsep}{0pt plus 4pt}%
                   \setlength{\itemsep}{0pt}%
                   \setlength{\parsep}{0pt}%
                   \setlength{\labelwidth}{0pt}%
                   \setlength{\listparindent}{\st@parindent}%
                   \let\makelabel\descriptionlabel}%
  }{%
    \end{list}
  }
\fi
\if@st@tight@floats
  \renewcommand{\topfraction}{0.85}
  \renewcommand{\bottomfraction}{0.85}
  \renewcommand{\textfraction}{0.1}
  \renewcommand{\floatpagefraction}{0.85}
  \renewcommand{\dbltopfraction}{0.85}
  \renewcommand{\dblfloatpagefraction}{.85}
  \setcounter{topnumber}{25}
  \setcounter{bottomnumber}{25}
  \setcounter{totalnumber}{25}
  \setcounter{dbltopnumber}{25}
\fi
\if@st@tight@indent
  \setlength{\parindent}{\st@parindent}
\fi
\if@st@tight@title
  \def\@maketitle{%
    \newpage
    \null
    \begin{center}%
      \let \footnote \thanks
      {\large \textbf{\@title}\par}
      \vskip 0.5\baselineskip
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par
      \vskip 0.5\baselineskip
      \@date
    \end{center}%
    \par
    \vskip \baselineskip
  }
\fi
\if@st@tight@leading
  \renewcommand{\baselinestretch}{\st@baselinestretch}
\fi
\if@st@tight@paragraphs
  \let\markeverypar\everypar
  \newtoks\everypar
  \everypar\markeverypar
  \markeverypar{\the\everypar\looseness=-1\relax}
\fi
\if@st@tight@charwidths
  \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype}
\fi
\if@st@tight@tracking
  \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype}
\fi
\if@st@tight@wordspacing
  \g@addto@macro\define@newfont{%
    \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
  }%
  \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
\fi
\if@st@tight@bibliography
  \renewenvironment{thebibliography}[1]{%
    \@ifundefined{chapter}{%
      \section*{\refname
        \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
    }{%
      \chapter*{\bibname
        \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
    }%
    \list{\@biblabel{\@arabic\c@enumiv}}%
         {\settowidth\labelwidth{\@biblabel{#1}}%
          \leftmargin\labelwidth
          \advance\leftmargin\labelsep
          \setlength{\parsep}{0pt}%
          \setlength{\itemsep}{1pt}%
          \@openbib@code
          \usecounter{enumiv}%
          \let\p@enumiv\@empty
          \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \small
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m
  }{%
    \def\@noitemerr
         {\@latex@warning{Empty `thebibliography' environment}}%
    \endlist
  }
\fi
\if@st@tight@bibnotes
  \newcommand{\savetreesbibnote}[1]{\@gobble}
\else
  \newcommand{\savetreesbibnote}[1]{#1}
\fi
\if@st@tight@mathspacing
  \AtBeginDocument{%
    \thinmuskip=0mu plus 3mu
    \medmuskip=1mu plus 4mu
    \thickmuskip=2mu plus 5mu
  }
\fi
\if@st@tight@mathdisplays
  \AtBeginDocument{%
    \abovedisplayskip=0pt plus 3pt
    \belowdisplayskip=0pt plus 3pt
    \abovedisplayshortskip=0pt plus 3pt
    \belowdisplayshortskip=0pt plus 3pt
  }
\fi
\endinput
%%
%% End of file `savetrees.sty'.
