From 1436604c912a222eb97ca0668b29a50bac05ea3d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 21 Dec 2014 00:01:48 +0000 Subject: savetrees (20dec14) git-svn-id: svn://tug.org/texlive/trunk@35871 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/savetrees/savetrees.dtx | 265 ++++++++++++++++++--- .../source/latex/savetrees/savetrees.ins | 26 +- 2 files changed, 252 insertions(+), 39 deletions(-) (limited to 'Master/texmf-dist/source/latex/savetrees') diff --git a/Master/texmf-dist/source/latex/savetrees/savetrees.dtx b/Master/texmf-dist/source/latex/savetrees/savetrees.dtx index 06f3ac51621..11737e59429 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) 2013 by Scott Pakin +% Copyright (C) 2014 by Scott Pakin % ------------------------------------------------------ % % This file may be distributed and/or modified under the @@ -16,14 +16,16 @@ % \fi % % \iffalse +%\ProvidesFile{savetrees.bbx} +%\ProvidesFile{savetrees.cbx} +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%\ProvidesPackage{savetrees} %<*driver> \ProvidesFile{savetrees.dtx} % -%\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%\ProvidesPackage{savetrees} -%<*package> - [2013/04/09 v2.1 Pack as much text as possible onto each page] -% +%<*package|bbxfile|cbxfile> + [2014/12/19 v2.3 Pack as much text as possible onto each page] +% % %<*driver> \documentclass{ltxdoc} @@ -40,6 +42,22 @@ \usepackage[tracking]{microtype} \SetExpansion[context=tightcharwidths,stretch=0,shrink=55]{encoding=*,shape=*}{} \usepackage{hyperref} +\usepackage{hyperxmp} +\hypersetup{% + pdftitle={The savetrees package}, + pdfauthor={Scott Pakin}, + pdfsubject={Reduce a LaTeX document's page count by adjusting the formatting}, + pdfkeywords={LaTeX, reduce document size, margins, whitespace, page count}, + pdfcopyright={Copyright (C) \the\year, Scott Pakin}, + pdflicenseurl={http://www.latex-project.org/lppl.txt}, + pdfcaptionwriter={Scott Pakin}, + pdfcontactregion={New Mexico}, + pdfcontactcountry={USA}, + pdfcontactemail={scott+st@pakin.org}, + pdfcontacturl={http://www.pakin.org/\xmptilde scott/}, + baseurl={http://mirror.ctan.org/macros/latex/contrib/savetrees/savetrees.pdf}, + pdflang={en-US} +} \EnableCrossrefs \CodelineIndex \setcounter{IndexColumns}{2} @@ -62,7 +80,7 @@ % % \fi % -% \CheckSum{484} +% \CheckSum{527} % % \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 @@ -82,6 +100,9 @@ % % % \changes{v1.0}{2002/07/06}{Initial version} +% \changes{v2.2}{2014/02/19}{Disabled \textsf{tracking}'s effect +% except when called from pdf\LaTeX, and disabled \textsf{charwidths}'s +% effect except when called from either pdf\LaTeX\ or Lua\LaTeX} % % \GetFileInfo{savetrees.dtx} % @@ -365,6 +386,10 @@ % Option & Space-saving technique & Implementation \\ % \midrule % +% \pkgoption{bibbreaks} +% & Allow page breaks within bibliographic entries. +% & Redefine Biblatex's \texttt{\string\bibsetup} hook. \\ +% % \pkgoption{paragraphs} % & Discourage \TeX\ from allowing the last line of a paragraph to % contain only a single word. @@ -406,7 +431,8 @@ % % \pkgoption{bibnotes} % & Ignore \texttt{NOTE} fields in the bibliography. -% & Pass information to |savetrees.bst|. \\ +% & Pass information to |savetrees.bst| (\BibTeX) or |savetrees.bbx| +% (Biblatex). \\ % % \pkgoption{charwidths} % & Allow character glyphs to be drawn slightly narrower than @@ -452,7 +478,7 @@ % \pkgoption{bibliography} % & Typeset the bibliography in a smaller font and with no inter-item % spacing. -% & Redefine \texttt{thebibliography}. \\ +% & Redefine \texttt{thebibliography}, |\bibfont|, and |\bibitemsep|. \\ % % \pkgoption{title} % & Typeset the document title with smaller fonts and with less @@ -585,7 +611,7 @@ % % \section{Abbreviating bibliographic information} % -% One of the advantages of a tool like \BibTeX{} is that the +% 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. @@ -686,8 +712,26 @@ % 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|. +% \bigskip +% +% In addition to |savetrees.bst|, \pkgname{savetrees} provides analogous +% Biblatex style files: |savetrees.bbx| and |savetrees.cbx|. Like their +% \BibTeX\ counterpart, they use abbreviated terms whenever possible, +% list at most two authors before truncating them with ``et~al.'', and +% abbreviate authors' names to initials plus surname. +% +% To use the \pkgname{savetrees} Biblatex style files, simply load +% \pkgname{biblatex} with ``|\usepackage[style=savetrees]{biblatex}|''. +% By default, the bibliography style suppresses the |isbn| |url|, |doi|, +% and |eprint| fields from typesetting, but these can be re-enabled +% explicitly: +% +% \begin{verbatim} +% \usepackage[style=savetrees,isbn,url,doi,eprint]{biblatex} +% \end{verbatim} +% +% The \pkgname{savetrees} \BibTeX\ and Biblatex style files can be +% used independently of |savetrees.sty|. % % % \changes{v2.0}{2011/05/03}{Removed the awkward-to-use @@ -926,9 +970,9 @@ % teaching instrument for \LaTeX{} newcomers who want to learn more % about fine-tuning document formatting. % -% \begin{macrocode} +% \iffalse %<*package> -% \end{macrocode} +% \fi % % \subsection{Default values} % @@ -1026,6 +1070,13 @@ \RequirePackage{xkeyval} % \end{macrocode} % +% \pkgname{savetrees} uses the \pkgname{ifpdf} and \pkgname{ifluatex} +% packages to control the use of the \pkgname{microtype} package. +% \begin{macrocode} +\RequirePackage{ifpdf} +\RequirePackage{ifluatex} +% \end{macrocode} +% % \begin{macro}{\st@more@packages} % \begin{macro}{\st@RequirePackage} % As we process the package options we may encounter additional packages @@ -1308,6 +1359,21 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\if@st@tight@bibbreaks} +% \begin{macro}{\@st@tight@bibbreakstrue} +% \begin{macro}{\@st@tight@bibbreaksfalse} +% \begin{macro}{\KV@savetrees@bibbreaks} +% The \pkgoption{bibbreaks} package option allows Biblatex to break +% pages within bibliographic items. +% \begin{macrocode} +\st@define@option{bibbreaks} +% \end{macrocode} +% \pkgoptiondecl{bibbreaks} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\if@st@tight@mathspacing} % \begin{macro}{\@st@tight@mathspacingtrue} % \begin{macro}{\@st@tight@mathspacingfalse} @@ -1369,6 +1435,7 @@ \@st@tight@wordspacingtrue \@st@tight@bibliographytrue \@st@tight@bibnotestrue + \@st@tight@bibbreakstrue \@st@tight@mathspacingtrue \@st@tight@mathdisplaystrue \else @@ -1385,6 +1452,7 @@ \@st@tight@wordspacingfalse \@st@tight@bibliographyfalse \@st@tight@bibnotesfalse + \@st@tight@bibbreaksfalse \@st@tight@mathspacingfalse \@st@tight@mathdisplaysfalse \fi @@ -1413,7 +1481,8 @@ floats=tight, mathspacing=tight, wordspacing=tight, - tracking=tight + tracking=tight, + bibbreaks=tight }% } \DeclareOptionX{subtle}{\KV@savetrees@subtle} @@ -1870,11 +1939,13 @@ % white space. \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\%. -% +% than~0\%. At the time of this writing, this feature works only with +% pdf\LaTeX\ and Lua\LaTeX. % \begin{macrocode} \if@st@tight@charwidths - \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype} + \ifpdf + \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype} + \fi \fi % \end{macrocode} % @@ -1887,11 +1958,17 @@ % 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. +% percent of an em~width between \emph{every} pair of characters. At +% the time of this writing, this feature works only with pdf\LaTeX. % % \begin{macrocode} \if@st@tight@tracking - \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype} + \ifpdf + \ifluatex + \else + \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype} + \fi + \fi \fi % \end{macrocode} % @@ -1985,22 +2062,42 @@ % \begin{macrocode} \small % \end{macrocode} -% We finish up using the original code. +% We finish up using the original code, except we reduce the club and +% widow penalties from~4000 to~150. +% \changes{v2.3}{2014/12/19}{Reduced club and widow penalties from~4000 to~150} % \begin{macrocode} \sloppy - \clubpenalty4000 + \clubpenalty150 \@clubpenalty \clubpenalty - \widowpenalty4000% + \widowpenalty150% \sfcode`\.\@m }{% \def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist } -\fi % \end{macrocode} % \end{environment} % +% \changes{v2.3}{2014/12/19}{Made \protect\texttt{bibliography!=tight} work with +% Biblatex, not just \protect\BibTeX} +% \begin{macro}{\bibfont} +% \begin{macro}{\bibitemsep} +% If the \pkgname{biblatex} package was loaded we use Biblatex's +% mechanisms for reducing the font size to |\small| (|\bibfont|) and +% for omitting blank lines between bibliographic entries (|\bibitemsep|). +% \begin{macrocode} + \AtBeginDocument{% + \@ifundefined{bibfont}{}{% + \renewcommand*{\bibfont}{\normalfont\small}% + \bibitemsep=0pt plus 2pt\relax + }% + }% +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% % % \subsection{Bibliographic notes} % \label{sec:bibliographic-notes} @@ -2029,6 +2126,41 @@ % \labelprevcodeline{code:stbn-end} % \end{macro} % +% \subsection{Page breaks within bibliographies} +% \label{sec:bibliographic-breaks} +% +% The Biblatex package strongly discourages \TeX\ from breaking pages +% within a bibliographic entry. Instead, \TeX\ is told to favor pushing +% an entire bibliographic entry onto the next page. Setting +% |bibbreaks=tight| changes Biblatex's behavior to allow page breaks to +% appear anywhere in a bibliography. The setting has no effect on +% \BibTeX, only Biblatex. +% \changes{v2.3}{2014/12/19}{Added support for allowing page breaks +% within Biblatex bibliographies} +% \labelnextcodeline{code:stbb-begin} +% \begin{macrocode} +\if@st@tight@bibbreaks + \AtBeginDocument{% + \@ifundefined{bibsetup}{}{% +% \end{macrocode} +% \begin{macro}{\bibsetup} +% The \pkgname{biblatex} package was loaded. Redefine its |\bibsetup| hook. +% \begin{macrocode} + \renewcommand*{\bibsetup}{% + \interlinepenalty=100\relax + \widowpenalty=100\relax + \clubpenalty=100\relax + \raggedbottom + \frenchspacing + \biburlsetup + }% + }% + }% +\fi +% \end{macrocode} +% \end{macro} +% \labelprevcodeline{code:stbb-end} +% % \subsection{Mathematical expressions} % \label{sec:math-exprs} % @@ -2072,12 +2204,12 @@ \fi % \end{macrocode} % -% \begin{macrocode} +% \iffalse % -% \end{macrocode} +% \fi % % -% \section{Implementation of \texttt{savetrees.bst}} +% \section{Implementation of the \texorpdfstring{\BibTeX}{BibTeX} style file} % \label{sec:savetrees.bst} % % In addition to a \LaTeXe{} style, the \pkgname{savetrees} package also @@ -2098,9 +2230,9 @@ % source code in this document. Rather, only the hand-modified parts are % presented below. % -% \begin{macrocode} -%<*bibstyle> -% \end{macrocode} +% \iffalse +%<*bstfile> +% \fi % % \begin{center} % $\vdots$ \\ @@ -3560,9 +3692,80 @@ EXECUTE {end.bib} % \end{macrocode} % \fi % +% \iffalse +% +% \fi +% +% +% \section{Implementation of the Biblatex style files} +% \label{sec:savetrees-biblatex} +% +% We define an analogue of |savetrees.bst| (\ref{sec:savetrees.bst}) for +% Biblatex. This comprises two files: a bibliography style, +% |savetrees.bbx| (\ref{sec:savetrees.bbx}), and a citation style, +% |savetrees.cbx| (\ref{sec:savetrees.cbx}). +% +% \subsection{Implementation of \texttt{savetrees.bbx}} +% \label{sec:savetrees.bbx} +% +% Biblatex's default |numeric-comp| bibliography style is already fairly +% abbreviated so we begin with that and merely make a few changes to +% reduce the number of authors before ``et~al.''\ kicks in; use initials +% for all given and middle names,; suppress typesetting ISBNs, URLs, +% DOIs, and eprint IDs; and honor \pkgname{savetrees}'s |bibnotes| +% option. +% +% \changes{v2.3}{2014/12/19}{Included style files for Biblatex} +% +% \iffalse +%<*bbxfile> +% \fi +% +% \begin{macrocode} +\RequireBibliographyStyle{numeric-comp} + +\ExecuteBibliographyOptions{% + maxnames = 2, + minnames = 2, + firstinits = true, + isbn = false, + url = false, + doi = false, + eprint = false +} + +\AtBeginDocument{% + \@ifundefined{if@st@tight@bibnotes}{}{% + \if@st@tight@bibnotes + \DeclareFieldFormat{note}{}% + \fi + }% +} +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% +% \subsection{Implementation of \texttt{savetrees.cbx}} +% \label{sec:savetrees.cbx} +% +% The corresponding |savetrees.cbx| citation style is even more trivial +% than |savetrees.bbx|. It simply defines itself as an alias for +% Biblatex's standard |numeric-comp| citation style. +% +% \iffalse +%<*cbxfile> +% \fi +% % \begin{macrocode} -% +\RequireCitationStyle{numeric-comp} % \end{macrocode} % +% \iffalse +% +% \fi +% % \Finale \endinput diff --git a/Master/texmf-dist/source/latex/savetrees/savetrees.ins b/Master/texmf-dist/source/latex/savetrees/savetrees.ins index 2d75cbaca67..ec2677191dc 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) 2013 by Scott Pakin +%% Copyright (C) 2014 by Scott Pakin %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3c of this license @@ -19,13 +19,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%----- Prepend Scott Pakin's copyright to savetrees.sty -----% +%----- Prepend Scott Pakin's copyright to savetrees.sty, -----% +%----- savetrees.bbx, and savetrees.cbx -----% \preamble This is a generated file. -Copyright (C) 2013 by Scott Pakin +Copyright (C) 2014 by Scott Pakin This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license @@ -40,7 +41,11 @@ and version 1.3c or later is part of all distributions of LaTeX version \endpreamble \generate{\file{savetrees.sty}% - {\from{savetrees.dtx}{package}}} + {\from{savetrees.dtx}{package}} + \file{savetrees.bbx}% + {\from{savetrees.dtx}{bbxfile}} + \file{savetrees.cbx}% + {\from{savetrees.dtx}{cbxfile}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -65,7 +70,7 @@ End of customized bst file \endpostamble \generate{\file{savetrees.bst}% - {\from{savetrees.dtx}{bibstyle}}} + {\from{savetrees.dtx}{bstfile}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -75,11 +80,16 @@ End of customized bst file \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 *} +\Msg{* savetrees.sty *} \Msg{* *} -\Msg{* and the following file into a directory searched by BibTeX: *} +\Msg{* the following file into a directory searched by BibTeX: *} \Msg{* *} -\Msg{* \space\space savetrees.bst *} +\Msg{* savetrees.bst *} +\Msg{* *} +\Msg{* and the following files into directories searched by Biblatex: *} +\Msg{* *} +\Msg{* savetrees.bbx *} +\Msg{* savetrees.cbx *} \Msg{* *} \Msg{* To produce the documentation, run the file savetrees.dtx *} \Msg{* through LaTeX (twice, to get the references correct). *} -- cgit v1.2.3