summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-05-15 22:22:28 +0000
committerKarl Berry <karl@freefriends.org>2011-05-15 22:22:28 +0000
commit47301e034c5cf0a8d82cf70bc6c1061b64c7eac3 (patch)
treea402b6478658f069e0d79adf1f02fcc536a39d11 /Master
parent758efcfd3fe53e9e087fd703eff4cdaaba4d7103 (diff)
savetrees 2.0 (15may11)
git-svn-id: svn://tug.org/texlive/trunk@22491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/bibtex/bst/savetrees/savetrees.bst4
-rw-r--r--Master/texmf-dist/doc/latex/savetrees/README24
-rw-r--r--Master/texmf-dist/doc/latex/savetrees/makethin.pl646
-rw-r--r--Master/texmf-dist/doc/latex/savetrees/savetrees.pdfbin246435 -> 369261 bytes
-rw-r--r--Master/texmf-dist/source/latex/savetrees/savetrees.dtx2735
-rw-r--r--Master/texmf-dist/source/latex/savetrees/savetrees.ins25
-rw-r--r--Master/texmf-dist/tex/latex/savetrees/savetrees.sty216
7 files changed, 1296 insertions, 2354 deletions
diff --git a/Master/texmf-dist/bibtex/bst/savetrees/savetrees.bst b/Master/texmf-dist/bibtex/bst/savetrees/savetrees.bst
index fe015c5b38e..54c43b9f24d 100644
--- a/Master/texmf-dist/bibtex/bst/savetrees/savetrees.bst
+++ b/Master/texmf-dist/bibtex/bst/savetrees/savetrees.bst
@@ -1397,9 +1397,9 @@ FUNCTION {begin.bib}
if$
"\begin{thebibliography}{" longest.label * "}" *
write$ newline$
- "\expandafter\ifx\csname selectlanguage\endcsname\relax"
+ "\providecommand*{\selectlanguage}[1]{\relax}%"
write$ newline$
- " \def\selectlanguage#1{\relax}\fi"
+ "\providecommand*{\savetreesbibnote}[1]{#1}%"
write$ newline$
}
diff --git a/Master/texmf-dist/doc/latex/savetrees/README b/Master/texmf-dist/doc/latex/savetrees/README
index bbd4a35391c..3bcd4b17176 100644
--- a/Master/texmf-dist/doc/latex/savetrees/README
+++ b/Master/texmf-dist/doc/latex/savetrees/README
@@ -1,6 +1,6 @@
- +------------------------------------+
- | THE SAVETREES PACKAGE |
- | By Scott Pakin, scott+st@pakin.org |
+ +------------------------------------+
+ | THE SAVETREES PACKAGE |
+ | By Scott Pakin, scott+st@pakin.org |
+------------------------------------+
@@ -20,34 +20,20 @@ Installation
Building the savetrees package is fairly straightforward:
- latex savetrees.ins <= Extract savetrees.sty, savetrees.bst,
- and makethin.pl.
+ latex savetrees.ins <= Extract savetrees.sty and savetrees.bst.
latex savetrees.dtx <= Build the documentation (savetrees.dvi).
makeindex -s gind.ist savetrees <= Generate an index (makeindex.ind).
latex savetrees.dtx <= Add the index to the documentation.
-Then, on Unix:
-
- mv makethin.pl makethin <= Drop the unnecessary .pl extension.
- chmod +x makethin <= Make the Perl script executable.
-
To install savetrees, move savetrees.sty into a directory searched by
LaTeX (e.g., .../texmf/tex/latex/misc/) and move savetrees.bst into a
directory searched by BibTeX (e.g., .../texmf/bibtex/bst/misc/).
-If you have both Perl and a Kpathsea-based TeX distribution -- i.e.,
-you have a "kpsewhich" command -- then you should additionally install
-the makethin script somewhere in your path (e.g., /usr/local/bin). On
-a Unix system you can produce a man page using a command like the
-following:
-
- makethin --man=/usr/local/man/man1/makethin.1
-
Copyright and license
=====================
-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
diff --git a/Master/texmf-dist/doc/latex/savetrees/makethin.pl b/Master/texmf-dist/doc/latex/savetrees/makethin.pl
deleted file mode 100644
index f2f74532c02..00000000000
--- a/Master/texmf-dist/doc/latex/savetrees/makethin.pl
+++ /dev/null
@@ -1,646 +0,0 @@
-#! /usr/bin/env perl
-
-# Make a thinner version of a LaTeX font
-# By Scott Pakin <scott+st@pakin.org>
-
-use File::Basename;
-use Getopt::Long;
-use Pod::Usage;
-use Pod::Man;
-use warnings;
-use strict;
-
-# Define some global variables.
-my $progname = basename $0; # Name of this program
-my @fontlist; # List of fonts to make thinner
-my @skipfonts; # Fonts specified by the user to ignore
-my @extrafonts; # Additional fonts specified by the user
-my @extramaps; # Additional .map files specified by the user
-my @configexts; # List of config.* files to process
-my @mapfiles; # List of .map files to copy and modify
-my @megamap; # Entire contents of all .map files
-my $cleanfirst; # Delete *.{tfm,vf} before creating new ones
-my $cleanonly; # Same as $cleanfirst, but exit after deleting
-my $dvifile; # Name of input .dvi file
-my $xscale = 0.5; # New font width as a fraction of the original
-my $verbose = 0; # 1=output task info; >1=output file info
-my $base = "thin"; # Name to use for config.* and *.map
-my $also_pdftex = 0; # 1=also produce a pdftex.map
-
-###########################################################################
-
-# Set or change a filename's extension.
-sub set_ext ($$)
-{
- my ($name, $path, $suffix) = fileparse ($_[0], '\.[^.]*');
- $path="" if $path eq "./";
- return $path . $name . $_[1];
-}
-
-
-# Try to find a file on disk using kpsewhich. Extra arguments to
-# kpsewhich can be included, too.
-sub find_file (@)
-{
- chomp (my $result = `kpsewhich @_`);
- return $? ? undef : $result;
-}
-
-
-# Make a font thinner.
-sub thin_font ($$$$)
-{
- my ($fname, $fpath, $fsuffix, $only_fontnames) = @_;
- my $virtualfont = $fsuffix eq ".vf";
- my $converter = $virtualfont ? "vftovp" : "tftopl";
- open (ASCII_TEXT, "$converter $fpath$fname$fsuffix|") || die "open(): $!\n";
-
- # If we already converted the font, then merely look for additional fonts.
- if ($only_fontnames) {
- while (<ASCII_TEXT>) {
- /\(FONTNAME ([^\)]+)\)/i && push @fontlist, $1;
- }
- close ASCII_TEXT;
- return;
- }
-
- # Modify character widths. Also, store the name of any additional font
- # we encounter in a virtual font file.
- my $ascii_file = $virtualfont ? "$fname.vpl" : "$fname.pl";
- open (ASCII_FILE, ">$ascii_file") || die "open(\"$ascii_file\"): $!\n";
- while (<ASCII_TEXT>) {
- /\(FONTNAME ([^\)]+)\)/i && push @fontlist, $1;
- s|^(\s*)\(CHARWD (\S+) ([^\)]+)\)|sprintf "%s(CHARWD %s %.7f)", $1, $2, $3*$xscale|gie;
- print ASCII_FILE $_;
- }
- close ASCII_FILE;
- close ASCII_TEXT;
-
- # Convert the result from ASCII to binary.
- if ($virtualfont) {
- system "vptovf $fname.vpl";
- die "system: $!\n" if $?;
- unlink "$fname.vpl";
- }
- else {
- system "pltotf $fname.pl";
- die "system: $!\n" if $?;
- unlink "$fname.pl";
- }
-}
-
-
-# Re-map a font to a thinner variant.
-sub remap_font ($)
-{
- # See if any map file maps the given font.
- my $fontname = $_[0];
- my @matches = grep {/^$fontname\s/} @megamap;
- return undef if $#matches==-1;
-
- # One does -- scale the font as specified.
- my $quoted = "";
- while ($matches[0] =~ s/\"([^\"]+)\"//) {
- $quoted .= $1 . " ";
- }
- $matches[0] =~ s/\s+/ /g;
- $quoted =~ s/\S+\s+ExtendFont//g;
- $quoted .= "$xscale ExtendFont";
- return $matches[0] . " \"$quoted\"";
-}
-
-
-# Output the embedded POD documentation in either *roff or PostScript format.
-sub pod2man ($$)
-{
- my ($manfile, $extraformatting) = @_;
-
- # Create an ordinary man page.
- my $parser = Pod::Man->new (center => "",
- date => "17 July 2004",
- release => "");
- $parser->parse_from_file ($0, $manfile);
-
- # If requested, perform some extra formatting to make the
- # documentation print nicer.
- return if !$extraformatting;
- my @formattedman;
- open (MANPAGE, "<$manfile") || die "open(\"$manfile\"): $!\n";
- while (<MANPAGE>) {
- s/LaTeX/L\\h'-0.36m'\\v'-0.15'\\s-2A\\s+2\\v'0.15'\\h'-0.15m'TeX/g;
- s/TeX/T\\h'-0.1667m'\\v'0.20'E\\v'-0.20'\\h'-0.125m'X/g;
- s/\\\*\(--/--/g;
- push @formattedman, $_;
- }
- close MANPAGE;
- open (MANPAGE, "| groff -man > $manfile") || die "open(\"$manfile\"): $!\n";
- print MANPAGE @formattedman;
- close MANPAGE;
-}
-
-###########################################################################
-
-# Parse the command line.
-my $wanthelp = 0;
-Getopt::Long::Configure ("bundling");
-GetOptions ("h|help" => \$wanthelp,
- "x|xscale=f" => \$xscale,
- "b|basename=s" => \$base,
- "k|skipfonts=s" => \@skipfonts,
- "e|extrafonts=s" => \@extrafonts,
- "m|extramaps=s" => \@extramaps,
- "P|config=s" => \@configexts,
- "c|clean" => \$cleanonly,
- "C|cleanfirst" => \$cleanfirst,
- "p|pdftex" => \$also_pdftex,
- "man=s" => sub {pod2man ($_[1], 0); exit 0},
- "man-ps=s" => sub {pod2man ($_[1], 1); exit 0},
- "v|verbose+" => \$verbose) || pod2usage (-verbose => 0,
- -exitval => 1);
-pod2usage (-verbose => $verbose,
- -exitval => 0) if $wanthelp;
-pod2usage (-verbose => 0,
- -exitval => 1) if $#ARGV==-1;
-$dvifile = $ARGV[0];
-
-# Get a list of fonts from the DVI file and from the command line.
-print "Acquiring font names from $dvifile\n" if $verbose;
-open (DVI, "dvitype $dvifile|") || die "open(): $!\n";
-my %uniquefonts;
-while (<DVI>) {
- /Font \d+: (\w+)/ && do {$uniquefonts{$1}=1};
-}
-close DVI;
-foreach (map {split /,/, $_} @extrafonts) {
- $uniquefonts{$_} = 1;
-}
-@fontlist = sort {$a cmp $b} keys %uniquefonts;
-my %skipfonts = map {($_ => 1)} map {split /,/, $_} @skipfonts;
-
-# If told to, delete generated files from previous runs.
-if ($cleanfirst || $cleanonly) {
- print "Deleting generated font files, configuration files, and font maps\n" if $verbose;
- my @old_fontlist = @fontlist;
- while (@fontlist) {
- my $fontname = shift @fontlist;
- if ($skipfonts{$fontname}) {
- print " Ignoring $fontname (as directed by the command line)\n" if $verbose>1;
- next;
- }
- thin_font ($fontname, "", ".vf", 1) if -e "$fontname.vf";
- foreach my $fsuffix (".vf", ".tfm") {
- if (-e "$fontname$fsuffix") {
- print " Removing $fontname$fsuffix\n" if $verbose>1;
- unlink "$fontname$fsuffix";
- }
- }
- }
- my @extra_deletes = ("config.$base", "$base.map");
- push (@extra_deletes, "pdftex.cfg") if $also_pdftex;
- foreach (@extra_deletes) {
- if (-e $_) {
- print " Removing $_\n" if $verbose>1;
- unlink $_;
- }
- }
- exit 0 if $cleanonly;
- @fontlist = @old_fontlist;
-}
-
-# Convert each font in turn.
-print "Creating *.tfm and *.vf files with ${xscale}X horizontal scaling\n" if $verbose;
-my %allfonts;
-while (@fontlist) {
- my $fontname = shift @fontlist;
- if ($skipfonts{$fontname}) {
- print " Ignoring $fontname (as directed by the command line)\n" if $verbose>1;
- next;
- }
- $allfonts{$fontname} = 1;
- if (-e (set_ext $fontname, ".vf") || -e (set_ext $fontname, ".tfm")) {
- print " Skipping $fontname (already converted)\n" if $verbose>1;
- if (-e set_ext $fontname, ".vf") {
- $fontname .= ".vf";
- }
- else {
- $fontname .= ".tfm";
- }
- my ($fname, $fpath, $fsuffix) = fileparse $fontname, "\.[^.]*";
- thin_font ($fname, $fpath, $fsuffix, 1); # Only search for new fonts.
- }
- else {
- # Use a .vf file if available. If not, then use the .tfm file.
- print " Processing $fontname\n" if $verbose>1;
- my ($fname, $fpath, $fsuffix);
- if (find_file "$fontname.vf") {
- ($fname, $fpath, $fsuffix) = fileparse find_file ("$fontname.vf"), ".vf";
- }
- elsif (find_file "$fontname.tfm") {
- ($fname, $fpath, $fsuffix) = fileparse find_file ("$fontname.tfm"), ".tfm";
- }
- else {
- die "${progname}: I don't know anything about $fontname\n";
- }
-
- # Convert the font.
- thin_font ($fname, $fpath, $fsuffix, 0);
- }
-}
-
-# Acquire a list of .map files to process.
-print "Reading dvips configuration files (config.*)\n" if $verbose;
-foreach my $ext ("ps", @configexts) {
- my $configfile = find_file '--format="dvips config"', "config.$ext";
- die "${progname}: unable to find config.$ext\n" if !$configfile;
- print " Searching for map files in $configfile\n" if $verbose>1;
- open (CONFIGFILE, "<$configfile") || die "open(\"$configfile\"): $!\n";
- while (<CONFIGFILE>) {
- # Search for a PostScript font alias filename.
- chomp;
- s/\%.*//;
- next if !/^\s*p\s+(\+?)(\S+)/;
-
- # We found it -- adjust the list of .map files accordingly.
- @mapfiles=() if $1 eq "";
- my $map = find_file '--format="dvips config"', $2;
- die "${progname}: unable to find $2\n" if !$map;
- push @mapfiles, $map;
- }
- close CONFIGFILE;
-}
-
-# Merge the contents of all map files into @megamap.
-print "Reading font maps (*.map)\n" if $verbose;
-foreach my $mapfile ((map {split /,/, $_} @extramaps), @mapfiles) {
- print " Reading font mappings from $mapfile\n" if $verbose>1;
- open (MAPFILE, "<$mapfile") || die "open(\"$mapfile\"): $!\n";
- chomp (my @mappings = <MAPFILE>);
- close MAPFILE;
- push @megamap, @mappings;
-}
-
-# Create a dvips configuration file.
-print "Generating config.$base\n" if $verbose;
-open (CONFIG, ">config.$base") || die "open(\"config.$base\"): $!\n";
-print CONFIG <<"CONFIG_EOF";
-% This file can be freely modified. It can also be
-% redistributed, provided that it is not called "config.thin".
-p +$base.map
-CONFIG_EOF
-close CONFIG;
-
-# Create a dvips map file.
-print "Generating $base.map\n" if $verbose;
-open (FONTMAP, ">$base.map") || die "open(\"$base.map\"): $!\n";
-print FONTMAP <<'FONTMAP_EOF';
-% This file can be freely modified. It can also be
-% redistributed, provided that it is not called "thin.map".
-FONTMAP_EOF
-my $num_maps = 0;
-foreach my $fontname (sort {$a cmp $b} keys %allfonts) {
- my $remapping = remap_font $fontname;
- if ($remapping) {
- print FONTMAP $remapping, "\n";
- print " Wrote mapping for $fontname\n" if $verbose>1;
- $num_maps++;
- }
- elsif (! -e "$fontname.vf") {
- warn "${progname}: warning: no mapping was found for $fontname\n";
- }
-}
-close FONTMAP;
-warn "${progname}: warning: no fonts were written to $base.map\n" if !$num_maps;
-
-# Create a pdfTeX config file.
-if ($also_pdftex) {
- print "Generating pdftex.cfg\n" if $verbose;
- unlink "pdftex.cfg";
- my $pdfcfg = find_file "--progname=pdftex", "pdftex.cfg";
- die "${progname}: unable to find pdftex.cfg\n" if !$pdfcfg;
- open (INCONFIG, "<$pdfcfg") || die "open(\"$pdfcfg\"): $!\n";
- open (OUTCONFIG, ">pdftex.cfg") || die "open(\"pdftex.cfg\"): $!\n";
- while (<INCONFIG>) {
- next if /^\s*map\s/; # Discard all map lines.
- print OUTCONFIG $_;
- }
- print OUTCONFIG "\n% The next line was added by $progname.\n";
- print OUTCONFIG "map $base.map\n";
- close OUTCONFIG;
- close INCONFIG;
-}
-
-###########################################################################
-
-__END__
-
-=head1 NAME
-
-makethin - make thinner versions of PostScript fonts for TeX
-
-
-=head1 SYNOPSIS
-
-makethin
-[B<--verbose>]
-[B<--xscale>=I<factor>]
-[B<--cleanfirst>]
-[B<--clean>]
-[B<--config>=I<extension>]
-[B<--pdftex>]
-[B<--extramaps>=I<file>[,I<file>]...]
-[B<--skipfonts>=I<font>[,I<font>]...]
-[B<--basename>=I<string>]
-[B<--extrafonts>=I<font>[,I<font>]...]
-I<.dvi file>
-
-makethin
-[B<--verbose>]
-B<--help>
-
-makethin
-B<--man>=I<man page> | B<--man-ps>=I<PostScript file>
-
-
-
-=head1 DESCRIPTION
-
-B<makethin> produces thinner versions of PostScript fonts for use with
-TeX/LaTeX and Dvips. More precisely, it finds all of the F<.tfm>
-and F<.vf> fonts referred to by a F<.dvi> file, scales the
-character-width metrics by a given amount, and writes new F<.tfm> and
-F<.vf> files to the current directory. B<makethin> then generates a
-customized F<.map> and F<config> file for Dvips and, optionally, a
-customized F<pdftex.cfg> file for pdfLaTeX.
-
-The general procedure for using B<makethin> is as follows:
-
-=over 4
-
-=item 1.
-
-Run B<latex> on your F<.tex> source file to produce a F<.dvi> file.
-
-=item 2.
-
-Run B<makethin> on the F<.dvi> file to create new F<.tfm>, F<.vf>,
-F<.map>, and F<config> files.
-
-=item 3.
-
-Re-run B<latex> on your F<.tex> source file to typeset it with the new
-fonts.
-
-=item 4.
-
-Run B<dvips> on the F<.dvi> file, specifying the newly generated
-F<.map> and F<config> files, to produce a F<.ps> file.
-
-=back
-
-
-=head1 OPTIONS
-
-The following are the command-line options that B<makethin> accepts:
-
-=over 4
-
-=item B<-v>, B<--verbose>
-
-Increase the verbosity of the status output. B<--verbose> can be
-specified multiple times on the same command line, with each
-B<--verbose> futher increasing the verbosity. (Currently, two
-B<--verbose>s have maximal impact.)
-
-=item B<-h>, B<--help>
-
-Display basic usage information. When combined with B<--verbose>,
-additionally describes each of the command-line options. When
-combined with a second B<--verbose>, B<--help> outputs the complete
-B<makethin> manual page.
-
-=item B<-x> I<factor>, B<--xscale>=I<factor>
-
-Scale fonts horizontally by a factor of I<factor>. The default,
-C<0.5>, produces nearly illegible fonts but is useful for verifying
-that B<makethin> actually worked. Factors of C<0.90>-C<0.99> are more
-reasonable.
-
-=item B<-C>, B<--cleanfirst>
-
-Delete all files generated by a previous run of B<makethin> before
-generating new ones.
-
-=item B<-c>, B<--clean>
-
-Delete all files generated by a previous run of B<makethin> and then
-exit.
-
-=item B<-P> I<extension>, B<--config>=I<extension>
-
-Process all of the F<.map> files named in F<config.>I<extension>
-(found in Dvips's configuration directory). B<--config> can be
-specified multiple times on the same command line. F<config.ps> is
-processed implicitly. The same B<-P> arguments that you would
-normally pass to B<dvips> to utilize entirely PostScript fonts (e.g.,
-B<-Pcmz> and B<-Pamz>) should also be passed to B<makethin>.
-
-=item B<-p>, B<--pdftex>
-
-In addition to producing the files needed by Dvips, also produce a
-F<pdftex.cfg> file that is usable by pdfLaTeX.
-
-=item B<-m> I<file>[,I<file>]...], B<--extramaps>=I<file>[,I<file>]...]
-
-Additionally process the named Dvips F<.map> files even if they're
-not referred to by any of the F<config.>I<extension> files specified
-with B<--config>. B<--extramaps> can be specified multiple times on
-the same command line.
-
-=item B<-k> I<font>[,I<font>]...], B<--skipfonts>=I<font>[,I<font>]...]
-
-Don't make thin versions of the named fonts, even if they're listed in
-the F<.dvi> file. Fonts are named using the Berry scheme (i.e.,
-``C<pcrr8a>'' as opposed to ``C<COURB>'' or ``C<Courier-Bold>'').
-B<--skipfonts> can be specified multiple times on the same command
-line.
-
-=item B<-b> I<string>, B<--basename>=I<string>
-
-Tell B<makethin> to use I<string> as the base name for the Dvips
-configuration files it generates. The default is ``C<thin>'', so
-B<makethin> normally produces files named F<config.thin> and
-F<thin.map>, but B<--basename> enables alternate filenames to be used.
-
-=item B<-e> I<font>[,I<font>]...], B<--extrafonts>=I<font>[,I<font>]...]
-
-Make thin versions of the named fonts, even if they're not listed in
-the F<.dvi> file. Fonts are named using the Berry scheme (i.e.,
-``C<pcrr8a>'' as opposed to ``C<COURB>'' or ``C<Courier-Bold>'').
-B<--extrafonts> can be specified multiple times on the same command
-line.
-
-=item B<--man>=I<man page>
-
-Create a Unix manual page for B<makethin> in the standard, *roff
-format. Typical usage is:
-
- makethin --man=/usr/man/man1/makethin.1
-
-=item B<--man-ps>=I<PostScript file>
-
-Create a Unix manual page for B<makethin> in PostScript format instead
-of *roff format.
-
-=back
-
-In addition to the options listed above, B<makethin> has a required
-argument, which is the name of a F<.dvi> file from which to read font
-information.
-
-
-=head1 EXAMPLES
-
-The following are some examples of how to use B<makethin>.
-
-=head2 A typical case
-
-First, we need to produce F<myfile.dvi>, because that contains the
-font information that B<makethin> will read:
-
- latex myfile.tex
-
-Next, we invoke B<makethin>, telling it to process F<config.cmz>
-(which, in turn, causes F<psfonts.cmz> to be processed), This tells
-B<makethin> to use PostScript versions of the Computer Modern fonts
-instead of bitmapped versions. (B<makethin> can scale only PostScript
-fonts.) We also specify maximal verbosity:
-
- makethin -Pcmz --verbose --verbose myfile.dvi
-
-The preceding line reads F<config.ps>, F<config.cmz>, various map
-files, such as F<psfonts.map> and F<psfonts.cmz>, and all of the
-F<.tfm> and F<.vf> files mentioned in F<myfile.dvi>. It then writes
-F<config.thin>, F<thin.map>, and modified versions of all of the
-F<.tfm> and F<.vf> files to the current directory.
-
-We now need to re-run B<latex>, so it can produce a new F<myfile.dvi>
-using the thinner metrics listed in the current directory's F<.tfm>
-and F<.vf> files:
-
- latex myfile.tex
-
-Finally, we produce a PostScript file using the newly generated using
-F<config.thin> and F<thin.map> files:
-
- dvips -Pthin myfile.dvi -o myfile.ps
-
-If all worked according to plan, F<myfile.ps> should be typeset using
-extremely thin (half-width) versions of its original fonts.
-
-
-=head2 Producing thin fonts for use in pdfLaTeX
-
-Because B<makethin> can read only F<.dvi> files, not F<.pdf> files, we
-first need to produce a F<.dvi> file:
-
- latex too-long.tex
-
-F<too-long.dvi> is typeset entirely using the Times family of fonts.
-Therefore, we don't need to specify B<-Pcmz>. However, B<pdflatex>
-normally embeds Times, thereby precluding B<makethin>'s ability to
-scale it. (B<makethin> requires a F<.pfb> font file in order to scale
-the corresponding font.) Fortunately,
-F</usr/share/texmf/dvips/config/ar-std-urw-kb.map> already contains
-the proper mapping of TeX names to F<.pfb> files for Times, Courier,
-and Helvetica. We can tell B<makethin> to use that file:
-
- makethin --cleanfirst -v -v too-long.dvi --pdftex --xscale=0.9
- --extramaps=/usr/share/texmf/dvips/config/ar-std-urw-kb.map
-
-In the preceding line, we changed the scaling factor from the default
-of 0.5 to a more reasonable 0.9. Because we had some 0.5-scaled
-F<.tfm> and F<.vf> files left over from the previous example, we
-specified B<--cleanfirst> to delete those old font files. We
-specified B<--pdftex> to make B<makethin> produce a local
-F<pdftex.cfg> file. And we told B<makethin> where to find the extra
-map file needed to force the usage of F<.pfb> files.
-
-All that's left is to run B<pdflatex> to produce a F<.pdf> file:
-
- pdflatex too-long.tex
-
-B<pdflatex> will read the font metric files (F<.tfm> and F<.vf>) and
-F<pdftex.cfg> from the current directory. This will tell it to load
-F<thin.map>, which specifies the scaling factor. The result should be
-a document with each character squeezed to 90% of its original width.
-
-
-=head1 FILES
-
-=over 4
-
-=item B<perl>
-
-interpreter/compiler needed to run the B<makethin> script
-
-=item B<kpsewhich>
-
-finds files within the TeX directory tree
-
-=item B<dvitype>
-
-outputs the typesetting commands contained within a F<.dvi> file
-
-=item F<*.tfm> and F<*.vf>
-
-TeX font metrics and virtual fonts--metrics specifying the width of
-each character in a font
-
-=item F<config.*>
-
-Dvips configuration files, each containing (among other
-information) a list of font-map files
-
-=item F<psfonts.*>, F<*.map>
-
-Dvips font-map files, which map TeX font names to PostScript font
-names and F<.pfb> files
-
-=item F<pdftex.cfg>
-
-pdfTeX and pdfLaTeX configuration files, each containing (among other
-information) a list of font-map files
-
-=item B<groff>
-
-used by B<--man-ps> to produce a PostScript version of the Unix manual
-page for B<makethin>
-
-=back
-
-
-=head1 RESTRICTIONS
-
-The most serious restriction is that B<makethin> doesn't work on
-Computer Modern Roman 10pt. (F<cmr10>)--the default TeX/LaTeX font.
-The reason, I believe, is that TeX and LaTeX preload that font's
-metrics (F<cmr10.tfm>) and therefore ignore the scaled F<cmr10.tfm> on
-disk. It may be possible to work around this limitation by copying
-F<cmr10.tfm> to a new name and convincing LaTeX to use that name where
-it would otherwise have used F<cmr10.tfm>. However, it's much easier
-merely to use a different font family (e.g., with
-``C<\usepackage{times}>'') for typesetting your document when you know
-you want to run B<makethin>.
-
-
-=head1 SEE ALSO
-
-dvips(1),
-latex(1),
-pdflatex(1),
-the LaTeX C<savetrees> package
-
-
-=head1 AUTHOR
-
-Scott Pakin, I<scott+st@pakin.org>
diff --git a/Master/texmf-dist/doc/latex/savetrees/savetrees.pdf b/Master/texmf-dist/doc/latex/savetrees/savetrees.pdf
index be134db8f67..afef30d8119 100644
--- a/Master/texmf-dist/doc/latex/savetrees/savetrees.pdf
+++ b/Master/texmf-dist/doc/latex/savetrees/savetrees.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/savetrees/savetrees.dtx b/Master/texmf-dist/source/latex/savetrees/savetrees.dtx
index 303529b830f..86fbbe9984e 100644
--- a/Master/texmf-dist/source/latex/savetrees/savetrees.dtx
+++ b/Master/texmf-dist/source/latex/savetrees/savetrees.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% 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
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{savetrees}
%<*package>
- [2010/06/03 v1.3 Pack as much text as possible onto each page]
+ [2011/05/14 v2.0 Pack as much text as possible onto each page]
%</package>
%
%<*driver>
@@ -30,6 +30,14 @@
\usepackage{array}
\usepackage{dcolumn}
\usepackage{tabularx}
+\usepackage{booktabs}
+\usepackage{topcapt}
+\usepackage{changepage}
+\usepackage{calc}
+\usepackage{varioref}
+\usepackage[format=hang,justification=raggedright]{subfig}
+\usepackage[tracking]{microtype}
+\SetExpansion[context=tightcharwidths,stretch=0,shrink=55]{encoding=*,shape=*}{}
\usepackage{hyperref}
\EnableCrossrefs
\CodelineIndex
@@ -43,7 +51,7 @@
%</driver>
% \fi
%
-% \CheckSum{302}
+% \CheckSum{439}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -67,19 +75,20 @@
% \GetFileInfo{savetrees.dtx}
%
% \DoNotIndex{\.,\@arabic,\@author,\@biblabel,\@clubpenalty,\@date,\@empty}
-% \DoNotIndex{\@enumctr,\@enumdepth,\@gobble,\@itemdepth,\@itemitem}
-% \DoNotIndex{\@latex@warning,\@m,\@mkboth,\@ne,\@noitemerr,\@openbib@code}
-% \DoNotIndex{\@title,\@toodeep,\@undefined,\addtolength,\advance}
-% \DoNotIndex{\baselineskip,\begin,\bibname,\c@enumiv,\chapter,\clubpenalty}
-% \DoNotIndex{\csname,\DeclareOption,\def,\descriptionlabel,\edef,\else,\end}
-% \DoNotIndex{\endcsname,\endlist,\expandafter,\fi,\footnote,\hss,\ifnum,\ifx}
-% \DoNotIndex{\itemindent,\labelwidth,\large,\let,\list,\llap,\MakeUppercase}
-% \DoNotIndex{\newcommand,\newenvironment,\newif,\newlength,\newpage,\null}
-% \DoNotIndex{\p@enumiv,\par,\ProcessOptions,\refname,\relax,\renewcommand}
-% \DoNotIndex{\renewenvironment,\romannumeral,\section,\setcounter}
-% \DoNotIndex{\setlength,\settowidth,\sfcode,\sloppy,\small}
-% \DoNotIndex{\textbf,\thanks,\the,\theenumiv,\thr@@,\usecounter,\vskip}
-% \DoNotIndex{\widowpenalty,\z@}
+% \DoNotIndex{\@enumctr,\@enumdepth,\@gobble,\@ifundefined,\@itemdepth}
+% \DoNotIndex{\@itemitem,\@latex@warning,\@m,\@mkboth,\@ne,\@noitemerr}
+% \DoNotIndex{\@openbib@code,\@tempcnta,\@tempdima,\@title,\@toodeep}
+% \DoNotIndex{\@undefined,\MakeUppercase,\MessageBreak,\addtolength}
+% \DoNotIndex{\advance,\baselineskip,\begin,\bibname,\c@enumiv,\chapter}
+% \DoNotIndex{\clubpenalty,\csname,\def,\descriptionlabel,\divide,\edef}
+% \DoNotIndex{\else,\end,\endcsname,\endlist,\expandafter,\fi,\footnote}
+% \DoNotIndex{\g@addto@macro,\gdef,\hss,\ifnum,\ifx,\itemindent,\labelwidth}
+% \DoNotIndex{\large,\let,\list,\llap,\multiply,\newcommand,\newenvironment}
+% \DoNotIndex{\newif,\newlength,\newpage,\newtoks,\null,\p@enumiv,\par}
+% \DoNotIndex{\refname,\relax,\renewcommand,\renewenvironment,\romannumeral}
+% \DoNotIndex{\section,\setcounter,\setlength,\settowidth,\sfcode,\sloppy}
+% \DoNotIndex{\small,\textbf,\thanks,\the,\theenumiv,\thr@@,\usecounter}
+% \DoNotIndex{\vskip,\widowpenalty,\xdef,\z@}
%
% ^^A ----------------------------------------------------------------------
%
@@ -101,9 +110,138 @@
% \string\texttt{#1}\encapchar usage}^^A
% }
%
+% ^^A Display and index a package option.
+% \newcommand{\pkgoption}[1]{^^A
+% \textsf{#1}^^A
+% \index{#1 (package option)\actualchar^^A
+% \string\textsf{#1} (package option)\encapchar usage}^^A
+% \index{package options:\levelchar#1\actualchar^^A
+% \string\textsf{#1}\encapchar usage}^^A
+% }
+%
+% ^^A Define a macro to index an option declaration that appeared on the
+% ^^A previous code line.
+% \makeatletter
+% \newcommand{\pkgoptiondecl}[1]{^^A
+% \special@index{#1 (package option)\actualchar^^A
+% \string\textsf{#1} (package option)\encapchar main}^^A
+% \special@index{package options:\levelchar#1\actualchar^^A
+% \string\textsf{#1}\encapchar main}^^A
+% }
+% \makeatother
+%
+% ^^A Define macros for computing the average character width of various fonts.
+% \newcommand{\thousandletters}{^^A
+% aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^^A
+% bbbbbbbbb^^A
+% cccccccccccccccccccccccccccccc^^A
+% dddddddddddddddddddddddddddddddddddddddddddd^^A
+% eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee^^A
+% ffffffffffffffffffffffffffff^^A
+% gggggggggggggggg^^A
+% hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh^^A
+% iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii^^A
+% jj^^A
+% kkk^^A
+% lllllllllllllllllllllllllllllllllll^^A
+% mmmmmmmmmmmmmmmmmmmmmmmmm^^A
+% nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn^^A
+% oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo^^A
+% ppppppppppppppppppppppppppp^^A
+% qqq^^A
+% rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr^^A
+% sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss^^A
+% ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt^^A
+% uuuuuuuuuuuuuuuuuuuuuuuuuuu^^A
+% vvvvvvvvvvvvv^^A
+% wwwwwwwwwwwwwwww^^A
+% xxxxx^^A
+% yyyyyyyyyyyyyyyyyyy^^A
+% z^^A
+% }
+% \newlength{\thousandwidth}
+% \makeatletter
+% \newcommand{\fontwidth}[1]{^^A
+% \settowidth{\thousandwidth}{\fontsize{10}{12}\fontfamily{#1}\selectfont\thousandletters}^^A
+% \divide\thousandwidth by 1000\relax
+% \strip@pt\thousandwidth
+% }
+% \makeatother
+%
+% ^^A Include "Table" and "Figure" in the hyperlink itself.
+% \labelformat{table}{Table~#1}
+% \labelformat{figure}{Figure~#1}
+% \labelformat{section}{Section~#1}
+% \labelformat{subsection}{Section~#1}
+%
+% ^^A Define a block of text to use to showcase savetrees's
+% ^^A space-saving techniques.
+% \newcommand*{\lipsumtext}{%
+% Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
+% dapibus tempus dolor ac dignissim. Nam et ante eu velit interdum
+% bibendum. Etiam ligula dolor, varius at rutrum at, porta vit\ae{}
+% lacus. Cras et elit ut lectus aliquet scelerisque ut sed arcu.
+% Morbi eleifend iaculis augue non tristique. Pr\ae{}sent cursus
+% iaculis diam et tristique. Curabitur facilisis, eros in scelerisque
+% mollis, diam ante mollis purus, vel euismod neque velit vit\ae{}
+% augue. In sit amet nulla odio, at ultrices dui. Quisque venenatis
+% velit eget nulla ultrices rutrum. In hac habitasse platea dictumst.
+% \AE{}nean odio turpis, laoreet non vulputate eu, fermentum sed
+% metus.
+% }
+%
+% ^^A Store \lipsumtext in a box so we can both measure and re-use it.
+% \newsavebox{\normalbox}
+% \savebox{\normalbox}{^^A
+% \fbox{^^A
+% \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
+% \lipsumtext
+% \end{minipage}}^^A
+% }
+%
+% ^^A Define a macro that presents "before" and "after" comparisons
+% ^^A of a savetrees space-saving technique.
+% \newcommand{\comparisonfigure}[3]{^^A
+% \begin{figure}[htbp]
+% \subfloat[\texttt{#1=normal}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \usebox{\normalbox}}^^A
+% \hfill
+% \subfloat[\texttt{#1=tight}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \fbox{^^A
+% \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
+% #2\lipsumtext#3^^A
+% \end{minipage}}}^^A
+% \caption{Effect of the \texttt{#1} option}
+% \label{fig:ex-#1}
+% \end{figure}
+% }
+%
+% ^^A Define macros for labeling lines of code.
+% \makeatletter
+% \newcommand{\labelprevcodeline}[1]{^^A
+% \begingroup
+% \edef\@currentlabel{\the\c@CodelineNo}^^A
+% \label{#1}^^A
+% \endgroup
+% }
+% \newcounter{nextCodelineNo}
+% \newcommand{\labelnextcodeline}[1]{^^A
+% \begingroup
+% \setcounter{nextCodelineNo}{\c@CodelineNo}^^A
+% \addtocounter{nextCodelineNo}{1}^^A
+% \edef\@currentlabel{\thenextCodelineNo}^^A
+% \label{#1}^^A
+% \endgroup
+% }
+% \makeatother
+%
+%
% \sloppy
% \maketitle
%
+%
% \section{Introduction}
%
% The goal of the \pkgname{savetrees} package is to pack as much text as
@@ -113,66 +251,253 @@
% copies of a document. It can also be useful when trying to meet a
% tight page-length requirement for a conference or journal submission.
%
-% Table~\ref{tbl:st-techniques} lists the various ways that
-% \pkgname{savetrees} compresses documents. Each of these techniques
-% can be selectively disabled through the use of package options. As
-% may be apparent from the table, only a few techniques are
-% beyond the capabilities of a \LaTeX{} novice. \pkgname{savetrees}'s
-% ``value added'' is the way that it aggregates a variety of
-% space-saving mechanisms into a single package and makes it easy to
-% manage the tradeoff between lower page count and higher readability.
+% To use \pkgname{savetrees}, simply place
%
-% \begin{table}
-% \renewcommand{\arraystretch}{2}
-% \begin{tabularx}{\linewidth}{@{}Xl@{}}
-% \hline
-% Space-saving technique &
-% Implementation \\
-% \hline
-%
-% Typeset section titles smaller and with less surrounding whitespace. &
-% Use the \pkgname{titlesec} package. \\
-%
-% Reduce page margins. &
-% Use the \pkgname{geometry} package. \\
+% \begin{verbatim}
+% \usepackage{savetrees}
+% \end{verbatim}
+% ^^A
+% \unskip\noindent
+% in your document's preamble. This enables all of the space-saving
+% techniques of which \pkgname{savetrees} is capable and should make
+% your document considerably shorter. The longer the document, the
+% greater the space savings can be expected to be. Often, however,
+% \pkgname{savetrees} makes the document unacceptably ugly; or it may
+% violate some imposed formatting restriction (e.g.,~margin width or
+% paragraph indentation); or, even worse, certain space-saving
+% techniques may be incompatible with the document class or another
+% package and produce a \LaTeX\ error. \pkgname{savetrees} therefore
+% provides the ability to selectively enable and disable space-saving
+% techniques via package options. For example,
%
-% Reduce indentation and remove inter-item spacing from the various
-% list environments. &
-% Redefine list environments. \\
+% \begin{verbatim}
+% \usepackage[all=normal,floats=tight,leading=tight,%
+% paragraphs=tight,charwidths=tight,tracking=tight,%
+% wordspacing=tight]{savetrees}
+% \end{verbatim}
+% ^^A
+% \unskip\noindent
+% or, more tersely,
%
-% Relax float placement (more floats per page, increased ability to
-% share pages with text, etc.). &
-% Reassign \LaTeXe{} variables. \\
+% \begin{verbatim}
+% \usepackage[all=normal,floats,leading,paragraphs,%
+% charwidths,tracking,wordspacing]{savetrees}
+% \end{verbatim}
+% ^^A
+% \unskip\noindent
+% first turns off \emph{all} of \pkgname{savetrees}'s space-saving
+% techniques then turns on the \pkgoption{floats}, \pkgoption{leading},
+% \pkgoption{paragraphs}, \pkgoption{charwidths}, \pkgoption{tracking},
+% and \pkgoption{wordspacing} techniques, which are all more-or-less
+% ``safe'' techniques. These are described in the following section.
+%
+%
+% \section{Usage}
+%
+% \vref*{tbl:st-options} describes \pkgname{savetrees}'s main package
+% options and summarizes their implementation. Some package options
+% merely load a package or redefine some variables. Others redefine
+% entire environments to consume less space. A few resort to some
+% underhanded \TeX\ trickery to squeeze as much text as possible onto
+% the page.
+% \makeatletter
+% \@ifundefined{r@sec:savetrees.sty}{^^A
+% See the \pkgname{savetrees} source code
+% }{^^A
+% See the annotated source code listing in \ref{sec:savetrees.sty}
+% }^^A
+% \makeatother
+% for the definitive description of the mechanics underlying the
+% \pkgname{savetrees} package.
%
-% Decrease paragraph indentation. &
-% Reassign \texttt{\string\parindent}. \\
+% \newlength{\implwidth}
+% \settowidth{\implwidth}{Reassign \texttt{\string\baselinestretch}.}
+% \begin{table}
+% \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt}
+% \centering
+% \topcaption{\pkgname{savetrees} package options for enabling/disabling
+% space-saving techniques}
+% \label{tbl:st-options}
+% \renewcommand{\arraystretch}{2}
+% \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}}
+% \toprule
+% Option & Space-saving technique & Implementation \\
+% \midrule
+%
+% \pkgoption{paragraphs}
+% & Discourage \TeX\ from allowing the last line of a paragraph to
+% contain only a single word.
+% & Reassign \texttt{\string\looseness}. \\
+%
+% \pkgoption{floats}
+% & Relax float placement (more floats per page, increased ability to
+% share pages with text, etc.).
+% & Reassign \LaTeXe{} float variables. \\
+%
+% \pkgoption{bibnotes}
+% & Ignore \texttt{NOTE} fields in the bibliography.
+% & Pass information to \texttt{savetrees.bst}. \\
+%
+% \pkgoption{wordspacing}
+% & Reduce the amount of space between words.
+% & Reassign \texttt{\string\fontdimen2}. \\
+%
+% \pkgoption{tracking}
+% & Reduce the amount of space between characters.
+% & Pass options to the \pkgname{microtype} package. \\
+%
+% \pkgoption{charwidths}
+% & Allow character glyphs to be drawn slightly narrower than
+% normal.
+% & Pass options to the \pkgname{microtype} package. \\
+%
+% \pkgoption{leading}
+% & Reduce interline spacing.
+% & Reassign \texttt{\string\baselinestretch}. \\
+%
+% \pkgoption{indent}
+% & Decrease paragraph indentation.
+% & Reassign \texttt{\string\parindent}. \\
+%
+% \pkgoption{lists}
+% & Remove both indentation and inter-item spacing from the various
+% list environments.
+% & Redefine the \texttt{itemize}, \texttt{enumerate}, and
+% \texttt{description} environments. \\
+%
+% \pkgoption{title}
+% & Typeset the document title with smaller fonts and with less
+% surrounding whitespace.
+% & Redefine \texttt{\string\maketitle}. \\
+%
+% \pkgoption{sections}
+% & Typeset section titles smaller and with less surrounding whitespace.
+% & Pass options to the \pkgname{titlesec} package. \\
+%
+% \pkgoption{bibliography}
+% & Typeset the bibliography in a smaller font and with no inter-item
+% spacing.
+% & Redefine \texttt{thebibliography}. \\
+%
+% \pkgoption{margins}
+% & Reduce the page margins.
+% & Pass options to the \pkgname{geometry} package. \\
+%
+% \pkgoption{all}
+% & Perform all of the above.
+% & \\
+%
+% \bottomrule
+% \end{tabularx}
+% \end{adjustwidth}
+% \end{table}
%
-% Typeset document title with smaller fonts and with less surrounding
-% whitespace. &
-% Redefine \texttt{\string\maketitle}. \\
+% Each of the options that appears in \ref{tbl:st-options} can be
+% set to either |tight| or |normal|. |tight|, the default, enables the
+% space-saving technique while |normal| disables it. For example,
+% specifying |\usepackage[title=normal]{savetrees}| instructs
+% \pkgname{savetrees} not to modify the font size and spacing used to
+% typeset the document's title. If only a few space-saving techniques
+% should be enabled, it may be more convenient to specify |all=normal|
+% followed by a list of options set to |tight| than to specify |normal|
+% typesetting for a large number of options. The arguments passed to
+% |\usepackage| are processed left-to-right.
+%
+% The options in \ref{tbl:st-options} are presented in roughly
+% decreasing order of subtlety. If \pkgname{savetrees}'s default
+% options produce too hideous a result, try incrementally setting the
+% options at the bottom of the table (excluding \pkgname{all}) to
+% |normal|, and see if that improves the document's appearance while
+% still saving space over the non-\pkgname{savetrees} version. That is,
+% start by including |margins=normal| in the optional argument to
+% |\usepackage|. Then add |bibliography=normal|, then
+% |sections=normal|, and so forth, rebuilding the document and examining
+% the result each time. Alternatively, if you need to save just a small
+% amount of space (e.g.,~if your document is just barely over a maximum
+% page length), specify |all=normal| then incrementally add options from
+% the top of the table downwards: |paragraphs=tight|, then
+% |floats=tight|, then |bibnotes=tight|, and so forth.
+% \ref{sec:gallery} presents examples of some of \pkgname{savetrees}'s
+% space-saving features so you can decide for yourself which are worth
+% the price paid in typesetting elegance.
+%
+% Saving space in a document is always a balancing act between document
+% aesthetics and the amount of space that can be saved. If you find
+% that a particular space-saving option makes the document formatting
+% just a little too ugly---or if you're willing to make it even uglier
+% to save even more space---\pkgname{savetrees} provides additional
+% package options that let you adjust the aggressiveness of various
+% space-saving techniques. \vref{tbl:st-refinements} lists and
+% describes these package options. As an example, \LaTeX's normal line
+% height is defined to have a value of~1.0. When \pkgname{savetrees} is
+% loaded with |leading=tight| (the default), \ref{tbl:st-refinements}
+% indicates that the line height is reduced to 90\% of that.
+% Additionally including |leadingfraction=0.95| on the |\usepackage| line
+% increases the line height to 95\% of \LaTeX's default---still a space
+% reduction but possibly a somewhat less overt one.
%
-% Reduce interline spacing. &
-% Reassign \texttt{\string\baselinestretch}. \\
+% \begin{table}
+% \topcaption{\pkgname{savetrees} package options for refining the way
+% space is saved}
+% \label{tbl:st-refinements}
+% \renewcommand{\arraystretch}{2}
+% \begin{tabularx}{\linewidth}{@{}l>{\raggedright}Xlr@{}}
+% \toprule
+% Option & Description & \multicolumn{1}{l}{Requires \texttt{tight}} & Default \\
+% \midrule
+%
+% \pkgoption{charwidthfraction}
+% & Fraction of normal character widths
+% & \pkgoption{charwidths}
+% & 0.95 \\
+%
+% \pkgoption{leadingfraction}
+% & Fraction of normal line height
+% & \pkgoption{leading}
+% & 0.9 \\
+%
+% \pkgoption{marginwidth}
+% & Width of the page margins
+% & \pkgoption{margins}
+% & 1.5cm \\
+%
+% \pkgoption{parindent}
+% & Paragraph indentation
+% & \pkgoption{indent}
+% & 1em \\
+%
+% \pkgoption{trackingfraction}
+% & Fraction of normal inter-character spacing
+% & \pkgoption{tracking}
+% & 0.975 \\
+%
+% \pkgoption{wordspacingfraction}
+% & Fraction of normal inter-word spacing
+% & \pkgoption{wordspacing}
+% & 0.8 \\
+%
+% \bottomrule
+% \end{tabularx}
+% \end{table}
%
-% Discourage \TeX\ from allowing the last line of a paragraph to
-% contain only a single word. &
-% Reassign \texttt{\string\looseness}. \\
+% There are a few restrictions on the space-saving techniques that can
+% be applied. The \pkgname{tracking} option requires pdf\LaTeX\@. The
+% \pkgoption{charwidths} option requires either pdf\LaTeX\ or
+% lua\LaTeX\@. For both options, pdf\LaTeX\ must be in PDF mode, not
+% DVI mode. See the \pkgname{microtype} documentation for additional
+% (and possibly more up-to-date) information.
%
-% Allow characters to be typeset slightly narrower than normal. &
-% Use the \pkgname{microtype} package. \\
%
-% Typeset bibliographies smaller and with no inter-item spacing. &
-% Redefine \texttt{thebibliography}. \\
-% \hline
-% \end{tabularx}
-% \caption{\pkgname{savetrees}'s space-saving techniques}
-% \label{tbl:st-techniques}
-% \end{table}
+% \section{Abbreviating bibliographic information}
%
-% In addition to providing a \LaTeXe{} style file, the
-% \pkgname{savetrees} package also provides a \BibTeX{} style file.
-% |savetrees.bst| exhibits the following salient differences from
-% |plain.bst|:
+% One of the advantages of a tool like \BibTeX{} is that the
+% bibliographic database can---and should---contain complete
+% bibliographic information for each reference while style files
+% determine the subset of that information that is actually typeset.
+% Hence, to help further reduce a document's length, the
+% \pkgname{savetrees} package additionally provides a \BibTeX{} style
+% file, |savetrees.bst|, which exhibits the following salient
+% differences from |plain.bst|:
%
% \begin{itemize}
% \item Abbreviations are used wherever possible:
@@ -197,87 +522,14 @@
%
% \noindent
% In addition, |savetrees.bst| does not normally typeset |NOTE| fields,
-% although it can be instructed to via a \pkgname{savetrees} package
-% option.
-%
-% Finally, the \pkgname{savetrees} package includes a
-% Perl\index{Perl|usage} script called ``|makethin|'', which
-% automatically generates narrower versions of \TeX{} fonts plus
-% configuration files for Dvips and pdf\LaTeX.
-%
-% \section{\texttt{savetrees.sty}---reduce document whitespace}
-%
-% To use |savetrees.sty|, merely load it into a document by putting
-% ``|\usepackage{savetrees}|'' in the document's preamble. By default,
-% all of \pkgname{savetrees}'s space-saving techniques are enabled.
-% However, package options can disable any features that violate given
-% formatting requirements, that conflict with other \LaTeXe{} packages,
-% or that you simply consider excessively ugly. \pkgname{savetrees}
-% supports the following options:
-%
-% ^^A Display and index a package option.
-% \newcommand{\pkgoption}[1]{^^A
-% \textsf{#1}^^A
-% \index{#1 (package option)\actualchar^^A
-% \string\textsf{#1} (package option)\encapchar usage}^^A
-% \index{package options:\levelchar#1\actualchar^^A
-% \string\textsf{#1}\encapchar usage}^^A
-% }
-%
-% \begin{description}
-% \item[\pkgoption{normalsections}] Don't modify section headers.
-%
-% \item[\pkgoption{normalmargins}] Don't modify page margins.
-%
-% \item[\pkgoption{normallists}] Don't modify the |itemize|,
-% |enumerate|, or |description| environments.
-%
-% \item[\pkgoption{normalfloats}] Don't modify \LaTeXe's float
-% parameters.
-%
-% \item[\pkgoption{normalindent}] Don't modify paragraph indentation.
+% although it can be instructed to do so by passing \pkgname{savetrees}
+% the |bibnotes=normal| package option.
%
-% \item[\pkgoption{normaltitle}] Don't modify the formatting of the
-% document title.
-%
-% \item[\pkgoption{normalleading}] Don't modify interline spacing.
-%
-% \item[\pkgoption{normallooseness}] Don't modify paragraph looseness.
-%
-% \item[\pkgoption{normalcharwidths}] Don't modify character widths.
-%
-% \item[\pkgoption{normalbib}] Don't modify bibliography formatting.
-%
-% \item[\pkgoption{normalbibnotes}] Don't omit |NOTE| fields from the
-% bibliography (only meaningful with the \pkgname{savetrees}
-% bibliography style).
-% \end{description}
-%
-% For example, to keep page margins and interline spacing as they are
-% but save space everyplace else, you should put the following
-% |\usepackage| line in your document's preamble:
-%
-% \begin{verbatim}
-% \usepackage[normalmargins,normalleading]{savetrees}
-% \end{verbatim}
-%
-%
-% \section{\texttt{savetrees.bst}---abbreviate bibliographic information}
-%
-% One of the advantages of a tool like \BibTeX{} is that the
-% bibliographic database can---and should---contain complete
-% bibliographic information for each reference, while style files
-% determine the subset of that information that is actually typeset.
-% |savetrees.bst| saves space by truncating |AUTHOR| fields to two
-% authors plus ``et al.'', listing authors by initials and surname only,
-% abbreviating the |MONTH| field to three letters, and (by default)
-% omitting the |NOTE| field altogether.
-%
-% To use the |savetrees.bst|, simply add
-% ``|\bibliographystyle{savetrees}|'' to your document (or replace an
-% existing |\bibliographystyle|). Then, to give |savetrees.bst|---or
-% \emph{any} \BibTeX{} style file---maximum flexibility, you should obey
-% the following rules when writing your |.bib| file:
+% To use |savetrees.bst|, simply replace your document's existing
+% |\bibliographystyle| line with ``|\bibliographystyle{savetrees}|''.
+% Then, to give |savetrees.bst|---or \emph{any} \BibTeX{} style
+% file---maximum flexibility, you should obey the following rules when
+% writing your |.bib| file:
%
% \begin{enumerate}
% \item Use the three-letter month macros defined by virtually all
@@ -285,36 +537,36 @@
% explicitly:
%
% \begin{tabularx}{\linewidth}{@{}lX@{}}
-% \hline
+% \toprule
% Good: & \texttt{MONTH = sep,} \\
% & Can be typeset as ``September'', ``Sept.'', ``SEP'',
% ``Septiembre'', etc. \\
%
% Bad: & \texttt{MONTH = \{September\},} \\
% & Can be typeset only as ``September''. \\
-% \hline
+% \bottomrule
% \end{tabularx}
%
% \item Include authors' full names (or as much of each name as is
% available); let \BibTeX{} abbreviate as necessary:
%
% \begin{tabularx}{\linewidth}{@{}lX@{}}
-% \hline
-% Better: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla\}}, \\
-% & Can be either typeset in full or abbreviated to
-% ``Rufus~X. Sarsaparilla'', ``R.~X. Sarsaparilla'', etc. \\
-%
-% Worse: & \texttt{AUTHOR = \{R.~X. Sarsaparilla\}}, \\
-% & Can be typeset as ``R.~X. Sarsaparilla''---or even a more
-% abbreviated form---but can't be expanded to the full name. \\
-% \hline
+% \toprule
+% Good: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla\}}, \\
+% & Can be typeset either in full or abbreviated to
+% ``Rufus~X. Sarsaparilla'', ``R.~X. Sarsaparilla'', etc. \\
+%
+% Bad: & \texttt{AUTHOR = \{R.~X. Sarsaparilla\}}, \\
+% & Can be typeset only as ``R.~X. Sarsaparilla'' and can't
+% be expanded to the full name. \\
+% \bottomrule
% \end{tabularx}
%
% \item Include the names of \emph{all} authors; let \BibTeX{} decide
% where to truncate the list:
%
% \begin{tabularx}{\linewidth}{@{}lX@{}}
-% \hline
+% \toprule
%
% Good: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla and
% Rafaella Gabriela Sarsaparilla and Albert Andreas
@@ -323,94 +575,47 @@
% point with ``et al.'', ``and others'', or whatever. \\
%
% Bad: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla and others\},} \\
-% & At most one author can be named, but ``and others'' can still
-% be replaced by ``et al.''\ or a different phrase, the font
-% can be varied, and the author's name can be abbreviated, as in
-% the previous rule. \\
+% & At most one author can be named, but ``and others'' can
+% still be replaced by ``et al.''\ or a different phrase,
+% and the author's name can still be abbreviated, as
+% discussed in the previous rule. \\
% Worse: & \texttt{AUTHOR = \{\{Rufus Xavier Sarsaparilla, et al.\}\},} \\
% & Can be typeset only precisely as ``Rufus Xavier
% Sarsaparilla, et al.'' \\
-% \hline
+% \bottomrule
% \end{tabularx}
% \end{enumerate}
%
% The \pkgname{savetrees} \BibTeX{} style utilizes the same fields as
% the standard \BibTeX{} styles (|plain|, |alpha|, |abbrv|, |unsrt|,
-% etc.), with the exception that the |NOTE| field is normally
-% suppressed. To include |NOTE| fields in your Bibliography/References
-% sections, pass the \pkgoption{normalbibnotes} option to the
-% \pkgname{savetrees} \LaTeX{} style file.
-%
-% |savetrees.bst| can't normally be used independently of
-% |savetrees.sty|, because the former typesets |NOTE| fields within a
-% |\savetreesbibnote{|\dots|}| call, which is defined by the latter.
-% If you desperately want to use |savetrees.bst| without having to load
-% |savetrees.sty|, then you should examine the definition of the
-% |\savetreesbibnote| macro
-% \makeatletter
-% \@ifundefined{r@code:stbn-begin}{^^A
-% in \texttt{savetrees.sty}.
-% }{^^A
-% on page~\pageref{code:stbn-begin} of this document^^A
-% \ifcodeline@index
-% ~(code lines~\ref{code:stbn-begin}--\ref{code:stbn-end})^^A
-% \fi.
-% }
-% \makeatother
+% etc.), with the exception that the |NOTE| field is suppressed unless
+% the |bibnotes=normal| package option is provided.
+%
+% As of version~2.0 of \pkgname{savetrees}, |savetrees.bib| can be used
+% independently of |savetrees.sty|.
%
%
-% \section{\texttt{makethin}---make thinner versions of \TeX{} fonts}
+% \changes{v2.0}{2011/05/03}{Removed the awkward-to-use
+% \progname{makethin} script now that the \pkgname{microtype} package
+% can shrink character widths more automatically}
+%
+% \StopEventually{^^A
+% \labelformat{section}{Appendix~##1}
+% \appendix
+% \section{Average character widths of common fonts}
%
% \paragraph{Question:}
% What's the narrowest font?
%
% \paragraph{Answer:}
-% It depends upon how you measure. Table~\ref{tbl:font-widths}
-% shows, for various fonts, the width in points of 1000 lowercase
-% letters with relative frequencies chosen to match ``typical''
-% English text. There are 130~e's, 93~t's, 78~n's, 77~r's, and so forth
-% down the frequency distribution. According to the table, Times Roman
-% is statistically likely to be the best typeface for maximizing the
-% amount of text on the page. However, Times Roman may not be the
-% narrowest for \emph{your} document; you'll have to experiment and see.
-%
-% \newcommand{\thousandletters}{^^A
-% aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^^A
-% bbbbbbbbb^^A
-% cccccccccccccccccccccccccccccc^^A
-% dddddddddddddddddddddddddddddddddddddddddddd^^A
-% eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee^^A
-% ffffffffffffffffffffffffffff^^A
-% gggggggggggggggg^^A
-% hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh^^A
-% iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii^^A
-% jj^^A
-% kkk^^A
-% lllllllllllllllllllllllllllllllllll^^A
-% mmmmmmmmmmmmmmmmmmmmmmmmm^^A
-% nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn^^A
-% oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo^^A
-% ppppppppppppppppppppppppppp^^A
-% qqq^^A
-% rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr^^A
-% sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss^^A
-% ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt^^A
-% uuuuuuuuuuuuuuuuuuuuuuuuuuu^^A
-% vvvvvvvvvvvvv^^A
-% wwwwwwwwwwwwwwww^^A
-% xxxxx^^A
-% yyyyyyyyyyyyyyyyyyy^^A
-% z^^A
-% }
-%
-% \newlength{\thousandwidth}
-% \makeatletter
-% \newcommand{\fontwidth}[1]{^^A
-% \settowidth{\thousandwidth}{\fontfamily{#1}\selectfont\thousandletters}^^A
-% \divide\thousandwidth by 1000\relax
-% \strip@pt\thousandwidth
-% }
-% \makeatother
+% It depends upon how you measure. \ref{tbl:font-widths} shows,
+% for various 10\,pt.\ fonts, the width in points of 1000 lowercase
+% letters with relative frequencies chosen to match ``typical'' English
+% text. There are 130~e's, 93~t's, 78~n's, 77~r's, and so forth down
+% the frequency distribution. According to the table, Times is
+% statistically likely to be the best typeface for maximizing the amount
+% of text on the page. However, Times may not be the narrowest for
+% \emph{your} document; you'll have to experiment and see.
%
% \begin{table}[htbp]
% \centering
@@ -421,14 +626,14 @@
% \multicolumn{1}{l@{}}{Avg. width (pt.)} \\
% \hline
%
-% Times Roman & times & \fontwidth{ptm} \\
+% Times & mathptmx & \fontwidth{ptm} \\
% Computer Modern & \multicolumn{1}{l}{(default)} & \fontwidth{cmr} \\
% Charter & charter & \fontwidth{bch} \\
-% Helvetica & helvetic & \fontwidth{phv} \\
-% Palatino & palatino & \fontwidth{ppl} \\
+% Helvetica & helvet & \fontwidth{phv} \\
+% Palatino & mathpazo & \fontwidth{ppl} \\
% Utopia & utopia & \fontwidth{put} \\
% New Century Schoolbook & newcent & \fontwidth{pnc} \\
-% Avant Garde & avantgar & \fontwidth{pag} \\
+% Avant Garde & avant & \fontwidth{pag} \\
% Bookman & bookman & \fontwidth{pbk} \\
% Courier & courier & \fontwidth{pcr} \\
% \hline
@@ -437,688 +642,664 @@
% \label{tbl:font-widths}
% \end{table}
%
-% We can do better than merely \emph{selecting} a narrow font, though.
-% We can \emph{generate} a narrower version of an existing font. The
-% idea is to present \TeX{} with font metrics that indicate thinner
-% characters and to tell Dvips or pdf\TeX\ to use the PostScript
-% ``\texttt{ExtendFont}'' operator to compress all of the glyphs. The
-% \pkgname{savetrees} package comes with a Perl\index{Perl|usage} script,
-% \progname{makethin}, which automates the task of generating narrow
-% font variants. From a typography viewpoint, the results are
-% deplorable, as the glyphs are simply squeezed rather than
-% optically scaled to a new width. But from the perspective of trying
-% to pack more text onto a page with minimal effort, \progname{makethin}
-% can be quite efficacious.
-%
-% \DeleteShortVerb{\|}
-% \begin{center}
-% \begin{tabular}{|p{0.66\linewidth}|}
-% \multicolumn{1}{c}{\textbf{Warning}} \\
-% \hline
-% To avoid confusion with the original font-metric files, do not
-% distribute the \texttt{.tfm} or \texttt{.vf} files generated by
-% \progname{makethin} unless you rename them first. \\
-% \hline
-% \end{tabular}
-% \end{center}
-% \MakeShortVerb{\|}
-%
-% In addition to requiring Perl\index{Perl|usage}, \progname{makethin}
-% depends upon two helper programs: \progname{kpsewhich} and
-% \progname{dvitype}. \progname{kpsewhich} searches the \TeX{}
-% installation directory for a given file or file type. While
-% \progname{kpsewhich} is a standard part of Kpathsea-based \TeX{}
-% distributions, such as \TeX\ Live, it does not normally function on
-% non-Kpathsea based distributions. \progname{dvitype} outputs a DVI
-% file in a textual format that's easy for \progname{makethin} to
-% process. \progname{makethin} extracts font names from lines like the
-% following:
-%
-% \begin{verbatim}
-% Font 44: cmtt10---loaded at size 655360 DVI units
-% Font 43: cmtt12 scaled 1200---loaded at size 943718 DVI units
-% Font 33: cmss10---loaded at size 655360 DVI units
-% \end{verbatim}
-%
-% Even with \progname{makethin}, creating narrow fonts is somewhat
-% awkward as it requires the installation of various font files and font
-% maps. Fortunately, with newer versions of \pkgname{savetrees}, there
-% is far less need to bother with \progname{makethin}.
-% \pkgname{savetrees}~v1.3 and later use the \pkgname{microtype} package
-% to exploit pdf\TeX's font-expansion features to implicitly generate
-% narrower versions of fonts. The advantage is that this approach is
-% fully automatic; there's no need to install additional font files or
-% font maps. The disadvantages are that (1)~it works only with
-% pdf\TeX\ and (2)~it doesn't compress fonts uniformly but rather allows
-% some variation from line to line based on how overfull or underfull
-% the line would otherwise be. In short, \progname{makethin} should be
-% seen as a last resort, when a significant amount of extra space must
-% be elided from the document.
-%
-% The \progname{makethin} script contains documentation in POD\index{POD
-% (Plain Old Documentation)|usage} (Plain Old Documentation) format.
-% This can be extracted using \progname{makethin}'s |--man| or
-% |--man-ps| options, as described below, or any of
-% Perl's\index{Perl|usage} ``\texttt{pod2}\meta{something}'' converters,
-% such as \progname{pod2text} or \progname{pod2html}. Beginning on the
-% following page is the \progname{makethin} documentation, as extracted
-% by \progname{pod2latex} (with some minor formatting modifications).
-%
-% ^^A Adjust some lengths to be more amenable to formatting man pages.
-% \clearpage
-% \let\origparindent=\parindent
-% \setlength{\parindent}{0pt}
-% \let\origparskip=\parskip
-% \setlength{\parskip}{0.5\baselineskip}
-%
-% ^^A Define commands to index short and long makethin options.
-% \newcommand{\thinoptidxS}[1]{^^A
-% \index{#1\actualchar\texttt{-{}#1} (\texttt{makethin} option)\encapchar usage}^^A
-% \index{makethin options\actualchar\texttt{makethin} options:\levelchar
-% #1\actualchar\texttt{-{}#1}\encapchar usage}}
-% \newcommand{\thinoptidxL}[1]{^^A
-% \index{#1\actualchar\texttt{-{}-{}#1} (\texttt{makethin} option)\encapchar usage}^^A
-% \index{makethin options\actualchar\texttt{makethin} options:\levelchar
-% #1\actualchar\texttt{-{}-{}#1}\encapchar usage}}
-% \newcommand{\thinoptidx}[2]{\thinoptidxS{#1}\thinoptidxL{#2}}
-%
-% ^^A Define commands for displaying and indexing file names.
-% \newcommand{\thinextidx}[1]{^^A
-% \textit{.#1}\index{#1 files=\string\texttt{.#1} files\encapchar usage}}
-% \newcommand{\thinfileidx}[1]{^^A
-% \textit{#1}\index{#1=\string\texttt{#1}\encapchar usage}}
-%
-% ^^A Define a command for displaying and indexing program names.
-% \newcommand{\thinprogidx}[1]{^^A
-% \textbf{#1}^^A
-% \index{#1 (program)\actualchar\string\texttt{#1} (program)\encapchar usage}^^A
-% \index{programs:\levelchar#1\actualchar^^A
-% \string\texttt{#1}\encapchar usage}^^A
+% Although \pkgname{savetrees} does not automatically change the
+% document font it does specify that character glyphs may be typeset
+% narrower than normal (cf.~the \pkgoption{charwidth} option). Note,
+% however, that \pkgname{savetrees} unfortunately has no control over
+% precisely which lines of text are typeset with narrow characters.
+% This narrowing technique works only with pdf\LaTeX, so that program
+% should be used if possible to maximize the space-saving achievable
+% with \pkgname{savetrees}.
+%
+%
+% \section{Gallery of space-saving techniques}
+% \label{sec:gallery}
+%
+% \ref{fig:ex-lists} through \ref{fig:ex-leading}
+% \vpagerefrange{fig:ex-lists}{fig:ex-leading} provide examples of some
+% of the ways that \pkgname{savetrees} saves space when typesetting
+% text. Each figure showcases a single space-saving technique in
+% isolation. The default pararameters are used for each technique.
+% \vref{tbl:st-refinements} documents the package options that can be
+% used to refine these parameters either to save more space or to make
+% the typesetting less offensive.
+%
+% \ref{fig:ex-lists} shows how setting |lists=tight| saves space by
+% reducing the whitespace above, below, and within list environments (in
+% this case, the |itemize| environment). \ref{fig:ex-wordspacing} shows
+% how setting |wordspacing=tight| saves space by typesetting words
+% closer together. \ref{fig:ex-tracking} shows how setting
+% |tracking=tight| saves space by typesetting the characters within a
+% word closer together. \ref{fig:ex-charwidths} shows how setting
+% |charwidths=tight| saves space by narrowing the individual character
+% glyphs without affecting the font's point size (height) or amount of
+% whitespace. Finally, \ref{fig:ex-leading} shows how setting
+% |leading=tight| saves space by removing whitespace between adjacent
+% lines of text. Again, these techniques are shown with their default
+% parameters, which can be adjusted if desired.
+%
+% While \ref{fig:ex-lists} through \ref{fig:ex-leading} each illustrate
+% a single space-saving technique, \vref{fig:ex-multiple} demonstrates
+% that when multiple techniques are used in combination, the benefits
+% are essentially additive.
+%
+% \begin{figure}[htbp]
+% \savebox{\normalbox}{^^A
+% \fbox{^^A
+% \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
+% Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+% \begin{itemize}
+% \item curabitur
+% \item tellus
+% \item nulla
+% \end{itemize}
+% Quisque feugiat lacinia mauris ut tincidunt.
+% \end{minipage}}}^^A
+% \subfloat[\texttt{lists=normal}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \usebox{\normalbox}}^^A
+% \hfill
+% \subfloat[\texttt{lists=tight}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \fbox{^^A
+% \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
+% Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+% \begin{list}{\labelitemi}{^^A
+% \def\makelabel##1{\hss\llap{##1}}
+% \settowidth{\leftmargin}{\labelitemi}^^A
+% \addtolength{\leftmargin}{\labelsep}^^A
+% \setlength{\topsep}{4pt plus 1pt minus 2pt}^^A
+% \setlength{\itemsep}{0pt}^^A
+% \setlength{\parsep}{0pt}^^A
+% \setlength{\listparindent}{1em}^^A
+% }^^A
+% \item curabitur
+% \item tellus
+% \item nulla
+% \end{list}
+% Quisque feugiat lacinia mauris ut tincidunt.
+% \end{minipage}}}^^A
+% \caption{Effect of the \texttt{lists} option}
+% \label{fig:ex-lists}
+% \end{figure}
+%
+% \newlength{\origwordspacing}
+% \setlength{\origwordspacing}{\fontdimen2\font}
+% \comparisonfigure{wordspacing}{^^A
+% \fontdimen2\font=0.75\origwordspacing
+% }{^^A
+% \fontdimen2\font=\origwordspacing
% }
%
-% \subsection*{NAME}
-% makethin---make thinner versions of PostScript fonts for \TeX{}
-%
-% \subsection*{SYNOPSIS}
-% makethin
-% \thinoptidx{v}{verbose}^^A
-% \thinoptidx{h}{help}^^A
-% \thinoptidx{x}{xscale}^^A
-% \thinoptidx{C}{cleanfirst}^^A
-% \thinoptidx{c}{clean}^^A
-% \thinoptidx{P}{config}^^A
-% \thinoptidx{p}{pdftex}^^A
-% \thinoptidx{m}{extramaps}^^A
-% \thinoptidx{k}{skipfonts}^^A
-% \thinoptidx{b}{basename}^^A
-% \thinoptidx{e}{extrafonts}^^A
-% \thinoptidxL{man}^^A
-% \thinoptidxL{man-ps}^^A
-% {\tt [}{\bf {\tt --}verbose}{\tt ]}
-% {\tt [}{\bf {\tt --}xscale}={\em factor\/}{\tt ]}
-% {\tt [}{\bf {\tt --}cleanfirst}{\tt ]}
-% {\tt [}{\bf {\tt --}clean}{\tt ]}
-% {\tt [}{\bf {\tt --}config}={\em extension\/}{\tt ]}
-% {\tt [}{\bf {\tt --}pdftex}{\tt ]}
-% {\tt [}{\bf {\tt --}extramaps}={\em file\/}{\tt [},{\em file\/}{\tt ]}...{\tt ]}
-% {\tt [}{\bf {\tt --}skipfonts}={\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}
-% {\tt [}{\bf {\tt --}basename}={\em string\/}{\tt ]}
-% {\tt [}{\bf {\tt --}extrafonts}={\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}
-% \thinextidx{dvi}{\em file\/}
-%
-% makethin
-% {\tt [}{\bf {\tt --}verbose}{\tt ]}
-% {\bf {\tt --}help}
-%
-% makethin
-% {\bf {\tt --}man}={\em man page\/} \verb+|+ {\bf {\tt --}man-ps}={\em PostScript file\/}
-%
-% \subsection*{DESCRIPTION}
-% \thinprogidx{makethin} produces thinner versions of PostScript fonts for use
-% with \TeX{}/\LaTeX{} and Dvips. More precisely, it finds all of
-% the \thinextidx{tfm} and \thinextidx{vf} fonts referred to by a
-% \thinextidx{dvi} file, scales the character-width metrics by a given
-% amount, and writes new \thinextidx{tfm} and \thinextidx{vf} files to
-% the current directory. \thinprogidx{makethin} then generates a customized
-% \thinextidx{map} and {\em config\/}^^A
-% \index{config files=\texttt{config} files|usage}
-% file for Dvips and, optionally, a customized
-% \thinfileidx{pdftex.cfg} file for pdf\LaTeX{}.
-%
-% The general procedure for using \thinprogidx{makethin} is as follows:
-%
-% \begin{enumerate}
+% \comparisonfigure{tracking}{^^A
+% \SetTracking{encoding=*,shape=*}{-25}^^A
+% \lsstyle
+% }{}
%
-% \item
-% Run \thinprogidx{latex} on your \thinextidx{tex} source file to produce a
-% \thinextidx{dvi} file.
-%
-% \item
-% Run \thinprogidx{makethin} on the \thinextidx{dvi} file to create new
-% \thinextidx{tfm}, \thinextidx{vf}, \thinextidx{map}, and
-% {\em config\/}\index{config files=\texttt{config} files|usage} files.
-%
-% \item
-% Re-run \thinprogidx{latex} on your \thinextidx{tex} source file to typeset it
-% with the new fonts.
+% \comparisonfigure{charwidths}{^^A
+% \begin{microtypecontext}{expansion=tightcharwidths}^^A
+% }{^^A
+% \end{microtypecontext}^^A
+% }
%
-% \item
-% Run \thinprogidx{dvips} on the \thinextidx{dvi} file, specifying the newly
-% generated \thinextidx{map} and
-% {\em config\/}\index{config files=\texttt{config} files|usage} files,
-% to produce a \thinextidx{ps} file.
+% \comparisonfigure{leading}{\fontsize{10}{10.8}\selectfont}{}
+%
+% \begin{figure}[htbp]
+% \subfloat[\texttt{all=normal}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \usebox{\normalbox}}^^A
+% \hfill
+% \subfloat[\texttt{wordspacing=tight, tracking=tight,
+% charwidths=tight, leading=tight}]{^^A
+% \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
+% \fbox{^^A
+% \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
+% \fontdimen2\font=0.75\origwordspacing
+% \fontsize{10}{10.8}\selectfont
+% \begin{microtypecontext}{expansion=tightcharwidths}^^A
+% \lsstyle
+% \lipsumtext
+% \end{microtypecontext}^^A
+% \fontdimen2\font=\origwordspacing
+% \end{minipage}}}^^A
+% \caption{Combined effect of using multiple options}
+% \label{fig:ex-multiple}
+% \end{figure}
%
-% \end{enumerate}
-%
-% \subsection*{OPTIONS}^^A
-%
-% The following are the command-line options that \thinprogidx{makethin} accepts:
-%
-% \begin{description}
-%
-% \item[{\bf -v}, {\bf {\tt --}verbose}]^^A
-% \thinoptidx{v}{verbose}^^A
-% \hfil\\
-% Increase the verbosity of the status output. {\bf {\tt --}verbose} can be
-% specified multiple times on the same command line, with each
-% {\bf {\tt --}verbose} futher increasing the verbosity. (Currently, two
-% {\bf {\tt --}verbose}s have maximal impact.)
-%
-% \item[{\bf -h}, {\bf {\tt --}help}]^^A
-% \thinoptidx{h}{help}^^A
-% \hfil\\
-% Display basic usage information. When combined with {\bf {\tt --}verbose},
-% additionally describes each of the command-line options. When
-% combined with a second {\bf {\tt --}verbose}, {\bf {\tt --}help} outputs the complete
-% \thinprogidx{makethin} manual page.
-%
-% \item[{\bf -x} {\em factor\/}, {\bf {\tt --}xscale}={\em factor\/}]^^A
-% \thinoptidx{x}{xscale}^^A
-% \hfil\\
-% Scale fonts horizontally by a factor of {\em factor\/}. The default,
-% {\tt 0.5}, produces nearly illegible fonts but is useful for verifying
-% that \thinprogidx{makethin} actually worked. Factors of {\tt 0.90}--{\tt 0.99}
-% are more reasonable.
-%
-% \item[{\bf -C}, {\bf {\tt --}cleanfirst}]^^A
-% \thinoptidx{C}{cleanfirst}^^A
-% \hfil\\
-% Delete all files generated by a previous run of \thinprogidx{makethin} before
-% generating new ones.
-%
-% \item[{\bf -c}, {\bf {\tt --}clean}]^^A
-% \thinoptidx{c}{clean}^^A
-% \hfil\\
-% Delete all files generated by a previous run of \thinprogidx{makethin} and then
-% exit.
-%
-% \item[{\bf -P} {\em extension\/}, {\bf {\tt --}config}={\em extension\/}]^^A
-% \thinoptidx{P}{config}^^A
-% \hfil\\
-% Process all of the \thinextidx{map} files named in
-% {\em config.\/}{\em extension\/}^^A
-% \index{config files=\texttt{config} files|usage}
-% (found in Dvips's configuration directory). {\bf {\tt --}config}
-% can be specified multiple times on the same command line.
-% \thinfileidx{config.ps} is processed implicitly. The same {\bf -P}
-% arguments that you would normally pass to \thinprogidx{dvips} to utilize
-% entirely PostScript fonts (e.g., {\bf -Pcmz} and {\bf -Pamz}) should
-% also be passed to \thinprogidx{makethin}.
-%
-% \item[{\bf -p}, {\bf {\tt --}pdftex}]^^A
-% \thinoptidx{p}{pdftex}^^A
-% \hfil\\
-% In addition to producing the files needed by Dvips, also produce a
-% \thinfileidx{pdftex.cfg} file that is usable by pdf\LaTeX{}.
-%
-% \item[{\bf -m} {\em file\/}{\tt [},{\em file\/}{\tt ]}...{\tt ]}, {\bf {\tt --}extramaps}={\em file\/}{\tt [},{\em file\/}{\tt ]}...{\tt ]}]^^A
-% \thinoptidx{m}{extramaps}^^A
-% \hfil\\
-% Additionally process the named Dvips \thinextidx{map} files even if they're
-% not referred to by any of the {\em config.\/}{\em extension\/} files^^A
-% \index{config files=\texttt{config} files|usage}
-% specified with {\bf {\tt --}config}. {\bf {\tt --}extramaps} can be
-% specified multiple times on the same command line.
-%
-% \item[{\bf -k} {\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}, {\bf {\tt --}skipfonts}={\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}]^^A
-% \thinoptidx{k}{skipfonts}^^A
-% \hfil\\
-% Don't make thin versions of the named fonts, even if they're listed in
-% the \thinextidx{dvi} file. Fonts are named using the Berry scheme (i.e.,
-% ``{\tt pcrr8a}'' as opposed to ``{\tt COURB}'' or ``{\tt Courier-Bold}'').
-% {\bf {\tt --}skipfonts} can be specified multiple times on the same command
-% line.
-%
-% \item[{\bf -b} {\em string\/}, {\bf {\tt --}basename}={\em string\/}]^^A
-% \thinoptidx{b}{basename}^^A
-% \hfil\\
-% Tell \thinprogidx{makethin} to use {\em string\/} as the base name for the Dvips
-% configuration files it generates. The default is ``{\tt thin}'', so
-% \thinprogidx{makethin} normally produces files named \thinfileidx{config.thin} and
-% \thinfileidx{thin.map}, but {\bf {\tt --}basename} enables alternate
-% filenames to be used.
-%
-% \item[{\bf -e} {\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}, {\bf {\tt --}extrafonts}={\em font\/}{\tt [},{\em font\/}{\tt ]}...{\tt ]}]^^A
-% \thinoptidx{e}{extrafonts}^^A
-% \hfil\\
-% Make thin versions of the named fonts, even if they're not listed in
-% the \thinextidx{dvi} file. Fonts are named using the Berry scheme (i.e.,
-% ``{\tt pcrr8a}'' as opposed to ``{\tt COURB}'' or ``{\tt Courier-Bold}'').
-% {\bf {\tt --}extrafonts} can be specified multiple times on the same command
-% line.
-%
-% \item[{\bf {\tt --}man}={\em man page\/}]^^A
-% \thinoptidxL{man}^^A
-% \hfil\\
-% Create a Unix manual page for \thinprogidx{makethin} in the standard, $\ast$roff
-% format. Typical usage is:
-% \begin{verbatim}
-% makethin --man=/usr/man/man1/makethin.1
-% \end{verbatim}
+% }
%
-% \item[{\bf {\tt --}man-ps}={\em PostScript file\/}]^^A
-% \thinoptidxL{man-ps}^^A
-% \hfil\\
-% Create a Unix manual page for \thinprogidx{makethin} in PostScript format instead
-% of $\ast$roff format.
%
-% \end{description}
+% \section{Implementation of \texttt{savetrees.sty}}
+% \label{sec:savetrees.sty}
%
-% In addition to the options listed above, \thinprogidx{makethin} has a required
-% argument, which is the name of a \thinextidx{dvi} file from which to read font
-% information.
+% This section presents the complete, commented source code for the
+% \pkgname{savetrees} package. Although reading this section---and the
+% subsequent implementation sections---is not necessary for
+% understanding how to use \pkgname{savetrees}, it may be a useful
+% teaching instrument for \LaTeX{} newcomers who want to learn more
+% about fine-tuning document formatting.
%
-% \subsection*{EXAMPLES}
-% The following are some examples of how to use \thinprogidx{makethin}.
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
%
-% \subsubsection*{A typical case}^^A
+% \subsection{Default values}
%
-% First, we need to produce {\em myfile.dvi\/}, because that contains the
-% font information that \thinprogidx{makethin} will read:
-% \begin{verbatim}
-% latex myfile.tex
-% \end{verbatim}
+% \pkgname{savetrees} attempts to provide a reasonable balance between
+% aesthetics and the amount of space saved in a document. However,
+% \pkgname{savetrees} does enable the document author to adjust a number
+% of parameters to bias \pkgname{savetrees}'s behavior towards either
+% reduced document length or prettier output. This section defines the
+% default values for various package parameters.
%
-% Next, we invoke \thinprogidx{makethin}, telling it to process
-% \thinfileidx{config.cmz} (which, in turn, causes
-% \thinfileidx{psfonts.cmz} to be processed), This tells \thinprogidx{makethin}
-% to use PostScript versions of the Computer Modern fonts instead of
-% bitmapped versions. (\thinprogidx{makethin} can scale only PostScript fonts.)
-% We also specify maximal verbosity:
-% \begin{verbatim}
-% makethin -Pcmz --verbose --verbose myfile.dvi
-% \end{verbatim}
-%
-% The preceding line reads \thinfileidx{config.ps},
-% \thinfileidx{config.cmz}, various map files, such as
-% \thinfileidx{psfonts.map} and \thinfileidx{psfonts.cmz}, and all of
-% the \thinextidx{tfm} and \thinextidx{vf} files mentioned in {\em
-% myfile.dvi\/}. It then writes \thinfileidx{config.thin},
-% \thinfileidx{thin.map}, and modified versions of all of the
-% \thinextidx{tfm} and \thinextidx{vf} files to the current directory.
-%
-% We now need to re-run \thinprogidx{latex}, so it can produce a new {\em myfile.dvi\/}
-% using the thinner metrics listed in the current directory's \thinextidx{tfm}
-% and \thinextidx{vf} files:
-% \begin{verbatim}
-% latex myfile.tex
-% \end{verbatim}
-%
-% Finally, we produce a PostScript file using the newly generated using
-% \thinfileidx{config.thin} and \thinfileidx{thin.map} files:
-% \begin{verbatim}
-% dvips -Pthin myfile.dvi -o myfile.ps
-% \end{verbatim}
+% \begin{macro}{\st@margin@width}
+% When |margins=tight|, |\st@margin@width| specifies how wide the page
+% margins should be. The default, 1.5\,cm, is extremely small, but it
+% can sure save a lot of space on the page.
+% \begin{macrocode}
+\newcommand*{\st@margin@width}{1.5cm}
+% \end{macrocode}
+% \end{macro}
%
-% If all worked according to plan, {\em myfile.ps\/} should be typeset using
-% extremely thin (half-width) versions of its original fonts.
+% \begin{macro}{\st@parindent}
+% The standard \LaTeX\ classes (|article|, |report|, and |book|) define
+% paragraph indentation as follows. If |twocolumn| is in effect,
+% |\parindent| is set to 1\,em. Otherwise, if the base font size is
+% 10\,pt., |\parindent| is set to 15\,pt.; if the base font size is
+% 11\,pt., |\parindent| is set to 17\,pt.; and if the base font size is
+% 12\,pt., |\parindent| is set to 1.5\,em. When |indent=tight|,
+% \pkgname{savetrees} uses a default of 1\,em---approximately a third of
+% the no-\pkgname{savetrees} value---regardless of font size.
+% \begin{macrocode}
+\newcommand*{\st@parindent}{1em}
+% \end{macrocode}
+% \end{macro}
%
-% \subsubsection*{Producing thin fonts for use in pdf\LaTeX{}}^^A
-% \index{pdfLaTeX=pdf\LaTeX{}|(usage}
+% \begin{macro}{\st@baselinestretch}
+% Depending on font size, the standard \LaTeX\ classes (|article|,
+% |report|, and |book|) use 2--2.6\,pt.\ lead (inter-line spacing), or
+% approximately~20\% of font size. Specifically, they typeset body text
+% at 10/12, 11/13.6, or 12/14.5. When |leading=tight|,
+% \pkgname{savetrees} reduces the line spacing to 90\% of normal or an
+% average of about~1.3\,pt.\ less lead than \LaTeX's defaults: 10/10.8,
+% 11/12.24, or 12/13.05. 90\% gives very good compression but still
+% prevents descenders from running into successive ascenders.
+% \begin{macrocode}
+\newcommand*{\st@baselinestretch}{0.9}
+% \end{macrocode}
+% \end{macro}
%
-% Because \thinprogidx{makethin} can read only \thinextidx{dvi} files, not
-% \thinextidx{pdf} files, we first need to produce a \thinextidx{dvi}
-% file:
-% \begin{verbatim}
-% latex too-long.tex
-% \end{verbatim}
+% \begin{macro}{\st@char@shrink}
+% When |charwidths=tight|, \pkgname{savetrees} disables font expansion
+% but enables font compaction. The default contraction of 5\% (50/1000)
+% of normal character widths is largely undetectable to the casual
+% observer but can save a great deal of space over the course of a long
+% document.
+% \begin{macrocode}
+\newcommand*{\st@char@shrink}{50}
+% \end{macrocode}
+% \end{macro}
%
-% {\em too-long.dvi\/} is typeset entirely using the Times family of
-% fonts. Therefore, we don't need to specify {\bf -Pcmz}. However,
-% {\bf pdflatex} normally embeds Times, thereby precluding {\bf
-% makethin}'s ability to scale it. (\thinprogidx{makethin} requires a {\em
-% .pfb\/} font file in order to scale the corresponding font.)
-% Fortunately, {\em /usr/share/texmf/dvips/config/ar-std-urw-kb.map\/}^^A
-% \index{ar-std-urw-kb.map=\texttt{ar-std-urw-kb.map}|usage}
-% already contains the proper mapping of \TeX{} names to \thinextidx{pfb}
-% files for Times, Courier, and Helvetica. We can tell \thinprogidx{makethin}
-% to use that file:
-% \begin{verbatim}
-% makethin --cleanfirst -v -v too-long.dvi --pdftex --xscale=0.9
-% --extramaps=/usr/share/texmf/dvips/config/ar-std-urw-kb.map
-% \end{verbatim}
+% \begin{macro}{\st@cspace@shrink}
+% \pkgname{savetrees} reduces tracking (inter-character spacing)
+% when |tracking=tight|. By default, tracking is set to -2.5\%
+% (-25/1000) of an em~width. When decreased much more than that,
+% characters begin to overlap and become hard to read.
+% \begin{macrocode}
+\newcommand*{\st@cspace@shrink}{-25}
+% \end{macrocode}
+% \end{macro}
%
-% In the preceding line, we changed the scaling factor from the default
-% of 0.5 to a more reasonable 0.9. Because we had some 0.5-scaled
-% \thinextidx{tfm} and \thinextidx{vf} files left over from the previous
-% example, we specified {\bf {\tt --}cleanfirst} to delete those old
-% font files. We specified {\bf {\tt --}pdftex} to make \thinprogidx{makethin}
-% produce a local \thinfileidx{pdftex.cfg} file. And we told {\bf
-% makethin} where to find the extra map file needed to force the usage
-% of \thinextidx{pfb} files.
-%
-% All that's left is to run {\bf pdflatex} to produce a \thinextidx{pdf}
-% file:
-% \begin{verbatim}
-% pdflatex too-long.tex
-% \end{verbatim}
+% \begin{macro}{\st@wspace@factor}
+% \pkgname{savetrees} reduces inter-word spacing when
+% |wordspacing=tight|. By default, inter-word spacing is set to 80\% of
+% normal. If decreased much beyond that, words start to run together
+% and become hard to read.
+% \begin{macrocode}
+\newcommand*{\st@wspace@factor}{0.8}
+% \end{macrocode}
+% \end{macro}
%
-% {\bf pdflatex} will read the font metric files (\thinextidx{tfm} and
-% \thinextidx{vf}) and \thinfileidx{pdftex.cfg} from the current
-% directory. This will tell it to load \thinfileidx{thin.map}, which
-% specifies the scaling factor. The result should be a document with
-% each character squeezed to 90\% of its original width.
-%
-% \index{pdfLaTeX=pdf\LaTeX{}|)}
-%
-% \subsection*{FILES}
-% \begin{description}
-%
-% \item[\thinprogidx{perl}]^^A
-% \index{Perl|usage}^^A
-% \hfil\\
-% interpreter/compiler needed to run the \thinprogidx{makethin} script
-%
-% \item[\thinprogidx{kpsewhich}]^^A
-% \hfil\\
-% finds files within the \TeX{} directory tree
-%
-% \item[\thinprogidx{dvitype}]^^A
-% \hfil\\
-% outputs the typesetting commands contained within a \thinextidx{dvi} file
-%
-% \item[{\em $\ast$.tfm\/} and {\em $\ast$.vf\/}]^^A
-% \index{tfm files=\texttt{.tfm} files|usage}^^A
-% \index{vf files=\texttt{.vf} files|usage}^^A
-% \hfil\\
-% \TeX{} font metrics and virtual fonts--metrics specifying the width of
-% each character in a font
-%
-% \item[{\em config.$\ast$\/}]^^A
-% \index{config files=\texttt{config} files|usage}^^A
-% \hfil\\
-% Dvips configuration files, each containing (among other
-% information) a list of font-map files
-%
-% \item[{\em psfonts.$\ast$\/}, {\em $\ast$.map\/}]^^A
-% \index{psfonts.*=\texttt{psfonts.*}|usage}^^A
-% \index{map files|usage}^^A
-% \hfil\\
-% Dvips font-map files, which map \TeX{} font names to PostScript
-% font names and \thinextidx{pfb} files
-%
-% \item[\thinfileidx{pdftex.cfg}]^^A
-% \hfil\\
-% pdf\TeX{} and pdf\LaTeX{} configuration files, each containing (among
-% other information) a list of font-map files
-%
-% \item[\thinprogidx{groff}]^^A
-% \hfil\\
-% used by {\bf {\tt --}man-ps} to produce a PostScript version of the
-% Unix manual page for \thinprogidx{makethin}
-%
-% \end{description}
-%
-% \subsection*{RESTRICTIONS}^^A
-%
-% The most serious restriction is that \thinprogidx{makethin} doesn't
-% work on Computer Modern Roman 10pt. (\thinfileidx{cmr10})---the
-% default \TeX{}/\LaTeX{} font. The reason, I believe, is that \TeX{}
-% and \LaTeX{} preload that font's metrics ({\em cmr10.tfm\/}) and
-% therefore ignore the scaled \thinfileidx{cmr10.tfm} on disk. It may
-% be possible to work around this limitation by copying
-% \thinfileidx{cmr10.tfm} to a new name and convincing \LaTeX{} to use that
-% name where it would otherwise have used \thinfileidx{cmr10.tfm}.
-% However, it's much easier merely to use a different font family (e.g.,
-% with ``{\tt \char`\\usepackage\{times\}}'') for typesetting your
-% document when you know you want to run \thinprogidx{makethin}.
-%
-% \subsection*{SEE ALSO}
-% {\em dvips\/}(1),
-% {\em latex\/}(1),
-% {\em pdflatex\/}(1),
-% the \LaTeX{} {\tt savetrees} package
-%
-% \subsection*{AUTHOR}
-% Scott Pakin, {\em scott+st@pakin.org\/}
-%
-% \clearpage
-% \setlength{\parskip}{\origparskip}
-% \setlength{\parindent}{\origparindent}
-%
-% \StopEventually{}
%
-% ^^A Define macros for labeling lines of code.
-% \makeatletter
-% \newcommand{\labelprevcodeline}[1]{^^A
-% \begingroup
-% \edef\@currentlabel{\the\c@CodelineNo}^^A
-% \label{#1}^^A
-% \endgroup
-% }
-% \newcounter{nextCodelineNo}
-% \newcommand{\labelnextcodeline}[1]{^^A
-% \begingroup
-% \setcounter{nextCodelineNo}{\c@CodelineNo}^^A
-% \addtocounter{nextCodelineNo}{1}^^A
-% \edef\@currentlabel{\thenextCodelineNo}^^A
-% \label{#1}^^A
-% \endgroup
-% }
-% \makeatother
+% \subsection{Option processing}
+% \label{sec:options}
%
+% \paragraph{Enabling/disabling space-saving techniques}
+% By default, \pkgname{savetrees} tries to make documents extremely
+% dense. However, this also makes them rather ugly. The package
+% options defined below let the author specify which space-saving
+% routines are unacceptably grotesque and should not be utilized.
%
-% \section{Implementation of \texttt{savetrees.sty}}
+% \bigskip
%
-% This section lists the complete, commented source code for the
-% \pkgname{savetrees} package. Although reading this section---and the
-% subsequent implementation sections---is not necessary for understanding
-% how to use \pkgname{savetrees}, it may be a useful teaching tool
-% for \LaTeX{} newcomers. For instance, if you want narrow page
-% margins, but find \pkgname{savetrees}'s defaults to be \emph{too}
-% narrow, then seeing how \pkgname{savetrees} alters margins may be
-% instructive for learning how to select your own page margins.
+% \pkgname{savetrees} uses the \pkgname{xkeyval} package to parse its
+% package options.
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
%
+% \begin{macro}{\st@more@packages}
+% \begin{macro}{\st@RequirePackage}
+% As we process the package options we may encounter additional packages
+% that we need to load. Rather than load them eagerly, which may lead
+% to the same package problematically being loaded twice with different
+% options, we merely construct a list of required packages. Then, as
+% \pkgname{savetrees}'s last action before finishing, it loads all of
+% the pending packages. |\st@RequirePackage| takes the same arguments
+% as |\RequirePackage| but simply adds the package name to the
+% |\st@more@packages| list and instructs \LaTeXe\ to eventually pass the
+% given arguments, if any, to the package.
% \begin{macrocode}
-%<*package>
+\def\st@more@packages{}
% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\st@RequirePackage}[2][]{%
+ \PassOptionsToPackage{#1}{#2}%
+ \@cons\st@more@packages{{#2}}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndOfPackage{%
+ \let\@elt=\RequirePackage
+ \st@more@packages
+ \let\@elt=\relax
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
-% \subsection{Option processing}
+% \begin{macro}{\st@define@option}
+% \begin{macro}{\st@arg}
+% \begin{macro}{\st@arg@num}
+% \pkgname{savetrees} accepts a large number of package options, each of
+% which can be set to |tight| (the default) to enable a feature or
+% |normal| to disable it. As the definitions of these options are fairly
+% repetitive, we define a helper macro to assist with the processing.
+% \begin{macrocode}
+\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}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% By default, \pkgname{savetrees} tries to make documents extremely
-% dense. However, this also makes them rather ugly. The package
-% options defined in this section let the author specify which
-% space-saving routines are unacceptably grotesque and should not be
-% utilized.
+% Using the preceding macro we define one conditional and one package
+% option for each trick in \pkgname{savetrees}'s book. When
+% \emph{true} (caused by passing |tight| to the package option), the
+% conditional enables the corresponding space compression; when
+% \emph{false}, (caused by passing |normal| to the package option),
+% \pkgname{savetrees} leaves alone that aspect of the formatting.
+%
+% \begin{macro}{\if@st@tight@sections}
+% \begin{macro}{\@st@tight@sectionstrue}
+% \begin{macro}{\@st@tight@sectionsfalse}
+% The \pkgoption{sections} package option enables or disables
+% \pkgname{savetrees}'s modifications to section titles by setting
+% |\@st@tight@sectionstrue| or |\@st@tight@sectionsfalse|, respectively.
+% \begin{macrocode}
+\st@define@option{sections}
+% \end{macrocode}
+% \pkgoptiondecl{sections}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% We now define one new |\if| statement for each package option and define
-% each package option to set the corresponding ``|\@st@normal@|\dots''
-% flag to~\emph{true}.
+% \begin{macro}{\if@st@tight@margins}
+% \begin{macro}{\@st@tight@marginstrue}
+% \begin{macro}{\@st@tight@marginsfalse}
+% The \pkgoption{margins} package option enables or disables
+% \pkgname{savetrees}'s modifications to page margins by setting
+% |\@st@tight@marginstrue| or |\@st@tight@marginsfalse|, respectively.
+% \begin{macrocode}
+\st@define@option{margins}
+% \end{macrocode}
+% \pkgoptiondecl{margins}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% ^^A Define a macro to index an option declaration that appeared on the
-% ^^A previous code line.
-% \makeatletter
-% \newcommand{\pkgoptiondecl}[1]{^^A
-% \special@index{#1 (package option)\actualchar^^A
-% \string\textsf{#1} (package option)\encapchar main}^^A
-% \special@index{package options:\levelchar#1\actualchar^^A
-% \string\textsf{#1}\encapchar main}^^A
-% }
-% \makeatother
+% \begin{macro}{\if@st@tight@lists}
+% \begin{macro}{\@st@tight@liststrue}
+% \begin{macro}{\@st@tight@listsfalse}
+% The \pkgoption{lists} package option enables or disables
+% \pkgname{savetrees}'s modifications to the various list environments
+% by setting |\@st@tight@liststrue| or |\@st@tight@listsfalse|,
+% respectively.
+% \begin{macrocode}
+\st@define@option{lists}
+% \end{macrocode}
+% \pkgoptiondecl{lists}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\if@st@normal@sections}
-% \begin{macro}{\@st@normal@sectionstrue}
-% \begin{macro}{\@st@normal@sectionsfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to section titles.
+% \begin{macro}{\if@st@tight@floats}
+% \begin{macro}{\@st@tight@floatstrue}
+% \begin{macro}{\@st@tight@floatsfalse}
+% The \pkgoption{floats} package option enables or disables
+% \pkgname{savetrees}'s modifications to \LaTeX's float-placement
+% parameters by setting |\@st@tight@floatstrue| or
+% |\@st@tight@floatsfalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@sections
-\DeclareOption{normalsections}{\@st@normal@sectionstrue}
+\st@define@option{floats}
% \end{macrocode}
-% \pkgoptiondecl{normalsections}
+% \pkgoptiondecl{floats}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@margins}
-% \begin{macro}{\@st@normal@marginstrue}
-% \begin{macro}{\@st@normal@marginsfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to page margins.
+% \begin{macro}{\if@st@tight@indent}
+% \begin{macro}{\@st@tight@indenttrue}
+% \begin{macro}{\@st@tight@indentfalse}
+% The \pkgoption{indent} package option enables or disables
+% \pkgname{savetrees}'s modifications to paragraph indentation by
+% setting |\@st@tight@indenttrue| or |\@st@tight@indentfalse|,
+% respectively.
% \begin{macrocode}
-\newif\if@st@normal@margins
-\DeclareOption{normalmargins}{\@st@normal@marginstrue}
+\st@define@option{indent}
% \end{macrocode}
-% \pkgoptiondecl{normalmargins}
+% \pkgoptiondecl{indent}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@lists}
-% \begin{macro}{\@st@normal@liststrue}
-% \begin{macro}{\@st@normal@listsfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to the various list environments.
+% \begin{macro}{\if@st@tight@title}
+% \begin{macro}{\@st@tight@titletrue}
+% \begin{macro}{\@st@tight@titlefalse}
+% The \pkgoption{title} package option enables or disables
+% \pkgname{savetrees}'s modifications to title formatting by setting
+% |\@st@tight@titletrue| or |\@st@tight@titlefalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@lists
-\DeclareOption{normallists}{\@st@normal@liststrue}
+\st@define@option{title}
% \end{macrocode}
-% \pkgoptiondecl{normallists}
+% \pkgoptiondecl{title}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@floats}
-% \begin{macro}{\@st@normal@floatstrue}
-% \begin{macro}{\@st@normal@floatsfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to \LaTeX's float-placement parameters.
+% \begin{macro}{\if@st@tight@leading}
+% \begin{macro}{\@st@tight@leadingtrue}
+% \begin{macro}{\@st@tight@leadingfalse}
+% The \pkgoption{leading} package option enables or disables
+% \pkgname{savetrees}'s modifications to interline spacing by setting
+% |\@st@tight@leadingtrue| or |\@st@tight@leadingfalse|, respectively.
+% This interline spacing is known as ``leading'' because of the
+% additional strips of lead placed between lines in the days of metal
+% type.
% \begin{macrocode}
-\newif\if@st@normal@floats
-\DeclareOption{normalfloats}{\@st@normal@floatstrue}
+\st@define@option{leading}
% \end{macrocode}
-% \pkgoptiondecl{normalfloats}
+% \pkgoptiondecl{leading}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@indent}
-% \begin{macro}{\@st@normal@indenttrue}
-% \begin{macro}{\@st@normal@indentfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to paragraph indentation.
+% \begin{macro}{\if@st@tight@paragraphs}
+% \begin{macro}{\@st@tight@paragraphstrue}
+% \begin{macro}{\@st@tight@paragraphsfalse}
+% The \pkgoption{paragraphs} package option enables or disables
+% \pkgname{savetrees}'s modifications to \TeX's paragraph looseness
+% (i.e.,~the number of lines by which \TeX\ is instructed to shrink each
+% paragraph) by setting |\@st@tight@paragraphstrue| or
+% |\@st@tight@paragraphsfalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@indent
-\DeclareOption{normalindent}{\@st@normal@indenttrue}
+\st@define@option{paragraphs}
% \end{macrocode}
-% \pkgoptiondecl{normalindent}
+% \pkgoptiondecl{paragraphs}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@title}
-% \begin{macro}{\@st@normal@titletrue}
-% \begin{macro}{\@st@normal@titlefalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to title formatting.
+% \begin{macro}{\if@st@tight@charwidths}
+% \begin{macro}{\@st@tight@charwidthstrue}
+% \begin{macro}{\@st@tight@charwidthsfalse}
+% The \pkgoption{charwidths} package option enables or disables
+% \pkgname{savetrees}'s modifications to character width by setting
+% |\@st@tight@charwidthstrue| or |\@st@tight@charwidthsfalse|,
+% respectively.
% \begin{macrocode}
-\newif\if@st@normal@title
-\DeclareOption{normaltitle}{\@st@normal@titletrue}
+\st@define@option{charwidths}
% \end{macrocode}
-% \pkgoptiondecl{normaltitle}
+% \pkgoptiondecl{charwidths}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@leading}
-% \begin{macro}{\@st@normal@leadingtrue}
-% \begin{macro}{\@st@normal@leadingfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to interline spacing. This spacing is known as
-% ``leading'' because of the additional strips of lead placed between
-% lines in the days of metal type.
+% \begin{macro}{\if@st@tight@tracking}
+% \begin{macro}{\@st@tight@trackingtrue}
+% \begin{macro}{\@st@tight@trackingfalse}
+% The \pkgoption{tracking} package option enables or disables
+% \pkgname{savetrees}'s modifications to tracking (spacing between
+% letters) by setting |\@st@tight@trackingtrue| or
+% |\@st@tight@trackingfalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@leading
-\DeclareOption{normalleading}{\@st@normal@leadingtrue}
+\st@define@option{tracking}
% \end{macrocode}
-% \pkgoptiondecl{normalleading}
+% \pkgoptiondecl{tracking}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@looseness}
-% \begin{macro}{\@st@normal@loosenesstrue}
-% \begin{macro}{\@st@normal@loosenessfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to \TeX's paragraph looseness (i.e.,~the number of lines
-% by which \TeX\ is instructed to shrink each paragraph).
+% \begin{macro}{\if@st@tight@wordspacing}
+% \begin{macro}{\@st@tight@wordspacingtrue}
+% \begin{macro}{\@st@tight@wordspacingfalse}
+% The \pkgoption{wordspacing} package option enables or disables
+% \pkgname{savetrees}'s modifications to inter-word spacing by setting
+% |\@st@tight@wordspacingtrue| or |\@st@tight@wordspacingfalse|,
+% respectively.
% \begin{macrocode}
-\newif\if@st@normal@looseness
-\DeclareOption{normallooseness}{\@st@normal@loosenesstrue}
+\st@define@option{wordspacing}
% \end{macrocode}
-% \pkgoptiondecl{normallooseness}
+% \pkgoptiondecl{wordspacing}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@char@widths}
-% \begin{macro}{\@st@normal@char@widthstrue}
-% \begin{macro}{\@st@normal@char@widthsfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to font width.
+% \begin{macro}{\if@st@tight@bibliography}
+% \begin{macro}{\@st@tight@bibliographytrue}
+% \begin{macro}{\@st@tight@bibliographyfalse}
+% The \pkgoption{bibliography} package option enables or disables
+% \pkgname{savetrees}'s modifications to bibliography formatting by
+% setting |\@st@tight@bibliographytrue| or
+% |\@st@tight@bibliographyfalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@char@widths
-\DeclareOption{normalcharwidths}{\@st@normal@char@widthstrue}
+\st@define@option{bibliography}
% \end{macrocode}
-% \pkgoptiondecl{normalcharwidths}
+% \pkgoptiondecl{bibliography}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@bib}
-% \begin{macro}{\@st@normal@bibtrue}
-% \begin{macro}{\@st@normal@bibfalse}
-% These are used to conditionally disable \pkgname{savetrees}'s
-% modifications to bibliography formatting.
+% \begin{macro}{\if@st@tight@bibnotes}
+% \begin{macro}{\@st@tight@bibnotestrue}
+% \begin{macro}{\@st@tight@bibnotesfalse}
+% The \pkgoption{bibnotes} package option conditionally excludes or
+% includes |NOTE| fields when using |savetrees.bst| by setting
+% |\@st@tight@bibnotestrue| or |\@st@tight@bibnotesfalse|, respectively.
% \begin{macrocode}
-\newif\if@st@normal@bib
-\DeclareOption{normalbib}{\@st@normal@bibtrue}
+\st@define@option{bibnotes}
% \end{macrocode}
-% \pkgoptiondecl{normalbib}
+% \pkgoptiondecl{bibnotes}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\if@st@normal@bibnotes}
-% \begin{macro}{\@st@normal@bibnotestrue}
-% \begin{macro}{\@st@normal@bibnotesfalse}
-% These are used to conditionally include |NOTE| fields when using
-% |savetrees.bst|.
+% \begin{macro}{\st@arg}
+% \begin{macro}{\st@arg@num}
+% For the document author's convenience, we define an |all| meta-option
+% that can be used to enable or disable all of \pkgname{savetrees}'s
+% space-saving features at once.
% \begin{macrocode}
-\newif\if@st@normal@bibnotes
-\DeclareOption{normalbibnotes}{\@st@normal@bibnotestrue}
+\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}}
% \end{macrocode}
-% \pkgoptiondecl{normalbibnotes}
+% \pkgoptiondecl{all}
% \end{macro}
% \end{macro}
+%
+% \paragraph{Parameter tuning}
+% While \pkgname{savetrees} tries to use reasonable defaults for the
+% numerical values used by its space-saving techniques, many of these
+% parameters can be modified conveniently via package options:
+% \changes{v2.0}{2011/05/07}{Added package options for altering various
+% formatting parameters}
+%
+% The \pkgoption{marginwidth} option specifies the width of the page
+% margins when |margins=tight|.
+% \begin{macrocode}
+\DeclareOptionX{marginwidth}{\gdef\st@margin@width{#1}}
+% \end{macrocode}
+% \pkgoptiondecl{marginwidth}
+%
+% The \pkgoption{parindent} option specifies the paragraph indent
+% when |indent=tight|.
+% \begin{macrocode}
+\DeclareOptionX{parindent}{\gdef\st@parindent{#1}}
+% \end{macrocode}
+% \pkgoptiondecl{parindent}
+%
+% The \pkgoption{leadingfraction} option specifies the fraction by which
+% to multiply the line spacing when |leading=tight|.
+% \begin{macrocode}
+\DeclareOptionX{leadingfraction}{\gdef\st@baselinestretch{#1}}
+% \end{macrocode}
+% \pkgoptiondecl{leadingfraction}
+%
+% The \pkgoption{charwidthfraction} option specifies the fraction by
+% which to multiply character-glyph widths when |charwidths=tight|.
+% Because the \pkgname{microtype} package takes a per~mill width
+% contraction we have to do some arithmetic to produce
+% |\st@char@shrink|.
+% \begin{macrocode}
+\DeclareOptionX{charwidthfraction}{%
+ \@tempdima=#1pt
+ \multiply\@tempdima by -1000
+ \advance\@tempdima by 1000pt
+ \divide\@tempdima by 65536
+ \@tempcnta=\@tempdima
+ \xdef\st@char@shrink{\the\@tempcnta}%
+}
+% \end{macrocode}
+% \pkgoptiondecl{charwidthfraction}
+%
+% The \pkgoption{trackingfraction} option specifies the fraction by
+% which to multiply character spacing when |tracking=tight|. Because
+% the \pkgname{microtype} package takes a per~mill width expansion we
+% have to do some arithmetic to produce |\st@cspace@shrink|.
+% \begin{macrocode}
+\DeclareOptionX{trackingfraction}{%
+ \@tempdima=#1pt
+ \advance\@tempdima by -1pt
+ \multiply\@tempdima by 1000
+ \divide\@tempdima by 65536
+ \@tempcnta=\@tempdima
+ \xdef\st@cspace@shrink{\the\@tempcnta}%
+}
+% \end{macrocode}
+% \pkgoptiondecl{trackingfraction}
+%
+% The \pkgoption{wordspacingfraction} option specifies the fraction by
+% which to multiply inter-word spacing when |wordspacing=tight|.
+% \begin{macrocode}
+\DeclareOptionX{wordspacingfraction}{\gdef\st@wspace@factor{#1}}
+% \end{macrocode}
+% \pkgoptiondecl{wordspacingfraction}
+%
+% \paragraph{Obsolete options}
+% \pkgname{savetrees} used to name all of its options
+% |normal|\meta{something}. None of these took arguments so the only
+% usage model was for \pkgname{savetrees} to turn all space-saving
+% techniques on by default and let the user selectively disable them.
+% Starting with version~2.0, \pkgname{savetrees} package options take
+% the form \meta{something}[|=tight|] or \meta{something}|=normal|, which
+% gives a document author the ability to enable or disable options as
+% desired. To move authors to the new set of parameters, we define all
+% of the old options as error-generating calls.
+%
+% \begin{macro}{\st@mark@as@obsolete}
+% We define a helper macro that processes the given option by issuing an
+% error message that instructs the document author to use a different
+% option instead.
+% \begin{macrocode}
+\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.}%
+% \end{macrocode}
+% Out of the goodness of our heart, we automatically convert the
+% obsolete option to a new option and evaluate that.
+% \begin{macrocode}
+ \csname @st@tight@#2false\endcsname
+ }%
+ \DeclareOptionX{#1}[tight]{\csname KV@savetrees@#1\endcsname{##1}}%
+}
+% \end{macrocode}
% \end{macro}
%
-% \noindent
-% We need to process our options immediately, because they'll be needed
-% in the following code to determine which packages to load and what
-% macros to define.
+% We now invoke |\st@mark@as@obsolete| once for each obsolete
+% \pkgname{savetrees} option,
% \begin{macrocode}
-\ProcessOptions\relax
+\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}
+% \end{macrocode}
+%
+% At long last, we can process all of the options defined in
+% Section~\ref{sec:options}.
+% \begin{macrocode}
+\ProcessOptionsX\relax
% \end{macrocode}
%
%
@@ -1131,9 +1312,8 @@
% below them.
%
% \begin{macrocode}
-\if@st@normal@sections
-\else
- \RequirePackage[tiny,compact]{titlesec}
+\if@st@tight@sections
+ \st@RequirePackage[tiny,compact]{titlesec}
\fi
% \end{macrocode}
%
@@ -1145,30 +1325,20 @@
% narrower margins mean fewer pages, and that's what \pkgname{savetrees}
% is striving for.
%
-% \begin{macro}{\@st@marginsize}
-% 1.5\,cm might not be the best margin size, so this value is stored in
-% the |\@st@marginsize| register, where it can easily be changed.
-% \begin{macrocode}
-\newlength{\@st@marginsize}
-\setlength{\@st@marginsize}{1.5cm}
-% \end{macrocode}
-% \end{macro}
-%
-% \noindent
-% Use the \pkgname{geometry} package to narrow our page margins, unless
-% the author wants to keep \LaTeX's original ones. Note that we accept
-% \pkgname{geometry}'s default of zero space allocated to marginal notes.
+% We use the \pkgname{geometry} package to narrow our page margins
+% unless the author wants to keep \LaTeX's original ones. Note that we
+% accept \pkgname{geometry}'s default of zero space allocated to
+% marginal notes.
% \changes{v1.2}{2006/11/20}{Made the top margin consistent with the other
% margins and allocated space for the footer}
% \begin{macrocode}
-\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
% \end{macrocode}
%
@@ -1179,14 +1349,12 @@
% description lists by reducing indentation slightly and by eliminating
% inter-item spacing altogether.
%
-% We make no modifications if the author prohibits us from doing so.
% \begin{macrocode}
-\if@st@normal@lists
-\else
+\if@st@tight@lists
% \end{macrocode}
% The \pkgname{calc} package helps simplify our list redefinitions.
% \begin{macrocode}
- \RequirePackage{calc}
+ \st@RequirePackage{calc}
% \end{macrocode}
%
% \begin{environment}{itemize}
@@ -1209,6 +1377,7 @@
\setlength{\topsep}{4pt plus 1pt minus 2pt}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}%
+ \setlength{\listparindent}{\st@parindent}%
% \end{macrocode}
% That's it for the modifications. We can now finish up the redefinition
% of |itemize|.
@@ -1238,6 +1407,7 @@
\setlength{\topsep}{4pt plus 1pt minus 2pt}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}%
+ \setlength{\listparindent}{\st@parindent}%
% \end{macrocode}
% That's it for the modifications. We can now finish up the
% redefinition of |enumerate|.
@@ -1275,11 +1445,9 @@
% \begin{macro}{\dblfloatpagefraction}
% \LaTeX{} normally doesn't try very hard to pack floats onto a page.
% The following parameter changes attempt to reduce the number of float
-% pages (and hence, total pages). As always, the author can require
-% that the original float-placement parameters be used instead.
+% pages (and hence, total pages).
% \begin{macrocode}
-\if@st@normal@floats
-\else
+\if@st@tight@floats
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.85}
\renewcommand{\textfraction}{0.1}
@@ -1302,13 +1470,13 @@
%
% \subsection{Paragraph indentation}
%
-% \LaTeX{} normally provides 2\,em of indentation at the start of each
-% paragraph. We can save a little space by reducing that to~1\,em.
+% \LaTeX\ normally provides approximately 1.5\,em of indentation at the
+% start of each paragraph. We can save a little space by slightly
+% reducing the indentation amount.
%
% \begin{macrocode}
-\if@st@normal@indent
-\else
- \setlength{\parindent}{1em}
+\if@st@tight@indent
+ \setlength{\parindent}{\st@parindent}
\fi
% \end{macrocode}
%
@@ -1321,8 +1489,7 @@
% body font. In addition, we remove the extra whitespace above the
% title and lessen the whitespace below the title.
% \begin{macrocode}
-\if@st@normal@title
-\else
+\if@st@tight@title
% \end{macrocode}
% \begin{macro}{\@maketitle}
% The following was taken largely from |classes.dtx|, but modified as
@@ -1351,18 +1518,13 @@
%
% \subsection{Interline spacing}
%
+% \begin{macro}{\baselinestretch}
% A document's page count can be reduced quite significantly by reducing
-% the amount of whitespace between successive lines of text, so that's
+% the amount of whitespace between successive lines of text so that's
% exactly what we do below.
-%
-% \begin{macro}{\baselinestretch}
-% 90\% of normal leading gives very good compression but still prevents
-% descenders from running into successive ascenders. 95\% would look
-% more subtle but, of course, would fit less text per page.
% \begin{macrocode}
-\if@st@normal@leading
-\else
- \renewcommand{\baselinestretch}{0.9}
+\if@st@tight@leading
+ \renewcommand{\baselinestretch}{\st@baselinestretch}
\fi
% \end{macrocode}
% \end{macro}
@@ -1378,7 +1540,7 @@
% However, |\looseness| can be set to a negative number, which
% encourages \TeX\ to shrink the current paragraph by a given number of
% lines. For this technique to work, the paragraph must be relatively
-% long to \TeX\ has enough shrinkable whitespace to work with.
+% long so \TeX\ has enough shrinkable whitespace to work with.
%
% Unfortunately, |\looseness| applies only to the current paragraph. We
% therefore use |\everypar| to inject |\looseness=-1| into every
@@ -1390,8 +1552,7 @@
% \texttt{\string\string\looseness!=-1} to avoid discarding any
% leading digits appearing in a paragraph}
% \begin{macrocode}
-\if@st@normal@looseness
-\else
+\if@st@tight@paragraphs
\let\markeverypar\everypar
\newtoks\everypar
\everypar\markeverypar
@@ -1402,25 +1563,68 @@
% Even when |\everypar| is used in the ordinary fashion it is likely to
% conflict with various \LaTeX\ packages. Because the preceding code is
% a particularly tricky redefinition of |\everypar| it's likely that
-% many documents will need to disable paragraph looseness by specifying
-% the \pkgoption{normallooseness} option to \pkgname{savetrees}.
+% many documents will need to disable paragraph looseness by providing
+% the |paragraphs=normal| option to \pkgname{savetrees}.
%
%
% \subsection{Font width}
% \changes{v1.3}{2010/06/03}{Added support for narrowing font widths}
%
+% The \pkgname{microtype} package provides \LaTeX\ support for the
+% font-expansion feature supported by pdf\TeX\ and lua\TeX\@. Font
+% expansion is intended to improve text ``color''---the even balance
+% between ink and absence of ink on a page---by subtly expanding or
+% narrowing character widths instead of by adding or removing
+% whitespace. \pkgname{savetrees} hijacks this feature as a
+% space-saving mechanisms by specifying a maximum expansion of~0\% of a
+% character's natural width but a maximum contraction of greater
+% than~0\%.
+%
+% \begin{macrocode}
+\if@st@tight@charwidths
+ \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype}
+\fi
+% \end{macrocode}
+%
+%
+% \subsection{Inter-character spacing}
+% \changes{v2.0}{2011/05/06}{Added support for reducing inter-character
+% spacing}
+%
% The \pkgname{microtype} package provides \LaTeX\ support for pdf\TeX's
-% font-expansion feature. Font expansion is intended to improve text
-% ``color''---the even balance between ink and absence of ink on a
-% page---by subtly expanding or narrowing character widths instead of by
-% adding or removing whitespace. \pkgname{savetrees} hijacks this
-% feature as a space-saving mechanisms by specifying a maximum expansion
-% of~0\% of a character's natural width but a maximum narrowing of~5\%.
+% tracking feature. Rather than using tracking with a light touch and
+% just in certain contexts (e.g.,~small caps), we instruct
+% \pkgname{microtype} to track somewhat aggressively, shaving off a few
+% percent of an em~width between \emph{every} pair of characters.
%
% \begin{macrocode}
-\if@st@normal@char@widths
-\else
- \RequirePackage[stretch=0,shrink=50]{microtype}
+\if@st@tight@tracking
+ \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype}
+\fi
+% \end{macrocode}
+%
+%
+% \subsection{Inter-word spacing}
+% \changes{v2.0}{2011/05/06}{Added support for reducing inter-word
+% spacing}
+%
+% Any font used by \TeX\ is required to have at least seven |\fontdimen|
+% parameters. |\fontdimen2| represents the base inter-word spacing.
+% (|\fontdimen3| and |\fontdimen4| represent, respectively, the amount
+% by which inter-word spacing can stretch or shrink; \pkgname{savetrees}
+% does not currently alter those.) Here, we hook into \LaTeXe's
+% font-loading mechanism. Whenever a new font is loaded, we specify
+% that the inter-word spacing for that font should be reduced.
+% \begin{macrocode}
+\if@st@tight@wordspacing
+ \g@addto@macro\define@newfont{%
+ \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
+ }%
+% \end{macrocode}
+% We also reduce the inter-word spacing for whatever font is currently
+% loaded.
+% \begin{macrocode}
+ \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
\fi
% \end{macrocode}
%
@@ -1431,11 +1635,8 @@
% First, we omit blank linkes between entries. And second, we typeset
% the entire bibliography---excluding the section title---with |\small|.
%
-% We start, as always, by giving the author a chance to override our
-% changes.
% \begin{macrocode}
-\if@st@normal@bib
-\else
+\if@st@tight@bibliography
% \end{macrocode}
% \begin{environment}{thebibliography}
% The following was taken largely from |classes.dtx|; see that file for
@@ -1492,7 +1693,7 @@
% \begin{macrocode}
\small
% \end{macrocode}
-% We finish up using the original code\dots
+% We finish up using the original code.
% \begin{macrocode}
\sloppy
\clubpenalty4000
@@ -1514,23 +1715,23 @@
%
% \begin{macro}{\savetreesbibnote}
% The bibliographies output by the |savetrees.bst| \BibTeX{} style
-% (to be presented in Section~\ref{sec:savetrees.bst}) surround all |NOTE|
-% fields with a call to the |\savetreesbibnote| macro. As a result, this
-% must be defined for |savetrees.bst| to work. By default,
-% |\savetreesbibnote| is defined to do nothing. Howevever, the author
-% can specify that |\savetreesbibnote| should instead output its argument
-% with no additional processing.
+% (presented in \ref{sec:savetrees.bst}) surround all |NOTE| fields with
+% a call to the |\savetreesbibnote| macro. As a result, this macro must
+% be defined for |savetrees.bst| to work. By default,
+% |\savetreesbibnote| is defined to do nothing. Howevever, setting
+% |bibnotes=normal| indicates that |\savetreesbibnote| should instead
+% output its argument as is.
% \labelnextcodeline{code:stbn-begin}
% \begin{macrocode}
-\if@st@normal@bibnotes
- \newcommand{\savetreesbibnote}[1]{#1}
-\else
+\if@st@tight@bibnotes
% \end{macrocode}
% To supppress a |NOTE| field, we also have to gobble the period
% following the note. Otherwise, the bibliography will show two periods
% surrounding an empty note.
% \begin{macrocode}
\newcommand{\savetreesbibnote}[1]{\@gobble}
+\else
+ \newcommand{\savetreesbibnote}[1]{#1}
\fi
% \end{macrocode}
% \labelprevcodeline{code:stbn-end}
@@ -1568,7 +1769,7 @@
%
% \begin{center}
% $\vdots$ \\
-% (460 lines of code omitted) \\
+% (443 lines of code omitted) \\
% $\vdots$
% \end{center}
%
@@ -2022,12 +2223,12 @@ FUNCTION {select.language}
% \end{macrocode}
% \fi
%
-% The following function is the only one modified by Scott Pakin. The
+% |format.note| is the first of two functions modified by hand. The
% modification involves placing the entire note field within
% |\savetreesbibnote{|\dots|}|. This enables |savetrees.sty| to
-% selectively define |\savetreesbibnote| to either output its argument as
-% is or discard it (and the subsequent period). See
-% Section~\ref{sec:bibliographic-notes} for |savetrees.sty|'s definition
+% selectively define |\savetreesbibnote| to either output its argument
+% as is or discard it (and the subsequent period). See
+% \ref{sec:bibliographic-notes} for |savetrees.sty|'s definition
% of~|\savetreesbibnote|.
% \begin{macrocode}
FUNCTION {format.note}
@@ -2052,6 +2253,12 @@ FUNCTION {format.note}
}
% \end{macrocode}
%
+% \begin{center}
+% $\vdots$ \\
+% (914 lines of code omitted) \\
+% $\vdots$
+% \end{center}
+%
% \iffalse
% \begin{macrocode}
@@ -2968,6 +3175,18 @@ EXECUTE {initialize.longest.label}
ITERATE {longest.label.pass}
+% \end{macrocode}
+% \fi
+%
+% |begin.bib| is the second of two functions modified by hand. The
+% modification is to have the function write some additional code to the
+% |.bbl| file to define |\savetreesbibnote| as the identity function if
+% that macro is not already defined.
+% \changes{v2.0}{2011/05/12}{Made \texttt{savetrees.bib} work
+% independently of \texttt{savetrees.sty} by having it define
+% \texttt{\string\string\string\savetreesbibnote} if not already
+% defined}
+% \begin{macrocode}
FUNCTION {begin.bib}
{ preamble$ empty$
'skip$
@@ -2975,731 +3194,39 @@ FUNCTION {begin.bib}
if$
"\begin{thebibliography}{" longest.label * "}" *
write$ newline$
- "\expandafter\ifx\csname selectlanguage\endcsname\relax"
+ "\providecommand*{\selectlanguage}[1]{\relax}%"
write$ newline$
- " \def\selectlanguage#1{\relax}\fi"
+ "\providecommand*{\savetreesbibnote}[1]{#1}%"
write$ newline$
}
-
-EXECUTE {begin.bib}
-
-EXECUTE {init.state.consts}
-
-ITERATE {call.type$}
-
-FUNCTION {end.bib}
-{ newline$
- "\end{thebibliography}" write$ newline$
-}
-
-EXECUTE {end.bib}
% \end{macrocode}
-% \fi
%
% \begin{center}
% $\vdots$ \\
-% (941 lines of code omitted) \\
+% (13 lines of code omitted) \\
% $\vdots$
% \end{center}
%
-% \begin{macrocode}
-%</bibstyle>
-% \end{macrocode}
-%
-%
-% \section{Implementation of \texttt{makethin}}
-%
-% \progname{makethin} is a Perl\index{Perl|usage} script that produces
-% narrow variants of all of the fonts used in a document. The script is
-% about five~pages long and is not listed here. However, the following
-% is an outline of \progname{makethin}'s behavior:
-%
-% \begin{macrocode}
-%<*makethin>
-% \end{macrocode}
-%
-% \begin{enumerate}
-% \item Read all of the TFM and VF fonts named in the given DVI file.
-%
-% \item For each font, perform the following operations:
-%
-% \begin{enumerate}
-% \item If the font is a virtual font (|.vf|), then add all of the
-% VF and TFM fonts it names to the end of the font ``to-do'' list.
-%
-% \item If the font contains \TeX{} font metrics (|.tfm|), then
-% convert the font to an ASCII property list (|.pl|), replace each
-% ``|(CHARWD|~|R|~\meta{width}|)|'' expression with
-% ``|(CHARWD|~|R|~\meta{width}$\times$\meta{x-scale}|)|'', and
-% convert the result back to a |.tfm| file in the current directory.
-% \end{enumerate}
-%
-% \item Acquire a list of font-map files from |config.ps| and any other
-% Dvips configuration specified on the command line.
-%
-% \item Create a new font-map file, containing one line for each font
-% named in the given DVI file, but modified to specify
-% ``|"|\meta{x-scale} |ExtendFont"|'' on each line.
-%
-% \item Create a new Dvips configuration file that points to the new
-% font-map file.
-% \end{enumerate}
-%
% \iffalse
% \begin{macrocode}
-%<<VERBATIM_PERL
-#! /usr/bin/env perl
-
-# Make a thinner version of a LaTeX font
-# By Scott Pakin <scott+st@pakin.org>
-
-use File::Basename;
-use Getopt::Long;
-use Pod::Usage;
-use Pod::Man;
-use warnings;
-use strict;
-
-# Define some global variables.
-my $progname = basename $0; # Name of this program
-my @fontlist; # List of fonts to make thinner
-my @skipfonts; # Fonts specified by the user to ignore
-my @extrafonts; # Additional fonts specified by the user
-my @extramaps; # Additional .map files specified by the user
-my @configexts; # List of config.* files to process
-my @mapfiles; # List of .map files to copy and modify
-my @megamap; # Entire contents of all .map files
-my $cleanfirst; # Delete *.{tfm,vf} before creating new ones
-my $cleanonly; # Same as $cleanfirst, but exit after deleting
-my $dvifile; # Name of input .dvi file
-my $xscale = 0.5; # New font width as a fraction of the original
-my $verbose = 0; # 1=output task info; >1=output file info
-my $base = "thin"; # Name to use for config.* and *.map
-my $also_pdftex = 0; # 1=also produce a pdftex.map
-
-###########################################################################
-
-# Set or change a filename's extension.
-sub set_ext ($$)
-{
- my ($name, $path, $suffix) = fileparse ($_[0], '\.[^.]*');
- $path="" if $path eq "./";
- return $path . $name . $_[1];
-}
-
-
-# Try to find a file on disk using kpsewhich. Extra arguments to
-# kpsewhich can be included, too.
-sub find_file (@)
-{
- chomp (my $result = `kpsewhich @_`);
- return $? ? undef : $result;
-}
-
-
-# Make a font thinner.
-sub thin_font ($$$$)
-{
- my ($fname, $fpath, $fsuffix, $only_fontnames) = @_;
- my $virtualfont = $fsuffix eq ".vf";
- my $converter = $virtualfont ? "vftovp" : "tftopl";
- open (ASCII_TEXT, "$converter $fpath$fname$fsuffix|") || die "open(): $!\n";
-
- # If we already converted the font, then merely look for additional fonts.
- if ($only_fontnames) {
- while (<ASCII_TEXT>) {
- /\(FONTNAME ([^\)]+)\)/i && push @fontlist, $1;
- }
- close ASCII_TEXT;
- return;
- }
-
- # Modify character widths. Also, store the name of any additional font
- # we encounter in a virtual font file.
- my $ascii_file = $virtualfont ? "$fname.vpl" : "$fname.pl";
- open (ASCII_FILE, ">$ascii_file") || die "open(\"$ascii_file\"): $!\n";
- while (<ASCII_TEXT>) {
- /\(FONTNAME ([^\)]+)\)/i && push @fontlist, $1;
- s|^(\s*)\(CHARWD (\S+) ([^\)]+)\)|sprintf "%s(CHARWD %s %.7f)", $1, $2, $3*$xscale|gie;
- print ASCII_FILE $_;
- }
- close ASCII_FILE;
- close ASCII_TEXT;
-
- # Convert the result from ASCII to binary.
- if ($virtualfont) {
- system "vptovf $fname.vpl";
- die "system: $!\n" if $?;
- unlink "$fname.vpl";
- }
- else {
- system "pltotf $fname.pl";
- die "system: $!\n" if $?;
- unlink "$fname.pl";
- }
-}
-
-
-# Re-map a font to a thinner variant.
-sub remap_font ($)
-{
- # See if any map file maps the given font.
- my $fontname = $_[0];
- my @matches = grep {/^$fontname\s/} @megamap;
- return undef if $#matches==-1;
-
- # One does -- scale the font as specified.
- my $quoted = "";
- while ($matches[0] =~ s/\"([^\"]+)\"//) {
- $quoted .= $1 . " ";
- }
- $matches[0] =~ s/\s+/ /g;
- $quoted =~ s/\S+\s+ExtendFont//g;
- $quoted .= "$xscale ExtendFont";
- return $matches[0] . " \"$quoted\"";
-}
+EXECUTE {begin.bib}
-# Output the embedded POD documentation in either *roff or PostScript format.
-sub pod2man ($$)
-{
- my ($manfile, $extraformatting) = @_;
-
- # Create an ordinary man page.
- my $parser = Pod::Man->new (center => "",
- date => "17 July 2004",
- release => "");
- $parser->parse_from_file ($0, $manfile);
-
- # If requested, perform some extra formatting to make the
- # documentation print nicer.
- return if !$extraformatting;
- my @formattedman;
- open (MANPAGE, "<$manfile") || die "open(\"$manfile\"): $!\n";
- while (<MANPAGE>) {
- s/LaTeX/L\\h'-0.36m'\\v'-0.15'\\s-2A\\s+2\\v'0.15'\\h'-0.15m'TeX/g;
- s/TeX/T\\h'-0.1667m'\\v'0.20'E\\v'-0.20'\\h'-0.125m'X/g;
- s/\\\*\(--/--/g;
- push @formattedman, $_;
- }
- close MANPAGE;
- open (MANPAGE, "| groff -man > $manfile") || die "open(\"$manfile\"): $!\n";
- print MANPAGE @formattedman;
- close MANPAGE;
-}
-
-###########################################################################
-
-# Parse the command line.
-my $wanthelp = 0;
-Getopt::Long::Configure ("bundling");
-GetOptions ("h|help" => \$wanthelp,
- "x|xscale=f" => \$xscale,
- "b|basename=s" => \$base,
- "k|skipfonts=s" => \@skipfonts,
- "e|extrafonts=s" => \@extrafonts,
- "m|extramaps=s" => \@extramaps,
- "P|config=s" => \@configexts,
- "c|clean" => \$cleanonly,
- "C|cleanfirst" => \$cleanfirst,
- "p|pdftex" => \$also_pdftex,
- "man=s" => sub {pod2man ($_[1], 0); exit 0},
- "man-ps=s" => sub {pod2man ($_[1], 1); exit 0},
- "v|verbose+" => \$verbose) || pod2usage (-verbose => 0,
- -exitval => 1);
-pod2usage (-verbose => $verbose,
- -exitval => 0) if $wanthelp;
-pod2usage (-verbose => 0,
- -exitval => 1) if $#ARGV==-1;
-$dvifile = $ARGV[0];
-
-# Get a list of fonts from the DVI file and from the command line.
-print "Acquiring font names from $dvifile\n" if $verbose;
-open (DVI, "dvitype $dvifile|") || die "open(): $!\n";
-my %uniquefonts;
-while (<DVI>) {
- /Font \d+: (\w+)/ && do {$uniquefonts{$1}=1};
-}
-close DVI;
-foreach (map {split /,/, $_} @extrafonts) {
- $uniquefonts{$_} = 1;
-}
-@fontlist = sort {$a cmp $b} keys %uniquefonts;
-my %skipfonts = map {($_ => 1)} map {split /,/, $_} @skipfonts;
-
-# If told to, delete generated files from previous runs.
-if ($cleanfirst || $cleanonly) {
- print "Deleting generated font files, configuration files, and font maps\n" if $verbose;
- my @old_fontlist = @fontlist;
- while (@fontlist) {
- my $fontname = shift @fontlist;
- if ($skipfonts{$fontname}) {
- print " Ignoring $fontname (as directed by the command line)\n" if $verbose>1;
- next;
- }
- thin_font ($fontname, "", ".vf", 1) if -e "$fontname.vf";
- foreach my $fsuffix (".vf", ".tfm") {
- if (-e "$fontname$fsuffix") {
- print " Removing $fontname$fsuffix\n" if $verbose>1;
- unlink "$fontname$fsuffix";
- }
- }
- }
- my @extra_deletes = ("config.$base", "$base.map");
- push (@extra_deletes, "pdftex.cfg") if $also_pdftex;
- foreach (@extra_deletes) {
- if (-e $_) {
- print " Removing $_\n" if $verbose>1;
- unlink $_;
- }
- }
- exit 0 if $cleanonly;
- @fontlist = @old_fontlist;
-}
-
-# Convert each font in turn.
-print "Creating *.tfm and *.vf files with ${xscale}X horizontal scaling\n" if $verbose;
-my %allfonts;
-while (@fontlist) {
- my $fontname = shift @fontlist;
- if ($skipfonts{$fontname}) {
- print " Ignoring $fontname (as directed by the command line)\n" if $verbose>1;
- next;
- }
- $allfonts{$fontname} = 1;
- if (-e (set_ext $fontname, ".vf") || -e (set_ext $fontname, ".tfm")) {
- print " Skipping $fontname (already converted)\n" if $verbose>1;
- if (-e set_ext $fontname, ".vf") {
- $fontname .= ".vf";
- }
- else {
- $fontname .= ".tfm";
- }
- my ($fname, $fpath, $fsuffix) = fileparse $fontname, "\.[^.]*";
- thin_font ($fname, $fpath, $fsuffix, 1); # Only search for new fonts.
- }
- else {
- # Use a .vf file if available. If not, then use the .tfm file.
- print " Processing $fontname\n" if $verbose>1;
- my ($fname, $fpath, $fsuffix);
- if (find_file "$fontname.vf") {
- ($fname, $fpath, $fsuffix) = fileparse find_file ("$fontname.vf"), ".vf";
- }
- elsif (find_file "$fontname.tfm") {
- ($fname, $fpath, $fsuffix) = fileparse find_file ("$fontname.tfm"), ".tfm";
- }
- else {
- die "${progname}: I don't know anything about $fontname\n";
- }
+EXECUTE {init.state.consts}
- # Convert the font.
- thin_font ($fname, $fpath, $fsuffix, 0);
- }
-}
+ITERATE {call.type$}
-# Acquire a list of .map files to process.
-print "Reading dvips configuration files (config.*)\n" if $verbose;
-foreach my $ext ("ps", @configexts) {
- my $configfile = find_file '--format="dvips config"', "config.$ext";
- die "${progname}: unable to find config.$ext\n" if !$configfile;
- print " Searching for map files in $configfile\n" if $verbose>1;
- open (CONFIGFILE, "<$configfile") || die "open(\"$configfile\"): $!\n";
- while (<CONFIGFILE>) {
- # Search for a PostScript font alias filename.
- chomp;
- s/\%.*//;
- next if !/^\s*p\s+(\+?)(\S+)/;
-
- # We found it -- adjust the list of .map files accordingly.
- @mapfiles=() if $1 eq "";
- my $map = find_file '--format="dvips config"', $2;
- die "${progname}: unable to find $2\n" if !$map;
- push @mapfiles, $map;
- }
- close CONFIGFILE;
-}
-
-# Merge the contents of all map files into @megamap.
-print "Reading font maps (*.map)\n" if $verbose;
-foreach my $mapfile ((map {split /,/, $_} @extramaps), @mapfiles) {
- print " Reading font mappings from $mapfile\n" if $verbose>1;
- open (MAPFILE, "<$mapfile") || die "open(\"$mapfile\"): $!\n";
- chomp (my @mappings = <MAPFILE>);
- close MAPFILE;
- push @megamap, @mappings;
-}
-
-# Create a dvips configuration file.
-print "Generating config.$base\n" if $verbose;
-open (CONFIG, ">config.$base") || die "open(\"config.$base\"): $!\n";
-print CONFIG <<"CONFIG_EOF";
-% This file can be freely modified. It can also be
-% redistributed, provided that it is not called "config.thin".
-p +$base.map
-CONFIG_EOF
-close CONFIG;
-
-# Create a dvips map file.
-print "Generating $base.map\n" if $verbose;
-open (FONTMAP, ">$base.map") || die "open(\"$base.map\"): $!\n";
-print FONTMAP <<'FONTMAP_EOF';
-% This file can be freely modified. It can also be
-% redistributed, provided that it is not called "thin.map".
-FONTMAP_EOF
-my $num_maps = 0;
-foreach my $fontname (sort {$a cmp $b} keys %allfonts) {
- my $remapping = remap_font $fontname;
- if ($remapping) {
- print FONTMAP $remapping, "\n";
- print " Wrote mapping for $fontname\n" if $verbose>1;
- $num_maps++;
- }
- elsif (! -e "$fontname.vf") {
- warn "${progname}: warning: no mapping was found for $fontname\n";
- }
-}
-close FONTMAP;
-warn "${progname}: warning: no fonts were written to $base.map\n" if !$num_maps;
-
-# Create a pdfTeX config file.
-if ($also_pdftex) {
- print "Generating pdftex.cfg\n" if $verbose;
- unlink "pdftex.cfg";
- my $pdfcfg = find_file "--progname=pdftex", "pdftex.cfg";
- die "${progname}: unable to find pdftex.cfg\n" if !$pdfcfg;
- open (INCONFIG, "<$pdfcfg") || die "open(\"$pdfcfg\"): $!\n";
- open (OUTCONFIG, ">pdftex.cfg") || die "open(\"pdftex.cfg\"): $!\n";
- while (<INCONFIG>) {
- next if /^\s*map\s/; # Discard all map lines.
- print OUTCONFIG $_;
- }
- print OUTCONFIG "\n% The next line was added by $progname.\n";
- print OUTCONFIG "map $base.map\n";
- close OUTCONFIG;
- close INCONFIG;
+FUNCTION {end.bib}
+{ newline$
+ "\end{thebibliography}" write$ newline$
}
-###########################################################################
-
-__END__
-
-=head1 NAME
-
-makethin - make thinner versions of PostScript fonts for TeX
-
-
-=head1 SYNOPSIS
-
-makethin
-[B<--verbose>]
-[B<--xscale>=I<factor>]
-[B<--cleanfirst>]
-[B<--clean>]
-[B<--config>=I<extension>]
-[B<--pdftex>]
-[B<--extramaps>=I<file>[,I<file>]...]
-[B<--skipfonts>=I<font>[,I<font>]...]
-[B<--basename>=I<string>]
-[B<--extrafonts>=I<font>[,I<font>]...]
-I<.dvi file>
-
-makethin
-[B<--verbose>]
-B<--help>
-
-makethin
-B<--man>=I<man page> | B<--man-ps>=I<PostScript file>
-
-
-
-=head1 DESCRIPTION
-
-B<makethin> produces thinner versions of PostScript fonts for use with
-TeX/LaTeX and Dvips. More precisely, it finds all of the F<.tfm>
-and F<.vf> fonts referred to by a F<.dvi> file, scales the
-character-width metrics by a given amount, and writes new F<.tfm> and
-F<.vf> files to the current directory. B<makethin> then generates a
-customized F<.map> and F<config> file for Dvips and, optionally, a
-customized F<pdftex.cfg> file for pdfLaTeX.
-
-The general procedure for using B<makethin> is as follows:
-
-=over 4
-
-=item 1.
-
-Run B<latex> on your F<.tex> source file to produce a F<.dvi> file.
-
-=item 2.
-
-Run B<makethin> on the F<.dvi> file to create new F<.tfm>, F<.vf>,
-F<.map>, and F<config> files.
-
-=item 3.
-
-Re-run B<latex> on your F<.tex> source file to typeset it with the new
-fonts.
-
-=item 4.
-
-Run B<dvips> on the F<.dvi> file, specifying the newly generated
-F<.map> and F<config> files, to produce a F<.ps> file.
-
-=back
-
-
-=head1 OPTIONS
-
-The following are the command-line options that B<makethin> accepts:
-
-=over 4
-
-=item B<-v>, B<--verbose>
-
-Increase the verbosity of the status output. B<--verbose> can be
-specified multiple times on the same command line, with each
-B<--verbose> futher increasing the verbosity. (Currently, two
-B<--verbose>s have maximal impact.)
-
-=item B<-h>, B<--help>
-
-Display basic usage information. When combined with B<--verbose>,
-additionally describes each of the command-line options. When
-combined with a second B<--verbose>, B<--help> outputs the complete
-B<makethin> manual page.
-
-=item B<-x> I<factor>, B<--xscale>=I<factor>
-
-Scale fonts horizontally by a factor of I<factor>. The default,
-C<0.5>, produces nearly illegible fonts but is useful for verifying
-that B<makethin> actually worked. Factors of C<0.90>-C<0.99> are more
-reasonable.
-
-=item B<-C>, B<--cleanfirst>
-
-Delete all files generated by a previous run of B<makethin> before
-generating new ones.
-
-=item B<-c>, B<--clean>
-
-Delete all files generated by a previous run of B<makethin> and then
-exit.
-
-=item B<-P> I<extension>, B<--config>=I<extension>
-
-Process all of the F<.map> files named in F<config.>I<extension>
-(found in Dvips's configuration directory). B<--config> can be
-specified multiple times on the same command line. F<config.ps> is
-processed implicitly. The same B<-P> arguments that you would
-normally pass to B<dvips> to utilize entirely PostScript fonts (e.g.,
-B<-Pcmz> and B<-Pamz>) should also be passed to B<makethin>.
-
-=item B<-p>, B<--pdftex>
-
-In addition to producing the files needed by Dvips, also produce a
-F<pdftex.cfg> file that is usable by pdfLaTeX.
-
-=item B<-m> I<file>[,I<file>]...], B<--extramaps>=I<file>[,I<file>]...]
-
-Additionally process the named Dvips F<.map> files even if they're
-not referred to by any of the F<config.>I<extension> files specified
-with B<--config>. B<--extramaps> can be specified multiple times on
-the same command line.
-
-=item B<-k> I<font>[,I<font>]...], B<--skipfonts>=I<font>[,I<font>]...]
-
-Don't make thin versions of the named fonts, even if they're listed in
-the F<.dvi> file. Fonts are named using the Berry scheme (i.e.,
-``C<pcrr8a>'' as opposed to ``C<COURB>'' or ``C<Courier-Bold>'').
-B<--skipfonts> can be specified multiple times on the same command
-line.
-
-=item B<-b> I<string>, B<--basename>=I<string>
-
-Tell B<makethin> to use I<string> as the base name for the Dvips
-configuration files it generates. The default is ``C<thin>'', so
-B<makethin> normally produces files named F<config.thin> and
-F<thin.map>, but B<--basename> enables alternate filenames to be used.
-
-=item B<-e> I<font>[,I<font>]...], B<--extrafonts>=I<font>[,I<font>]...]
-
-Make thin versions of the named fonts, even if they're not listed in
-the F<.dvi> file. Fonts are named using the Berry scheme (i.e.,
-``C<pcrr8a>'' as opposed to ``C<COURB>'' or ``C<Courier-Bold>'').
-B<--extrafonts> can be specified multiple times on the same command
-line.
-
-=item B<--man>=I<man page>
-
-Create a Unix manual page for B<makethin> in the standard, *roff
-format. Typical usage is:
-
- makethin --man=/usr/man/man1/makethin.1
-
-=item B<--man-ps>=I<PostScript file>
-
-Create a Unix manual page for B<makethin> in PostScript format instead
-of *roff format.
-
-=back
-
-In addition to the options listed above, B<makethin> has a required
-argument, which is the name of a F<.dvi> file from which to read font
-information.
-
-
-=head1 EXAMPLES
-
-The following are some examples of how to use B<makethin>.
-
-=head2 A typical case
-
-First, we need to produce F<myfile.dvi>, because that contains the
-font information that B<makethin> will read:
-
- latex myfile.tex
-
-Next, we invoke B<makethin>, telling it to process F<config.cmz>
-(which, in turn, causes F<psfonts.cmz> to be processed), This tells
-B<makethin> to use PostScript versions of the Computer Modern fonts
-instead of bitmapped versions. (B<makethin> can scale only PostScript
-fonts.) We also specify maximal verbosity:
-
- makethin -Pcmz --verbose --verbose myfile.dvi
-
-The preceding line reads F<config.ps>, F<config.cmz>, various map
-files, such as F<psfonts.map> and F<psfonts.cmz>, and all of the
-F<.tfm> and F<.vf> files mentioned in F<myfile.dvi>. It then writes
-F<config.thin>, F<thin.map>, and modified versions of all of the
-F<.tfm> and F<.vf> files to the current directory.
-
-We now need to re-run B<latex>, so it can produce a new F<myfile.dvi>
-using the thinner metrics listed in the current directory's F<.tfm>
-and F<.vf> files:
-
- latex myfile.tex
-
-Finally, we produce a PostScript file using the newly generated using
-F<config.thin> and F<thin.map> files:
-
- dvips -Pthin myfile.dvi -o myfile.ps
-
-If all worked according to plan, F<myfile.ps> should be typeset using
-extremely thin (half-width) versions of its original fonts.
-
-
-=head2 Producing thin fonts for use in pdfLaTeX
-
-Because B<makethin> can read only F<.dvi> files, not F<.pdf> files, we
-first need to produce a F<.dvi> file:
-
- latex too-long.tex
-
-F<too-long.dvi> is typeset entirely using the Times family of fonts.
-Therefore, we don't need to specify B<-Pcmz>. However, B<pdflatex>
-normally embeds Times, thereby precluding B<makethin>'s ability to
-scale it. (B<makethin> requires a F<.pfb> font file in order to scale
-the corresponding font.) Fortunately,
-F</usr/share/texmf/dvips/config/ar-std-urw-kb.map> already contains
-the proper mapping of TeX names to F<.pfb> files for Times, Courier,
-and Helvetica. We can tell B<makethin> to use that file:
-
- makethin --cleanfirst -v -v too-long.dvi --pdftex --xscale=0.9
- --extramaps=/usr/share/texmf/dvips/config/ar-std-urw-kb.map
-
-In the preceding line, we changed the scaling factor from the default
-of 0.5 to a more reasonable 0.9. Because we had some 0.5-scaled
-F<.tfm> and F<.vf> files left over from the previous example, we
-specified B<--cleanfirst> to delete those old font files. We
-specified B<--pdftex> to make B<makethin> produce a local
-F<pdftex.cfg> file. And we told B<makethin> where to find the extra
-map file needed to force the usage of F<.pfb> files.
-
-All that's left is to run B<pdflatex> to produce a F<.pdf> file:
-
- pdflatex too-long.tex
-
-B<pdflatex> will read the font metric files (F<.tfm> and F<.vf>) and
-F<pdftex.cfg> from the current directory. This will tell it to load
-F<thin.map>, which specifies the scaling factor. The result should be
-a document with each character squeezed to 90% of its original width.
-
-
-=head1 FILES
-
-=over 4
-
-=item B<perl>
-
-interpreter/compiler needed to run the B<makethin> script
-
-=item B<kpsewhich>
-
-finds files within the TeX directory tree
-
-=item B<dvitype>
-
-outputs the typesetting commands contained within a F<.dvi> file
-
-=item F<*.tfm> and F<*.vf>
-
-TeX font metrics and virtual fonts--metrics specifying the width of
-each character in a font
-
-=item F<config.*>
-
-Dvips configuration files, each containing (among other
-information) a list of font-map files
-
-=item F<psfonts.*>, F<*.map>
-
-Dvips font-map files, which map TeX font names to PostScript font
-names and F<.pfb> files
-
-=item F<pdftex.cfg>
-
-pdfTeX and pdfLaTeX configuration files, each containing (among other
-information) a list of font-map files
-
-=item B<groff>
-
-used by B<--man-ps> to produce a PostScript version of the Unix manual
-page for B<makethin>
-
-=back
-
-
-=head1 RESTRICTIONS
-
-The most serious restriction is that B<makethin> doesn't work on
-Computer Modern Roman 10pt. (F<cmr10>)--the default TeX/LaTeX font.
-The reason, I believe, is that TeX and LaTeX preload that font's
-metrics (F<cmr10.tfm>) and therefore ignore the scaled F<cmr10.tfm> on
-disk. It may be possible to work around this limitation by copying
-F<cmr10.tfm> to a new name and convincing LaTeX to use that name where
-it would otherwise have used F<cmr10.tfm>. However, it's much easier
-merely to use a different font family (e.g., with
-``C<\usepackage{times}>'') for typesetting your document when you know
-you want to run B<makethin>.
-
-
-=head1 SEE ALSO
-
-dvips(1),
-latex(1),
-pdflatex(1),
-the LaTeX C<savetrees> package
-
-
-=head1 AUTHOR
-
-Scott Pakin, I<scott+st@pakin.org>
-%VERBATIM_PERL
+EXECUTE {end.bib}
% \end{macrocode}
% \fi
%
% \begin{macrocode}
-%</makethin>
+%</bibstyle>
% \end{macrocode}
%
% \Finale
diff --git a/Master/texmf-dist/source/latex/savetrees/savetrees.ins b/Master/texmf-dist/source/latex/savetrees/savetrees.ins
index 65203ff148f..85aa16ed63c 100644
--- a/Master/texmf-dist/source/latex/savetrees/savetrees.ins
+++ b/Master/texmf-dist/source/latex/savetrees/savetrees.ins
@@ -1,5 +1,5 @@
%%
-%% 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
@@ -25,7 +25,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
@@ -69,19 +69,10 @@ End of customized bst file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%----- Prepend nothing to makethin -----%
-
-\generate{\usepreamble\empty
- \usepostamble\empty
- \file{makethin.pl}%
- {\from{savetrees.dtx}{makethin}}}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
\obeyspaces
\Msg{******************************************************************}
\Msg{* *}
-\Msg{* To finish the installation you have to move the following *}
+\Msg{* To finish the installation you need to move the following *}
\Msg{* file into a directory searched by TeX: *}
\Msg{* *}
\Msg{* \space\space savetrees.sty *}
@@ -90,16 +81,6 @@ End of customized bst file
\Msg{* *}
\Msg{* \space\space savetrees.bst *}
\Msg{* *}
-\Msg{* and the following file into a directory in your executable *}
-\Msg{* search path: *}
-\Msg{* *}
-\Msg{* \space\space makethin.pl *}
-\Msg{* *}
-\Msg{* If you're on a Unix system, you may want to rename *}
-\Msg{* makethin.pl to simply makethin.\space\space You will need to make *}
-\Msg{* the script executable with "chmod +x makethin".\space\space Also, a Unix *}
-\Msg{* man page can be generated with "makethin --man=makethin.1". *}
-\Msg{* *}
\Msg{* To produce the documentation, run the file savetrees.dtx *}
\Msg{* through LaTeX (twice, to get the references correct). *}
\Msg{* *}
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
%%