diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-15 22:22:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-15 22:22:28 +0000 |
commit | 47301e034c5cf0a8d82cf70bc6c1061b64c7eac3 (patch) | |
tree | a402b6478658f069e0d79adf1f02fcc536a39d11 /Master/texmf-dist/tex/latex/savetrees | |
parent | 758efcfd3fe53e9e087fd703eff4cdaaba4d7103 (diff) |
savetrees 2.0 (15may11)
git-svn-id: svn://tug.org/texlive/trunk@22491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/savetrees')
-rw-r--r-- | Master/texmf-dist/tex/latex/savetrees/savetrees.sty | 216 |
1 files changed, 155 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/savetrees/savetrees.sty b/Master/texmf-dist/tex/latex/savetrees/savetrees.sty index b69c664474d..f68ae9d79aa 100644 --- a/Master/texmf-dist/tex/latex/savetrees/savetrees.sty +++ b/Master/texmf-dist/tex/latex/savetrees/savetrees.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2010 by Scott Pakin <scott+st@pakin.org> +%% Copyright (C) 2011 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 @@ -22,48 +22,138 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{savetrees} - [2010/06/03 v1.3 Pack as much text as possible onto each page] -\newif\if@st@normal@sections -\DeclareOption{normalsections}{\@st@normal@sectionstrue} -\newif\if@st@normal@margins -\DeclareOption{normalmargins}{\@st@normal@marginstrue} -\newif\if@st@normal@lists -\DeclareOption{normallists}{\@st@normal@liststrue} -\newif\if@st@normal@floats -\DeclareOption{normalfloats}{\@st@normal@floatstrue} -\newif\if@st@normal@indent -\DeclareOption{normalindent}{\@st@normal@indenttrue} -\newif\if@st@normal@title -\DeclareOption{normaltitle}{\@st@normal@titletrue} -\newif\if@st@normal@leading -\DeclareOption{normalleading}{\@st@normal@leadingtrue} -\newif\if@st@normal@looseness -\DeclareOption{normallooseness}{\@st@normal@loosenesstrue} -\newif\if@st@normal@char@widths -\DeclareOption{normalcharwidths}{\@st@normal@char@widthstrue} -\newif\if@st@normal@bib -\DeclareOption{normalbib}{\@st@normal@bibtrue} -\newif\if@st@normal@bibnotes -\DeclareOption{normalbibnotes}{\@st@normal@bibnotestrue} -\ProcessOptions\relax -\if@st@normal@sections -\else - \RequirePackage[tiny,compact]{titlesec} + [2011/05/14 v2.0 Pack as much text as possible onto each page] +\newcommand*{\st@margin@width}{1.5cm} +\newcommand*{\st@parindent}{1em} +\newcommand*{\st@baselinestretch}{0.9} +\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} +\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 + \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 + \fi +} +\DeclareOptionX{all}[tight]{\KV@savetrees@all{#1}} +\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 -\newlength{\@st@marginsize} -\setlength{\@st@marginsize}{1.5cm} -\if@st@normal@margins -\else - \RequirePackage[lmargin=\@st@marginsize, - rmargin=\@st@marginsize, - tmargin=\@st@marginsize, - bmargin=\@st@marginsize, - includefoot, - footskip=2ex]{geometry} +\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@normal@lists -\else - \RequirePackage{calc} +\if@st@tight@lists + \st@RequirePackage{calc} \def\itemize{% \ifnum \@itemdepth >\thr@@\@toodeep\else \advance\@itemdepth\@ne @@ -77,6 +167,7 @@ \setlength{\topsep}{4pt plus 1pt minus 2pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}% + \setlength{\listparindent}{\st@parindent}% }% \fi} \def\enumerate{% @@ -92,6 +183,7 @@ \setlength{\topsep}{4pt plus 1pt minus 2pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}% + \setlength{\listparindent}{\st@parindent}% } \fi} \renewenvironment{description}{% @@ -102,8 +194,7 @@ \end{list} } \fi -\if@st@normal@floats -\else +\if@st@tight@floats \renewcommand{\topfraction}{0.85} \renewcommand{\bottomfraction}{0.85} \renewcommand{\textfraction}{0.1} @@ -115,12 +206,10 @@ \setcounter{totalnumber}{25} \setcounter{dbltopnumber}{25} \fi -\if@st@normal@indent -\else - \setlength{\parindent}{1em} +\if@st@tight@indent + \setlength{\parindent}{\st@parindent} \fi -\if@st@normal@title -\else +\if@st@tight@title \def\@maketitle{% \newpage \null @@ -138,23 +227,28 @@ \vskip \baselineskip } \fi -\if@st@normal@leading -\else - \renewcommand{\baselinestretch}{0.9} +\if@st@tight@leading + \renewcommand{\baselinestretch}{\st@baselinestretch} \fi -\if@st@normal@looseness -\else +\if@st@tight@paragraphs \let\markeverypar\everypar \newtoks\everypar \everypar\markeverypar \markeverypar{\the\everypar\looseness=-1\relax} \fi -\if@st@normal@char@widths -\else - \RequirePackage[stretch=0,shrink=50]{microtype} +\if@st@tight@charwidths + \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype} \fi -\if@st@normal@bib -\else +\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 @@ -185,10 +279,10 @@ \endlist } \fi -\if@st@normal@bibnotes - \newcommand{\savetreesbibnote}[1]{#1} -\else +\if@st@tight@bibnotes \newcommand{\savetreesbibnote}[1]{\@gobble} +\else + \newcommand{\savetreesbibnote}[1]{#1} \fi \endinput %% |