% \iffalse meta-comment % % Copyright (C) 2016 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 or (at your option) any later version. % The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % % and version 1.3c or later is part of all distributions of LaTeX % version 2006/05/20 or later. % % \fi % % \iffalse %\ProvidesFile{savetrees.bbx} %\ProvidesFile{savetrees.cbx} %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{savetrees} %<*driver> \ProvidesFile{savetrees.dtx} % %<*package|bbxfile|cbxfile> [2016/04/13 v2.4 Pack as much text as possible onto each page] % % %<*driver> \documentclass{ltxdoc} \usepackage{array} \usepackage{dcolumn} \usepackage{tabularx} \usepackage{booktabs} \usepackage{topcapt} \usepackage{changepage} \usepackage{calc} \usepackage{varioref} \usepackage{needspace} \usepackage[format=hang,justification=raggedright]{subfig} \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} \RecordChanges \begin{document} \DocInput{savetrees.dtx} \Needspace{10\baselineskip} \phantomsection\addcontentsline{toc}{section}{Change History} \PrintChanges \makeatletter \let\orig@index@prologue=\index@prologue \def\index@prologue{% \phantomsection\addcontentsline{toc}{section}{Index} \orig@index@prologue }% \makeatother \Needspace{12\baselineskip} \PrintIndex \end{document} % % \fi % % \CheckSum{528} % % \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 % Lower-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 % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % \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} % % \DoNotIndex{\.,\@arabic,\@author,\@biblabel,\@clubpenalty,\@date,\@empty} % \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 ---------------------------------------------------------------------- % % \title{The \textsf{savetrees} package\thanks{This document % corresponds to \textsf{savetrees}~\fileversion, dated \filedate.}} % \author{Scott Pakin \\ \texttt{scott+st@pakin.org}} % % ^^A Define macros for typesetting/indexing package and program names. % \DeclareRobustCommand{\pkgname}[1]{^^A % \textsf{#1}^^A % \index{#1 (package)\actualchar\string\textsf{#1} (package)\encapchar usage}^^A % \index{packages:\levelchar#1\actualchar^^A % \string\textsf{#1}\encapchar usage}^^A % } % \DeclareRobustCommand{\progname}[1]{^^A % \texttt{#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 % } % % ^^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}[4][\lipsumtext]{^^A % \begin{figure}[htbp] % \savebox{\normalbox}{^^A % \fbox{^^A % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A % #1 % \end{minipage}}}^^A % \subfloat[\texttt{#2=normal}]{^^A % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A % \usebox{\normalbox}}^^A % \hfill % \subfloat[\texttt{#2=tight}]{^^A % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A % \fbox{^^A % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A % #3#1#4^^A % \end{minipage}}}^^A % \caption{Effect of the \texttt{#2} option} % \label{fig:ex-#2} % \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 % possible onto each page of a \LaTeX{} document. Admittedly, this % makes the document far less attractive. Nevertheless, % \pkgname{savetrees} provides a simple way to save paper when printing % draft copies of a document. It can also be useful when trying to meet % a tight page-length requirement. For example, consider the difference % between % % \savebox{\normalbox}{^^A % \fbox{^^A % \begin{minipage}[t]{\linewidth-2cm}^^A % \lipsumtext % \end{minipage}}^^A % } % \begin{center} % \usebox{\normalbox} % \end{center} % % \noindent % and % % \newlength{\oldwordspacing} % \setlength{\oldwordspacing}{\fontdimen2\font} % \begin{center} % \renewcommand{\baselinestretch}{0.95}^^A % \fbox{^^A % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A % \begin{minipage}[t]{\linewidth-2cm}^^A % \begin{microtypecontext}{expansion=tightcharwidths}^^A % \SetTracking{encoding=*,shape=*}{-25}^^A % \lsstyle % \fontdimen2\font=0.75\oldwordspacing % \lipsumtext % \end{microtypecontext}^^A % \end{minipage}}^^A % \end{center} % % The former (default) layout looks nicer, but the latter consumes % approximately~10\% less space. % % \bigskip % % The easiest way to use \pkgname{savetrees} is simply to place one of % the following in your document's preable: % % \begin{itemize} % \item |\usepackage[subtle]{savetrees}| % \item |\usepackage[moderate]{savetrees}| % \item |\usepackage[extreme]{savetrees}| % \end{itemize} % % The first option, \pkgoption{subtle}, preserves all document layout % and merely encourages \LaTeX\ to try harder to pack text onto the page % while introducing white space only when absolutely necessary. The % second option, \pkgoption{moderate}, additionally reduces paragraph % indentation, typesets lists and mathematical displays without % indentation or surrounding vertical space, reduces interline spacing, % and makes the font slightly narrower, if supported. The third option, % \pkgoption{extreme}, which is in fact the default if no package % options are specified, turns on all of the space-saving techniques in % \pkgname{savetrees}'s repertoire, including using smaller title and % section fonts, typesetting the bibliography with a smaller font and no % inter-item spacing, and substantially reducing the page margins. For % a demonstration of these package options, see the accompanying % \href[pdfnewwindow]{st-sample2e.pdf}{\texttt{st-sample2e.pdf}} file, % which presents Lamport's ``An Example Document'' typeset both normally % and with each of \pkgname{savetrees}'s \pkgoption{subtle}, % \pkgoption{moderate}, and \pkgoption{extreme} options. % % The following section describes those and the rest of % \pkgname{savetrees}'s space-saving capabilities in more detail. % % % \section{Usage} % % \vrefrange{tbl:st-opts-subt}{tbl:st-opts-ext} describe % \pkgname{savetrees}'s main package options and summarize 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. % % \newlength{\implwidth} % \settowidth{\implwidth}{and \texttt{\string\belowdisplayshortskip}.} % \begin{table} % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt} % \centering % \topcaption{\pkgname{savetrees} package options for enabling/disabling % space-saving techniques (\texttt{subtle})} % \label{tbl:st-opts-subt} % \renewcommand{\arraystretch}{2} % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}} % \toprule % 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. % & Reassign |\looseness|. \\ % % \pkgoption{floats} % & Relax float placement (more floats per page, increased ability to % share pages with text, etc.). % & Reassign \LaTeXe{} float variables. \\ % % \pkgoption{mathspacing} % & Reduce the amount of space within mathematical expressions. % & Reassign |\thinmuskip|, |\medmuskip|, and |\thickmuskip|. \\ % % \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. \\ % % \bottomrule % \end{tabularx} % \end{adjustwidth} % \end{table} % % \begin{table} % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt} % \centering % \topcaption{\pkgname{savetrees} package options for enabling/disabling % space-saving techniques (\texttt{moderate})} % \label{tbl:st-opts-mod} % \renewcommand{\arraystretch}{2} % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}} % \toprule % Option & Space-saving technique & Implementation \\ % \midrule % % \pkgoption{bibnotes} % & Ignore \texttt{NOTE} fields in the bibliography. % & Pass information to |savetrees.bst| (\BibTeX) or |savetrees.bbx| % (Biblatex). \\ % % \pkgoption{charwidths} % & Allow character glyphs to be drawn slightly narrower than % normal. % & Pass options to the \pkgname{microtype} package. \\ % % \pkgoption{mathdisplays} % & Reduce the amount of vertical space surrounding displayed mathematics. % & Reassign |\abovedisplayskip|, |\belowdisplayskip|, % |\abovedisplayshortskip|, and |\belowdisplayshortskip|. \\ % % \pkgoption{leading} % & Reduce interline spacing. % & Reassign |\baselinestretch|. \\ % % \pkgoption{indent} % & Decrease paragraph indentation. % & Reassign |\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. \\ % % \bottomrule % \end{tabularx} % \end{adjustwidth} % \end{table} % % \begin{table} % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt} % \centering % \topcaption{\pkgname{savetrees} package options for enabling/disabling % space-saving techniques (\texttt{extreme})} % \label{tbl:st-opts-ext} % \renewcommand{\arraystretch}{2} % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}} % \toprule % Option & Space-saving technique & Implementation \\ % \midrule % % \pkgoption{bibliography} % & Typeset the bibliography in a smaller font and with no inter-item % spacing. % & Redefine \texttt{thebibliography}, |\bibfont|, and |\bibitemsep|. \\ % % \pkgoption{title} % & Typeset the document title with smaller fonts and with less % surrounding white space. % & Redefine |\maketitle|. \\ % % \pkgoption{sections} % & Typeset section titles with smaller fonts and with less surrounding % white space. % & Pass options to the \pkgname{titlesec} package. \\ % % \pkgoption{margins} % & Reduce the page margins. % & Pass options to the \pkgname{geometry} package. \\ % % \bottomrule % \end{tabularx} % \end{adjustwidth} % \end{table} % % Each of the options that appears in \ref{tbl:st-opts-subt} through % \ref{tbl:st-opts-ext} 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. The \pkgoption{all} option can be used to set all of % \pkgname{savetrees}'s options en~masse to either |tight| or |normal|. % For example, if only a few space-saving techniques should be enabled, % it may be more convenient to specify |all=normal| followed by a small % list of options set to |tight| than to specify |normal| typesetting % for a large set of options. The arguments passed to |\usepackage| are % processed left-to-right. % % As convenient shortcuts, the options in \ref{tbl:st-opts-subt} can be % enabled as a group by passing the \pkgoption{subtle} option to % \pkgname{savetrees}; the options in both \ref{tbl:st-opts-subt} and % \ref{tbl:st-opts-mod} can be enabled as a group by passing the % \pkgoption{moderate} option to \pkgname{savetrees}; and all of the % options in \ref{tbl:st-opts-subt}, \ref{tbl:st-opts-mod}, and % \ref{tbl:st-opts-ext} can be enabled as a group by passing the % \pkgoption{extreme} option to \pkgname{savetrees}. % % The options in \ref{tbl:st-opts-subt} through \ref{tbl:st-opts-ext} % are presented in roughly decreasing order of subtlety. If you find % that \pkgname{savetrees}'s default options---or the % \pkgoption{subtle}, \pkgoption{moderate}, and \pkgoption{extreme} % meta-options---produce too hideous a result, try incrementally setting % to |normal| the options from the bottom of the options list up, and % see if doing so 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 |sections=normal|, then |title=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 three tables downwards: |paragraphs=tight|, then |floats=tight|, % then |mathspacing=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 95\% of that. % Additionally including |leadingfraction=0.98| on the |\usepackage| line % increases the line height to 98\% of \LaTeX's default---still a space % reduction but possibly a somewhat less overt one. % % \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.95 \\ % % \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} % % 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. % % % \section{Abbreviating 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. % 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: % % \begin{center} % \begin{tabular}{l@{\quad$\Longrightarrow$\quad}l} % chapter & chap. \\ % edition & ed. \\ % editor \emph{or} editors & ed.\ \emph{or} eds. \\ % January, February,~\dots & Jan., Feb.,~\dots \\ % page \emph{or} pages & p.\ \emph{or} pp. \\ % Technical Report & Tech. Rep. \\ % \end{tabular} % \end{center} % % \item At most two authors are listed. The remainder are replaced by % ``et al.'' % % \item Authors' names are abbreviated to their initials plus surname % (e.g.,~``S.~D.~Pakin''). % \end{itemize} % % \noindent % In addition, |savetrees.bst| does not normally typeset |NOTE| fields, % although it can be instructed to do so by passing \pkgname{savetrees} % the |bibnotes=normal| package option. % % 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 % \BibTeX{} style files instead of spelling out month names % explicitly: % % \begin{tabularx}{\linewidth}{@{}lX@{}} % \toprule % Good: & \texttt{MONTH = sep,} \\ % & Can be typeset as ``September'', ``Sept.'', ``SEP'', % ``Septiembre'', etc. \\ % % Bad: & \texttt{MONTH = \{September\},} \\ % & Can be typeset only as ``September''. \\ % \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@{}} % \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@{}} % \toprule % % Good: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla and % Rafaella Gabriela Sarsaparilla and Albert Andreas % Armadillo\},} \\ % & All authors can be named, or the list can be truncated at any % 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, % 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.'' \\ % \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 suppressed unless % the |bibnotes=normal| package option is provided. % % \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 % \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. \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 % \begin{tabular}{@{}l>{\sffamily\selectfont}l@{\qquad}D{.}{.}{-1}@{}} % \hline % Typeface & % \multicolumn{1}{l}{Package} & % \multicolumn{1}{l@{}}{Avg. width (pt.)} \\ % \hline % % Times & mathptmx & \fontwidth{ptm} \\ % Computer Modern & \multicolumn{1}{l}{(default)} & \fontwidth{cmr} \\ % Charter & charter & \fontwidth{bch} \\ % Helvetica & helvet & \fontwidth{phv} \\ % Palatino & mathpazo & \fontwidth{ppl} \\ % Utopia & utopia & \fontwidth{put} \\ % New Century Schoolbook & newcent & \fontwidth{pnc} \\ % Avant Garde & avant & \fontwidth{pag} \\ % Bookman & bookman & \fontwidth{pbk} \\ % Courier & courier & \fontwidth{pcr} \\ % \hline % \end{tabular} % \caption{Common fonts sorted by increasing width} % \label{tbl:font-widths} % \end{table} % % 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 white space above, below, and within list environments (in % this case, the |itemize| environment). \ref{fig:ex-mathspacing} shows % how setting |mathspacing=tight| saves space by typesetting % mathematical expressions denser. \ref{fig:ex-mathdisplays} shows how % setting |mathdisplays=tight| removes the space around mathematical % displays (e.g.,~\texttt{\string\[}\dots\texttt{\string\]} or % \texttt{\string\begin\string{equation\string}}\dots\linebreak[0]\texttt{\string\end\string{equation\string}}). % \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 white space. Finally, \ref{fig:ex-leading} shows % how setting |leading=tight| saves space by removing white space 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{\partopsep}{0pt plus 4pt}^^A % \setlength{\topsep}{0pt plus 4pt}^^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} % % \comparisonfigure[^^A % Lorem ipsum dolor sit amet, consectetur adipiscing elit % ${\cal H} = T + V$ % quisque feugiat % $T = \frac{p^2}{2m}$ % lacinia mauris % $V = V(q)$ % ut tincidunt. Etiam ligula dolor % ${\cal H} = \sum_i \dot{q_i} % \frac{\partial \cal L}{\partial \dot{q_i}} - % {\cal L} = \sum_i \dot{q_i} p_i - {\cal L}$ % eget nulla. % ]^^A % {mathspacing} % {^^A % \thinmuskip=0mu plus 3mu % \medmuskip=1mu plus 4mu % \thickmuskip=2mu plus 5mu % }{} % % \comparisonfigure[^^A % Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dapibus % \[ % \mathrm{d}{\cal L} % = \sum_i % \left( % \frac{\partial {\cal L}}{\partial q_i} \mathrm{d}q_i + % p_i \mathrm{d}\dot{q}_i % \right) + % \frac{\partial {\cal L}}{\partial t} \mathrm{d}t % \] % tempus dolor ac dignissim. Etiam ligula dolor, varius at rutrum. % ]^^A % {mathdisplays} % {^^A % \abovedisplayskip=0pt plus 3pt % \belowdisplayskip=0pt plus 3pt % \abovedisplayshortskip=0pt plus 3pt % \belowdisplayshortskip=0pt plus 3pt % }{} % % \newlength{\origwordspacing} % \setlength{\origwordspacing}{\fontdimen2\font} % \comparisonfigure{wordspacing}{^^A % \fontdimen2\font=0.75\origwordspacing % }{^^A % \fontdimen2\font=\origwordspacing % } % % \comparisonfigure{tracking}{^^A % \SetTracking{encoding=*,shape=*}{-25}^^A % \lsstyle % }{} % % \comparisonfigure{charwidths}{^^A % \begin{microtypecontext}{expansion=tightcharwidths}^^A % }{^^A % \end{microtypecontext}^^A % } % % \comparisonfigure{leading}{\fontsize{10}{11.4}\selectfont}{} % % \begin{figure}[htbp] % \savebox{\normalbox}{^^A % \fbox{^^A % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A % \lipsumtext % \end{minipage}}}^^A % \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}{11.4}\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} % % } % % % \section{Implementation of \texttt{savetrees.sty}} % \label{sec:savetrees.sty} % % 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. % % \iffalse %<*package> % \fi % % \subsection{Default values} % % \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. % % \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} % % \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} % % \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 95\% of normal or an % average of about~0.67\,pt.\ less lead than \LaTeX's defaults: 10/11.4, % 11/12.92, or 12/13.78. 95\% gives very good compression but still % prevents descenders from running into successive ascenders. % \begin{macrocode} \newcommand*{\st@baselinestretch}{0.95} % \end{macrocode} % \end{macro} % % \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} % % \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} % % \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} % % % \subsection{Option processing} % \label{sec:options} % % \subsubsection{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. % % \bigskip % % \pkgname{savetrees} uses the \pkgname{xkeyval} package to parse its % package options. % \begin{macrocode} \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 % 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} \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} % % \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} % % 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} % \begin{macro}{\KV@savetrees@sections} % 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} % \end{macro} % % \begin{macro}{\if@st@tight@margins} % \begin{macro}{\@st@tight@marginstrue} % \begin{macro}{\@st@tight@marginsfalse} % \begin{macro}{\KV@savetrees@margins} % 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} % \end{macro} % % \begin{macro}{\if@st@tight@lists} % \begin{macro}{\@st@tight@liststrue} % \begin{macro}{\@st@tight@listsfalse} % \begin{macro}{\KV@savetrees@lists} % 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} % \end{macro} % % \begin{macro}{\if@st@tight@floats} % \begin{macro}{\@st@tight@floatstrue} % \begin{macro}{\@st@tight@floatsfalse} % \begin{macro}{\KV@savetrees@floats} % 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} \st@define@option{floats} % \end{macrocode} % \pkgoptiondecl{floats} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@indent} % \begin{macro}{\@st@tight@indenttrue} % \begin{macro}{\@st@tight@indentfalse} % \begin{macro}{\KV@savetrees@indent} % 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} \st@define@option{indent} % \end{macrocode} % \pkgoptiondecl{indent} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@title} % \begin{macro}{\@st@tight@titletrue} % \begin{macro}{\@st@tight@titlefalse} % \begin{macro}{\KV@savetrees@title} % 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} \st@define@option{title} % \end{macrocode} % \pkgoptiondecl{title} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@leading} % \begin{macro}{\@st@tight@leadingtrue} % \begin{macro}{\@st@tight@leadingfalse} % \begin{macro}{\KV@savetrees@leading} % 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} \st@define@option{leading} % \end{macrocode} % \pkgoptiondecl{leading} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@paragraphs} % \begin{macro}{\@st@tight@paragraphstrue} % \begin{macro}{\@st@tight@paragraphsfalse} % \begin{macro}{\KV@savetrees@paragraphs} % 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} \st@define@option{paragraphs} % \end{macrocode} % \pkgoptiondecl{paragraphs} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@charwidths} % \begin{macro}{\@st@tight@charwidthstrue} % \begin{macro}{\@st@tight@charwidthsfalse} % \begin{macro}{\KV@savetrees@charwidths} % 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} \st@define@option{charwidths} % \end{macrocode} % \pkgoptiondecl{charwidths} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@tracking} % \begin{macro}{\@st@tight@trackingtrue} % \begin{macro}{\@st@tight@trackingfalse} % \begin{macro}{\KV@savetrees@tracking} % 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} \st@define@option{tracking} % \end{macrocode} % \pkgoptiondecl{tracking} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@wordspacing} % \begin{macro}{\@st@tight@wordspacingtrue} % \begin{macro}{\@st@tight@wordspacingfalse} % \begin{macro}{\KV@savetrees@wordspacing} % 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} \st@define@option{wordspacing} % \end{macrocode} % \pkgoptiondecl{wordspacing} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@bibliography} % \begin{macro}{\@st@tight@bibliographytrue} % \begin{macro}{\@st@tight@bibliographyfalse} % \begin{macro}{\KV@savetrees@bibliography} % 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} \st@define@option{bibliography} % \end{macrocode} % \pkgoptiondecl{bibliography} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@bibnotes} % \begin{macro}{\@st@tight@bibnotestrue} % \begin{macro}{\@st@tight@bibnotesfalse} % \begin{macro}{\KV@savetrees@bibnotes} % 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} \st@define@option{bibnotes} % \end{macrocode} % \pkgoptiondecl{bibnotes} % \end{macro} % \end{macro} % \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} % \begin{macro}{\KV@savetrees@mathspacing} % The \pkgoption{mathspacing} package option enables or disables % \pkgname{savetrees}'s modifications to horizontal spacing within % mathematical expressions by setting |\@st@tight@mathspacingtrue| or % |\@st@tight@mathspacingfalse|, respectively. % \begin{macrocode} \st@define@option{mathspacing} % \end{macrocode} % \pkgoptiondecl{mathspacing} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@st@tight@mathdisplays} % \begin{macro}{\@st@tight@mathdisplaystrue} % \begin{macro}{\@st@tight@mathdisplaysfalse} % \begin{macro}{\KV@savetrees@mathdisplays} % The \pkgoption{mathdisplays} package option enables or disables % \pkgname{savetrees}'s modifications to vertical spacing surrounding % mathematical displays by setting |\@st@tight@mathdisplaystrue| or % |\@st@tight@mathdisplaysfalse|, respectively. % \begin{macrocode} \st@define@option{mathdisplays} % \end{macrocode} % \pkgoptiondecl{mathdisplays} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{Meta options} % % \pkgname{savetrees} provides a large number of package options, which % might be overwhelming for a casual user. Here, we define a few ``meta % options'' that set multiple, related, package options en masse. % % \begin{macro}{\KV@savetrees@all} % \begin{macro}{\st@arg} % \begin{macro}{\st@arg@num} % Define an \pkgoption{all} meta-option that can be used to enable or % disable all of \pkgname{savetrees}'s space-saving features at once. % \begin{macrocode} \define@choicekey{savetrees}{all}[\st@arg\st@arg@num]{tight,normal}[tight]{% \ifnum\st@arg@num=0 \@st@tight@sectionstrue \@st@tight@marginstrue \@st@tight@liststrue \@st@tight@floatstrue \@st@tight@indenttrue \@st@tight@titletrue \@st@tight@leadingtrue \@st@tight@paragraphstrue \@st@tight@charwidthstrue \@st@tight@trackingtrue \@st@tight@wordspacingtrue \@st@tight@bibliographytrue \@st@tight@bibnotestrue \@st@tight@bibbreakstrue \@st@tight@mathspacingtrue \@st@tight@mathdisplaystrue \else \@st@tight@sectionsfalse \@st@tight@marginsfalse \@st@tight@listsfalse \@st@tight@floatsfalse \@st@tight@indentfalse \@st@tight@titlefalse \@st@tight@leadingfalse \@st@tight@paragraphsfalse \@st@tight@charwidthsfalse \@st@tight@trackingfalse \@st@tight@wordspacingfalse \@st@tight@bibliographyfalse \@st@tight@bibnotesfalse \@st@tight@bibbreaksfalse \@st@tight@mathspacingfalse \@st@tight@mathdisplaysfalse \fi } \DeclareOptionX{all}[tight]{\KV@savetrees@all{#1}} % \end{macrocode} % \pkgoptiondecl{all} % \end{macro} % \end{macro} % \end{macro} % % \changes{v2.1}{2013/04/07}{Introduced the \textsf{subtle}, \textsf{moderate}, % and \textsf{extreme} package options} % % \begin{macro}{\KV@savetrees@subtle} % The \pkgoption{subtle} package option turns off all of % \pkgname{savetrees}'s space-saving tricks except those that preserve % document layout: margins, indentation, font heights, vertical spacing % surrounding titles, lists, displays, etc. % % \begin{macrocode} \define@key{savetrees}{subtle}{% \setkeys{savetrees}{% all=normal, paragraphs=tight, floats=tight, mathspacing=tight, wordspacing=tight, tracking=tight, bibbreaks=tight }% } \DeclareOptionX{subtle}{\KV@savetrees@subtle} % \end{macrocode} % \pkgoptiondecl{subtle} % \end{macro} % % \begin{macro}{\KV@savetrees@moderate} % The \pkgoption{moderate} package option includes everything covered by % \pkgoption{subtle} but additionally makes the font narrower, removes % vertical white space around lists and displays, cuts back on % indentation, reduces interline spacing, and drops \texttt{NOTE} fields % from the bibliography, % % \begin{macrocode} \define@key{savetrees}{moderate}{% \setkeys{savetrees}{% subtle=yes, charwidths=tight, mathdisplays=tight, lists=tight, indent=tight, leading=tight, bibnotes=tight }% } \DeclareOptionX{moderate}{\KV@savetrees@moderate} % \end{macrocode} % \pkgoptiondecl{moderate} % \end{macro} % % \begin{macro}{\KV@savetrees@extreme} % The \pkgoption{extreme} package option is simply a synonym for |all=tight|. % % \begin{macrocode} \DeclareOptionX{extreme}{% \setkeys{savetrees}{all=tight}% } % \end{macrocode} % \pkgoptiondecl{extreme} % \end{macro} % % \subsubsection{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} % % \subsubsection{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} % % We now invoke |\st@mark@as@obsolete| once for each obsolete % \pkgname{savetrees} option, % \begin{macrocode} \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} % % % \subsection{Section titles} % % The \LaTeX{} default is to typeset section titles in a large font and % with significant surrounding white space. We use the % \pkgname{titlesec} package to typeset section titles in the same font % size as the body text and to leave only a single blank line above and % below them. % % \begin{macrocode} \if@st@tight@sections \st@RequirePackage[tiny,compact]{titlesec} \fi % \end{macrocode} % % \subsection{Page margins} % % The typesetting wisdom of the ages says that the human eye is most % comfortable reading approximately 60~characters per line of text, and % this is what \LaTeX's default margins aim to achieve. Of course, % narrower margins mean fewer pages, and that's what \pkgname{savetrees} % is striving for. % % 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@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} % % % \subsection{List spacing} % % We try to save space in itemized lists, enumerated lists, and % description lists by reducing indentation and by eliminating % pre-list and inter-item spacing altogether. % % \begin{macrocode} \if@st@tight@lists % \end{macrocode} % The \pkgname{calc} package helps simplify our list redefinitions. % \begin{macrocode} \st@RequirePackage{calc} % \end{macrocode} % % \begin{environment}{itemize} % Except where indicated, the following code was taken directly from % \LaTeXe's definition of the |itemize| environment, in |ltlists.dtx|: % \begin{macrocode} \def\itemize{% \ifnum \@itemdepth >\thr@@\@toodeep\else \advance\@itemdepth\@ne \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% \expandafter \list \csname\@itemitem\endcsname {\def\makelabel##1{\hss\llap{##1}}% % \end{macrocode} % The following lines have been modified from the original. % \changes{v2.1}{2013/04/05}{Reduced vertical space before the list} % \begin{macrocode} \settowidth{\leftmargin}{\csname\@itemitem\endcsname}% \addtolength{\leftmargin}{\labelsep * \@itemdepth}% \setlength{\partopsep}{0pt plus 4pt}% \setlength{\topsep}{0pt plus 4pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}% \setlength{\listparindent}{\st@parindent}% % \end{macrocode} % That's it for the modifications. We can now finish up the redefinition % of |itemize|. % \begin{macrocode} }% \fi} % \end{macrocode} % \end{environment} % % \begin{environment}{enumerate} % Except where indicated, the following code was taken directly from % \LaTeXe's definition of the |enumerate| environment, in |ltlists.dtx|: % \begin{macrocode} \def\enumerate{% \ifnum \@enumdepth >\thr@@\@toodeep\else \advance\@enumdepth\@ne \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \expandafter \list \csname label\@enumctr\endcsname {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}% % \end{macrocode} % The following lines have been modified from the original. % \changes{v2.1}{2013/04/05}{Reduced vertical space before the list} % \begin{macrocode} \settowidth{\leftmargin}{\csname label\@enumctr\endcsname}% \addtolength{\leftmargin}{\labelsep * \@enumdepth}% \setlength{\partopsep}{0pt plus 4pt}% \setlength{\topsep}{0pt plus 4pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}% \setlength{\listparindent}{\st@parindent}% % \end{macrocode} % That's it for the modifications. We can now finish up the % redefinition of |enumerate|. % \begin{macrocode} } \fi} % \end{macrocode} % \end{environment} % % \begin{environment}{description} % The |description| environment is a bit simpler than the |itemize| and % |enumerate| environments; it's a direct application of |list|. All we % need to do is reduce the left margin from the |list| default of 2\,em % to a slightly denser~1\,pc. % \changes{v2.1}{2013/04/05}{Reduced vertical space before and within the list} % \begin{macrocode} \renewenvironment{description}{% \begin{list}{}{\setlength{\leftmargin}{1pc}% \setlength{\itemindent}{-\leftmargin}% \setlength{\partopsep}{0pt plus 4pt}% \setlength{\topsep}{0pt plus 4pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}% \setlength{\labelwidth}{0pt}% \setlength{\listparindent}{\st@parindent}% \let\makelabel\descriptionlabel}% }{% \end{list} } \fi % \end{macrocode} % \end{environment} % % % \subsection{Float placement} % % \begin{macro}{\topfraction} % \begin{macro}{\bottomfraction} % \begin{macro}{\textfraction} % \begin{macro}{\floatpagefraction} % \begin{macro}{\dbltopfraction} % \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). % \begin{macrocode} \if@st@tight@floats \renewcommand{\topfraction}{0.85} \renewcommand{\bottomfraction}{0.85} \renewcommand{\textfraction}{0.1} \renewcommand{\floatpagefraction}{0.85} \renewcommand{\dbltopfraction}{0.85} \renewcommand{\dblfloatpagefraction}{.85} \setcounter{topnumber}{25} \setcounter{bottomnumber}{25} \setcounter{totalnumber}{25} \setcounter{dbltopnumber}{25} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Paragraph indentation} % % \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@tight@indent \setlength{\parindent}{\st@parindent} \fi % \end{macrocode} % % % \subsection{Document title formatting} % % By default, the document title is typeset in the |\LARGE| font size, % and the author list and date are typeset |\large|. We redefine % |\@maketitle| to typeset the title |\large| and everything else in the % body font. In addition, we remove the extra white space above the % title and lessen the white space below the title. % \begin{macrocode} \if@st@tight@title % \end{macrocode} % \begin{macro}{\@maketitle} % The following was taken largely from |classes.dtx|, but modified as % specified above. % \changes{v2.4}{2016/04/13}{Remove even more white space above the title} % \begin{macrocode} \def\@maketitle{% \newpage \mbox{}% \begingroup \centering \let \footnote \thanks {\large \textbf{\@title}\par} \vskip 0.5\baselineskip \begin{tabular}[t]{c}% \@author \end{tabular}\par \vskip 0.5\baselineskip \@date \par \endgroup \vskip \baselineskip } \fi % \end{macrocode} % \end{macro} % % % \subsection{Interline spacing} % % \begin{macro}{\baselinestretch} % A document's page count can be reduced quite significantly by reducing % the amount of white space between successive lines of text so that's % exactly what we do below. % \begin{macrocode} \if@st@tight@leading \renewcommand{\baselinestretch}{\st@baselinestretch} \fi % \end{macrocode} % \end{macro} % % % \subsection{Paragraph looseness} % \changes{v1.2}{2006/11/20}{Added support for reducing paragraph looseness} % % Some paragraphs end with a lone word on the last line. If we can % discourage such typesetting we can gain an extra line. The underlying % mechanism we use is \TeX's |\looseness| primitive, which encourages % \TeX\ to expand the current paragraph by a given number of lines. % 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 so \TeX\ has enough shrinkable white space to work with. % % Unfortunately, |\looseness| applies only to the current paragraph. We % therefore use |\everypar| to inject |\looseness=-1| into every % paragraph. However, the approach is not quite so simple as the % |\looseness=-1| is not injected into list environments. We therefore % use some tricky code due to Donald Arseneau to make the effect of % |\looseness=-1| as global as possible: % \changes{v1.2a}{2007/12/23}{Appended \texttt{\string\string\relax} to % \texttt{\string\string\looseness!=-1} to avoid discarding any % leading digits appearing in a paragraph} % \begin{macrocode} \if@st@tight@paragraphs \let\markeverypar\everypar \newtoks\everypar \everypar\markeverypar \markeverypar{\the\everypar\looseness=-1\relax} \fi % \end{macrocode} % % 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 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 % 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\%. At the time of this writing, this feature works only with % pdf\LaTeX\ and Lua\LaTeX. % \begin{macrocode} \if@st@tight@charwidths \ifpdf \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype} \fi \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 % 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. At % the time of this writing, this feature works only with pdf\LaTeX. % % \begin{macrocode} \if@st@tight@tracking \ifpdf \ifluatex \else \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype} \fi \fi \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} % % % \subsection{Bibliography formatting} % % There are two ways we save space when typesetting bibliographies. % First, we omit blank linkes between entries. And second, we typeset % the entire bibliography---excluding the section title---with |\small|. % % \begin{macrocode} \if@st@tight@bibliography % \end{macrocode} % \begin{environment}{thebibliography} % The following was taken largely from |classes.dtx|; see that file for % additional documentation. \pkgname{savetrees}'s modifications are % indicated below. % \begin{macrocode} \renewenvironment{thebibliography}[1]{% % \end{macrocode} % In the |article| document class, a bibliography is a \emph{section} % called ``|\refname|''. In the |report| and |book| document classes, a % bibliography is a \emph{chapter} called ``|\bibname|''. In % |classes.dtx|, the correct code is extracted by \pkgname{DocStrip}. % Here, we have to use an |\ifx| primitive to select the appropriate % title and formatting. % \changes{v1.1}{2004/07/17}{Modified to test for % \texttt{\string\string\string\chapter}, not % \texttt{\string\string\string\bibname}.} % \changes{v1.2}{2006/11/19}{Modified to use the more robust % \texttt{\string\string\string\@ifundefined} macro to test for the existence % of \texttt{\string\string\string\chapter}} % \begin{macrocode} \@ifundefined{chapter}{% \section*{\refname \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}% }{% \chapter*{\bibname \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}% }% % \end{macrocode} % Back to the original code\dots % \begin{macrocode} \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep % \end{macrocode} % We eliminate the space between paragraphs, and we set the space % between items to only~1\,pt. We could have set this to~0\,pt., but % the extra space helps keep the citation numbers' brackets from getting % too close to each other, vertically. % \begin{macrocode} \setlength{\parsep}{0pt}% \setlength{\itemsep}{1pt}% % \end{macrocode} % Back to the original code\dots % \begin{macrocode} \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}% % \end{macrocode} % Although we kept the section title in its original size, we typeset % the rest of the bibliography a little bit smaller. % \begin{macrocode} \small % \end{macrocode} % 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 \clubpenalty150 \@clubpenalty \clubpenalty \widowpenalty150% \sfcode`\.\@m }{% \def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist } % \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} % % \begin{macro}{\savetreesbibnote} % The bibliographies output by the |savetrees.bst| \BibTeX{} style % (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@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} % \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} % % By default, mathematical expressions contain substantial white space % around operators, relations, etc. Here, we shave approximately three % math units off each of |\thinmuskip|, |\medmuskip|, and % |\thickmuskip|. This needs to happen after the |\begin{document}| so % that the new values don't get overwritten. % \changes{v2.1}{2013/04/06}{Added support for squeezing space out of % mathematical expressions} % % \begin{macrocode} \if@st@tight@mathspacing \AtBeginDocument{% \thinmuskip=0mu plus 3mu \medmuskip=1mu plus 4mu \thickmuskip=2mu plus 5mu } \fi % \end{macrocode} % % % \subsection{Displayed mathematics} % \label{sec:math-displays} % % Displayed mathematical expressions are normally offset from the % surrounding text with vertical white space. Here, we set the amount of % vertical white space to zero. This needs to happen after the % |\begin{document}| so that the new values don't get overwritten. % \changes{v2.1}{2013/04/06}{Added support for removing vertical space % around displayed mathematics} % % \begin{macrocode} \if@st@tight@mathdisplays \AtBeginDocument{% \abovedisplayskip=0pt plus 3pt \belowdisplayskip=0pt plus 3pt \abovedisplayshortskip=0pt plus 3pt \belowdisplayshortskip=0pt plus 3pt } \fi % \end{macrocode} % % \iffalse % % \fi % % % \section{Implementation of the \texorpdfstring{\BibTeX}{BibTeX} style file} % \label{sec:savetrees.bst} % % In addition to a \LaTeXe{} style, the \pkgname{savetrees} package also % includes a \BibTeX{} style, |savetrees.bst|. |savetrees.bst| was % generated with the help of Patrick W. Daly's \pkgname{custom-bib} % package. The following options were provided to |merlin.mbs|: % % \begin{center} % \begin{minipage}{0.75\textwidth} % \ttfamily\selectfont % lang, nm-init, ed-au, nmdash, nmlm, x2, m2, isbn, issn, pp, ed, abr, % ednx, xedn, jabr, nfss % \end{minipage} % \end{center} % % Because |savetrees.bst| is a generated file---and can be regenerated using % the options listed above---it is unnecessary to list the complete % source code in this document. Rather, only the hand-modified parts are % presented below. % % \iffalse %<*bstfile> % \fi % % \begin{center} % $\vdots$ \\ % (443 lines of code omitted) \\ % $\vdots$ % \end{center} % % ^^A We surround all but our modified format.note function % ^^A within \iffalse...\fi. % \iffalse % \begin{macrocode} % =============================================================== % IMPORTANT NOTICE: % This bibliographic style (bst) file has been generated from one or % more master bibliographic style (mbs) files, listed above. % % This generated file can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % =============================================================== % Name and version information of the main mbs file: % \ProvidesFile{merlin.mbs}[1999/05/28 3.89 (PWD)] % For use with BibTeX version 0.99a or later %------------------------------------------------------------------- % This bibliography style file is intended for texts in ENGLISH % This is a numerical citation style, and as such is standard LaTeX. % It requires no extra package to interface to the main text. % The form of the \bibitem entries is % \bibitem{key}... % Usage of \cite is as follows: % \cite{key} ==>> [#] % \cite[chap. 2]{key} ==>> [#, chap. 2] % where # is a number determined by the ordering in the reference list. % The order in the reference list is alphabetical by authors. %--------------------------------------------------------------------- ENTRY { address author booktitle chapter edition editor howpublished institution isbn issn journal key language month note number organization pages publisher school series title type volume year } {} { label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } FUNCTION {init.state.consts} { #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := } STRINGS { s t } FUNCTION {output.nonnull} { 's := output.state mid.sentence = { ", " * write$ } { output.state after.block = { add.period$ write$ newline$ "\newblock " write$ } { output.state before.all = 'write$ { add.period$ " " * write$ } if$ } if$ mid.sentence 'output.state := } if$ s } FUNCTION {output} { duplicate$ empty$ 'pop$ 'output.nonnull if$ } FUNCTION {output.check} { 't := duplicate$ empty$ { pop$ "empty " t * " in " * cite$ * warning$ } 'output.nonnull if$ } FUNCTION {fin.entry} { add.period$ write$ newline$ } FUNCTION {new.block} { output.state before.all = 'skip$ { after.block 'output.state := } if$ } FUNCTION {new.sentence} { output.state after.block = 'skip$ { output.state before.all = 'skip$ { after.sentence 'output.state := } if$ } if$ } FUNCTION {add.blank} { " " * before.all 'output.state := } FUNCTION {date.block} { new.block } FUNCTION {not} { { #0 } { #1 } if$ } FUNCTION {and} { 'skip$ { pop$ #0 } if$ } FUNCTION {or} { { pop$ #1 } 'skip$ if$ } FUNCTION {new.block.checka} { empty$ 'skip$ 'new.block if$ } FUNCTION {new.block.checkb} { empty$ swap$ empty$ and 'skip$ 'new.block if$ } FUNCTION {new.sentence.checka} { empty$ 'skip$ 'new.sentence if$ } FUNCTION {new.sentence.checkb} { empty$ swap$ empty$ and 'skip$ 'new.sentence if$ } FUNCTION {field.or.null} { duplicate$ empty$ { pop$ "" } 'skip$ if$ } FUNCTION {emphasize} { duplicate$ empty$ { pop$ "" } { "\emph{" swap$ * "}" * } if$ } FUNCTION {capitalize} { "u" change.case$ "t" change.case$ } FUNCTION {space.word} { " " swap$ * " " * } % Here are the language-specific definitions for explicit words. % Each function has a name bbl.xxx where xxx is the English word. % The language selected here is ENGLISH FUNCTION {bbl.and} { "and"} FUNCTION {bbl.etal} { "et~al." } FUNCTION {bbl.editors} { "eds." } FUNCTION {bbl.editor} { "ed." } FUNCTION {bbl.edby} { "edited by" } FUNCTION {bbl.edition} { "ed." } FUNCTION {bbl.volume} { "vol." } FUNCTION {bbl.of} { "of" } FUNCTION {bbl.number} { "no." } FUNCTION {bbl.nr} { "no." } FUNCTION {bbl.in} { "in" } FUNCTION {bbl.pages} { "pp." } FUNCTION {bbl.page} { "p." } FUNCTION {bbl.chapter} { "chap." } FUNCTION {bbl.techrep} { "Tech. Rep." } FUNCTION {bbl.mthesis} { "Master's thesis" } FUNCTION {bbl.phdthesis} { "Ph.D. thesis" } MACRO {jan} {"Jan."} MACRO {feb} {"Feb."} MACRO {mar} {"Mar."} MACRO {apr} {"Apr."} MACRO {may} {"May"} MACRO {jun} {"Jun."} MACRO {jul} {"Jul."} MACRO {aug} {"Aug."} MACRO {sep} {"Sep."} MACRO {oct} {"Oct."} MACRO {nov} {"Nov."} MACRO {dec} {"Dec."} MACRO {acmcs} {"ACM Comput. Surv."} MACRO {acta} {"Acta Inf."} MACRO {cacm} {"Commun. ACM"} MACRO {ibmjrd} {"IBM J. Res. Dev."} MACRO {ibmsj} {"IBM Syst.~J."} MACRO {ieeese} {"IEEE Trans. Softw. Eng."} MACRO {ieeetc} {"IEEE Trans. Comput."} MACRO {ieeetcad} {"IEEE Trans. Comput.-Aided Design Integrated Circuits"} MACRO {ipl} {"Inf. Process. Lett."} MACRO {jacm} {"J.~ACM"} MACRO {jcss} {"J.~Comput. Syst. Sci."} MACRO {scp} {"Sci. Comput. Programming"} MACRO {sicomp} {"SIAM J. Comput."} MACRO {tocs} {"ACM Trans. Comput. Syst."} MACRO {tods} {"ACM Trans. Database Syst."} MACRO {tog} {"ACM Trans. Gr."} MACRO {toms} {"ACM Trans. Math. Softw."} MACRO {toois} {"ACM Trans. Office Inf. Syst."} MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."} MACRO {tcs} {"Theoretical Comput. Sci."} INTEGERS { nameptr namesleft numnames } FUNCTION {format.names} { 's := "" 't := #1 'nameptr := s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := nameptr #1 > { nameptr #2 #1 + = numnames #2 > and { "others" 't := #1 'namesleft := } 'skip$ if$ namesleft #1 > { ", " * t * } { numnames #2 > { "," * } 'skip$ if$ s nameptr "{ll}" format.name$ duplicate$ "others" = { 't := } { pop$ } if$ t "others" = { " " * bbl.etal * } { bbl.and space.word * t * } if$ } if$ } 't if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$ } FUNCTION {format.names.ed} { format.names } FUNCTION {format.authors} { author empty$ { "" } { author format.names } if$ } FUNCTION {format.editors} { editor empty$ { "" } { editor format.names ", " * editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ * } if$ } FUNCTION {format.in.editors} { editor empty$ { "" } { editor format.names.ed editor num.names$ #1 > { ", " * bbl.editors * } { ", " * bbl.editor * } if$ } if$ } FUNCTION {format.isbn} { isbn empty$ { "" } { new.block "ISBN " isbn * } if$ } FUNCTION {format.issn} { issn empty$ { "" } { new.block "ISSN " issn * } if$ } FUNCTION {select.language} { duplicate$ empty$ 'pop$ { language empty$ 'skip$ { "{\selectlanguage{" language * "}" * swap$ * "}" * } if$ } if$ } % \end{macrocode} % \fi % % |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 % \ref{sec:bibliographic-notes} for |savetrees.sty|'s definition % of~|\savetreesbibnote|. % \begin{macrocode} FUNCTION {format.note} { note empty$ { "" } { "\savetreesbibnote{" note #1 #1 substring$ duplicate$ "{" = 'skip$ { output.state mid.sentence = { "l" } { "u" } if$ change.case$ } if$ note #2 global.max$ substring$ * "}" * * } if$ } % \end{macrocode} % % \begin{center} % $\vdots$ \\ % (914 lines of code omitted) \\ % $\vdots$ % \end{center} % % \iffalse % \begin{macrocode} FUNCTION {format.title} { title empty$ { "" } { title "t" change.case$ select.language } if$ } FUNCTION {output.bibitem} { newline$ "\bibitem{" write$ cite$ write$ "}" write$ newline$ "" before.all 'output.state := } FUNCTION {n.dashify} { 't := "" { t empty$ not } { t #1 #1 substring$ "-" = { t #1 #2 substring$ "--" = not { "--" * t #2 global.max$ substring$ 't := } { { t #1 #1 substring$ "-" = } { "-" * t #2 global.max$ substring$ 't := } while$ } if$ } { t #1 #1 substring$ * t #2 global.max$ substring$ 't := } if$ } while$ } FUNCTION {word.in} { bbl.in capitalize " " * } FUNCTION {format.date} { year empty$ { month empty$ { "" } { "there's a month but no year in " cite$ * warning$ month } if$ } { month empty$ 'year { month " " * year * } if$ } if$ } FUNCTION {format.btitle} { title emphasize select.language } FUNCTION {tie.or.space.connect} { duplicate$ text.length$ #3 < { "~" } { " " } if$ swap$ * * } FUNCTION {either.or.check} { empty$ 'pop$ { "can't use both " swap$ * " fields in " * cite$ * warning$ } if$ } FUNCTION {format.bvolume} { volume empty$ { "" } { bbl.volume volume tie.or.space.connect series empty$ 'skip$ { bbl.of space.word * series emphasize * } if$ "volume and number" number either.or.check } if$ } FUNCTION {format.number.series} { volume empty$ { number empty$ { series field.or.null } { output.state mid.sentence = { bbl.number } { bbl.number capitalize } if$ number tie.or.space.connect series empty$ { "there's a number but no series in " cite$ * warning$ } { bbl.in space.word * series * } if$ } if$ } { "" } if$ } FUNCTION {format.edition} { edition empty$ { "" } { output.state mid.sentence = { edition "l" change.case$ " " * bbl.edition * } { edition "t" change.case$ " " * bbl.edition * } if$ } if$ } INTEGERS { multiresult } FUNCTION {multi.page.check} { 't := #0 'multiresult := { multiresult not t empty$ not and } { t #1 #1 substring$ duplicate$ "-" = swap$ duplicate$ "," = swap$ "+" = or or { #1 'multiresult := } { t #2 global.max$ substring$ 't := } if$ } while$ multiresult } FUNCTION {format.pages} { pages empty$ { "" } { pages multi.page.check { bbl.pages pages n.dashify tie.or.space.connect } { bbl.page pages tie.or.space.connect } if$ } if$ } FUNCTION {format.journal.pages} { pages empty$ 'skip$ { duplicate$ empty$ { pop$ format.pages } { ":" * pages n.dashify * } if$ } if$ } FUNCTION {format.vol.num.pages} { volume field.or.null number empty$ 'skip$ { "(" number * ")" * * volume empty$ { "there's a number but no volume in " cite$ * warning$ } 'skip$ if$ } if$ format.journal.pages } FUNCTION {format.chapter.pages} { chapter empty$ 'format.pages { type empty$ { bbl.chapter } { type "l" change.case$ } if$ chapter tie.or.space.connect pages empty$ 'skip$ { ", " * format.pages * } if$ } if$ } FUNCTION {format.in.ed.booktitle} { booktitle empty$ { "" } { editor empty$ { word.in booktitle emphasize * } { word.in format.in.editors * ", " * booktitle emphasize * } if$ } if$ } FUNCTION {empty.misc.check} { author empty$ title empty$ howpublished empty$ month empty$ year empty$ note empty$ and and and and and key empty$ not and { "all relevant fields are empty in " cite$ * warning$ } 'skip$ if$ } FUNCTION {format.thesis.type} { type empty$ 'skip$ { pop$ type "t" change.case$ } if$ } FUNCTION {format.tr.number} { type empty$ { bbl.techrep } 'type if$ number empty$ { "t" change.case$ } { number tie.or.space.connect } if$ } FUNCTION {format.article.crossref} { key empty$ { journal empty$ { "need key or journal for " cite$ * " to crossref " * crossref * warning$ "" } { word.in journal emphasize * } if$ } { word.in key * " " *} if$ " \cite{" * crossref * "}" * } FUNCTION {format.crossref.editor} { editor #1 "{vv~}{ll}" format.name$ editor num.names$ duplicate$ #2 > { pop$ " " * bbl.etal * } { #2 < 'skip$ { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = { " " * bbl.etal * } { bbl.and space.word * editor #2 "{vv~}{ll}" format.name$ * } if$ } if$ } if$ } FUNCTION {format.book.crossref} { volume empty$ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ word.in } { bbl.volume capitalize volume tie.or.space.connect bbl.of space.word * } if$ editor empty$ editor field.or.null author field.or.null = or { key empty$ { series empty$ { "need editor, key, or series for " cite$ * " to crossref " * crossref * warning$ "" * } { series emphasize * } if$ } { key * } if$ } { format.crossref.editor * } if$ " \cite{" * crossref * "}" * } FUNCTION {format.incoll.inproc.crossref} { editor empty$ editor field.or.null author field.or.null = or { key empty$ { booktitle empty$ { "need editor, key, or booktitle for " cite$ * " to crossref " * crossref * warning$ "" } { word.in booktitle emphasize * } if$ } { word.in key * " " *} if$ } { word.in format.crossref.editor * " " *} if$ " \cite{" * crossref * "}" * } FUNCTION {format.org.or.pub} { 't := "" address empty$ t empty$ and 'skip$ { t empty$ { address empty$ 'skip$ { address * } if$ } { t * address empty$ 'skip$ { ", " * address * } if$ } if$ } if$ } FUNCTION {format.publisher.address} { publisher empty$ { "empty publisher in " cite$ * warning$ "" } { publisher } if$ format.org.or.pub } FUNCTION {format.organization.address} { organization empty$ { "" } { organization } if$ format.org.or.pub } STRINGS {oldname} FUNCTION {name.or.dash} { 's := oldname empty$ { s 'oldname := s } { s oldname = { "---" } { s 'oldname := s } if$ } if$ } FUNCTION {article} { output.bibitem format.authors "author" output.check name.or.dash new.block format.title "title" output.check new.block crossref missing$ { journal emphasize "journal" output.check format.vol.num.pages output format.date "year" output.check } { format.article.crossref output.nonnull format.pages output } if$ format.issn output new.block format.note output fin.entry } FUNCTION {book} { output.bibitem author empty$ { format.editors "author and editor" output.check name.or.dash } { format.authors output.nonnull name.or.dash crossref missing$ { "author and editor" editor either.or.check } 'skip$ if$ } if$ new.block format.btitle "title" output.check crossref missing$ { format.bvolume output new.block format.number.series output new.sentence format.publisher.address output } { new.block format.book.crossref output.nonnull } if$ format.edition output format.date "year" output.check format.isbn output new.block format.note output fin.entry } FUNCTION {booklet} { output.bibitem format.authors output name.or.dash new.block format.title "title" output.check new.block howpublished output address output format.date output format.isbn output new.block format.note output fin.entry } FUNCTION {inbook} { output.bibitem author empty$ { format.editors "author and editor" output.check name.or.dash } { format.authors output.nonnull name.or.dash crossref missing$ { "author and editor" editor either.or.check } 'skip$ if$ } if$ new.block format.btitle "title" output.check crossref missing$ { format.bvolume output format.chapter.pages "chapter and pages" output.check new.block format.number.series output new.sentence format.publisher.address output } { format.chapter.pages "chapter and pages" output.check new.block format.book.crossref output.nonnull } if$ format.edition output format.date "year" output.check crossref missing$ { format.isbn output } 'skip$ if$ new.block format.note output fin.entry } FUNCTION {incollection} { output.bibitem format.authors "author" output.check name.or.dash new.block format.title "title" output.check new.block crossref missing$ { format.in.ed.booktitle "booktitle" output.check format.bvolume output format.number.series output format.chapter.pages output new.sentence format.publisher.address output format.edition output format.date "year" output.check format.isbn output } { format.incoll.inproc.crossref output.nonnull format.chapter.pages output } if$ new.block format.note output fin.entry } FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check name.or.dash new.block format.title "title" output.check new.block crossref missing$ { format.in.ed.booktitle "booktitle" output.check format.bvolume output format.number.series output format.pages output new.sentence publisher empty$ { format.organization.address output } { organization output format.publisher.address output } if$ format.date "year" output.check format.isbn output format.issn output } { format.incoll.inproc.crossref output.nonnull format.pages output } if$ new.block format.note output fin.entry } FUNCTION {conference} { inproceedings } FUNCTION {manual} { output.bibitem author empty$ { organization empty$ 'skip$ { organization output.nonnull address output } if$ } { format.authors output.nonnull } if$ name.or.dash new.block format.btitle "title" output.check author empty$ { organization empty$ { address new.block.checka address output } 'skip$ if$ } { organization address new.block.checkb organization output address output } if$ format.edition output format.date output new.block format.note output fin.entry } FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check name.or.dash new.block format.btitle "title" output.check new.block bbl.mthesis format.thesis.type output.nonnull school "school" output.check address output format.date "year" output.check new.block format.note output fin.entry } FUNCTION {misc} { output.bibitem format.authors output name.or.dash title howpublished new.block.checkb format.title output howpublished new.block.checka howpublished output format.date output new.block format.note output fin.entry empty.misc.check } FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check name.or.dash new.block format.btitle "title" output.check new.block bbl.phdthesis format.thesis.type output.nonnull school "school" output.check address output format.date "year" output.check new.block format.note output fin.entry } FUNCTION {proceedings} { output.bibitem editor empty$ { organization output } { format.editors output.nonnull } if$ name.or.dash new.block format.btitle "title" output.check format.bvolume output format.number.series output editor empty$ { publisher empty$ 'skip$ { new.sentence format.publisher.address output } if$ } { publisher empty$ { new.sentence format.organization.address output } { new.sentence organization output format.publisher.address output } if$ } if$ format.date "year" output.check format.isbn output format.issn output new.block format.note output fin.entry } FUNCTION {techreport} { output.bibitem format.authors "author" output.check name.or.dash new.block format.title "title" output.check new.block format.tr.number output.nonnull institution "institution" output.check address output format.date "year" output.check new.block format.note output fin.entry } FUNCTION {unpublished} { output.bibitem format.authors "author" output.check name.or.dash new.block format.title "title" output.check format.date output new.block format.note "note" output.check fin.entry } FUNCTION {default.type} { misc } READ FUNCTION {sortify} { purify$ "l" change.case$ } INTEGERS { len } FUNCTION {chop.word} { 's := 'len := s #1 len substring$ = { s len #1 + global.max$ substring$ } 's if$ } FUNCTION {sort.format.names} { 's := #1 'nameptr := "" s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := nameptr #1 > { nameptr #2 #1 + = numnames #2 > and { "others" 't := #1 'namesleft := } 'skip$ if$ " " * namesleft #1 = t "others" = and { "zzzzz" * } { t sortify * } if$ } { t sortify * } if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$ } FUNCTION {sort.format.title} { 't := "A " #2 "An " #3 "The " #4 t chop.word chop.word chop.word sortify #1 global.max$ substring$ } FUNCTION {author.sort} { author empty$ { key empty$ { "to sort, need author or key in " cite$ * warning$ "" } { key sortify } if$ } { author sort.format.names } if$ } FUNCTION {author.editor.sort} { author empty$ { editor empty$ { key empty$ { "to sort, need author, editor, or key in " cite$ * warning$ "" } { key sortify } if$ } { editor sort.format.names } if$ } { author sort.format.names } if$ } FUNCTION {author.organization.sort} { author empty$ { organization empty$ { key empty$ { "to sort, need author, organization, or key in " cite$ * warning$ "" } { key sortify } if$ } { "The " #4 organization chop.word sortify } if$ } { author sort.format.names } if$ } FUNCTION {editor.organization.sort} { editor empty$ { organization empty$ { key empty$ { "to sort, need editor, organization, or key in " cite$ * warning$ "" } { key sortify } if$ } { "The " #4 organization chop.word sortify } if$ } { editor sort.format.names } if$ } FUNCTION {presort} { type$ "book" = type$ "inbook" = or 'author.editor.sort { type$ "proceedings" = 'editor.organization.sort { type$ "manual" = 'author.organization.sort 'author.sort if$ } if$ } if$ " " * year field.or.null sortify * " " * title field.or.null sort.format.title * #1 entry.max$ substring$ 'sort.key$ := } ITERATE {presort} SORT STRINGS { longest.label } INTEGERS { number.label longest.label.width } FUNCTION {initialize.longest.label} { "" 'longest.label := #1 'number.label := #0 'longest.label.width := } FUNCTION {longest.label.pass} { number.label int.to.str$ 'label := number.label #1 + 'number.label := label width$ longest.label.width > { label 'longest.label := label width$ 'longest.label.width := } 'skip$ if$ } 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$ { preamble$ write$ newline$ } if$ "\begin{thebibliography}{" longest.label * "}" * write$ newline$ "\providecommand*{\selectlanguage}[1]{\relax}%" write$ newline$ "\providecommand*{\savetreesbibnote}[1]{#1}%" write$ newline$ } % \end{macrocode} % % \begin{center} % $\vdots$ \\ % (13 lines of code omitted) \\ % $\vdots$ % \end{center} % % \iffalse % \begin{macrocode} EXECUTE {begin.bib} EXECUTE {init.state.consts} ITERATE {call.type$} FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ } 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