Debian Codegraph @

texmf-dist/source/latex/savetrees/savetrees.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2016 by Scott Pakin <[email protected]>
4 % ------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3c
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3c or later is part of all distributions of LaTeX
14 % version 2006/05/20 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<bbxfile>\ProvidesFile{savetrees.bbx}
20 %<cbxfile>\ProvidesFile{savetrees.cbx}
21 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
22 %<package>\ProvidesPackage{savetrees}
23 %<*driver>
24 \ProvidesFile{savetrees.dtx}
25 %</driver>
26 %<*package|bbxfile|cbxfile>
27 [2016/04/13 v2.4 Pack as much text as possible onto each page]
28 %</package|bbxfile|cbxfile>
29 %
30 %<*driver>
31 \documentclass{ltxdoc}
32 \usepackage{array}
33 \usepackage{dcolumn}
34 \usepackage{tabularx}
35 \usepackage{booktabs}
36 \usepackage{topcapt}
37 \usepackage{changepage}
38 \usepackage{calc}
39 \usepackage{varioref}
40 \usepackage{needspace}
41 \usepackage[format=hang,justification=raggedright]{subfig}
42 \usepackage[tracking]{microtype}
43 \SetExpansion[context=tightcharwidths,stretch=0,shrink=55]{encoding=*,shape=*}{}
44 \usepackage{hyperref}
45 \usepackage{hyperxmp}
46 \hypersetup{%
47 pdftitle={The savetrees package},
48 pdfauthor={Scott Pakin},
49 pdfsubject={Reduce a LaTeX document's page count by adjusting the formatting},
50 pdfkeywords={LaTeX, reduce document size, margins, whitespace, page count},
51 pdfcopyright={Copyright (C) \the\year, Scott Pakin},
52 pdflicenseurl={http://www.latex-project.org/lppl.txt},
53 pdfcaptionwriter={Scott Pakin},
54 pdfcontactregion={New Mexico},
55 pdfcontactcountry={USA},
56 pdfcontactemail={[email protected]},
57 pdfcontacturl={http://www.pakin.org/\xmptilde scott/},
58 baseurl={http://mirror.ctan.org/macros/latex/contrib/savetrees/savetrees.pdf},
59 pdflang={en-US}
60 }
61 \EnableCrossrefs
62 \CodelineIndex
63 \setcounter{IndexColumns}{2}
64 \RecordChanges
65 \begin{document}
66 \DocInput{savetrees.dtx}
67 \Needspace{10\baselineskip}
68 \phantomsection\addcontentsline{toc}{section}{Change History}
69 \PrintChanges
70 \makeatletter
71 \let\orig@index@prologue=\index@prologue
72 \def\index@prologue{%
73 \phantomsection\addcontentsline{toc}{section}{Index}
74 \orig@index@prologue
75 }%
76 \makeatother
77 \Needspace{12\baselineskip}
78 \PrintIndex
79 \end{document}
80 %</driver>
81 % \fi
82 %
83 % \CheckSum{528}
84 %
85 % \CharacterTable
86 % {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
87 % 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
88 % Digits \0\1\2\3\4\5\6\7\8\9
89 % Exclamation \! Double quote \" Hash (number) \#
90 % Dollar \$ Percent \% Ampersand \&
91 % Acute accent \' Left paren \( Right paren \)
92 % Asterisk \* Plus \+ Comma \,
93 % Minus \- Point \. Solidus \/
94 % Colon \: Semicolon \; Less than \<
95 % Equals \= Greater than \> Question mark \?
96 % Commercial at \@ Left bracket \[ Backslash \\
97 % Right bracket \] Circumflex \^ Underscore \_
98 % Grave accent \` Left brace \{ Vertical bar \|
99 % Right brace \} Tilde \~}
100 %
101 %
102 % \changes{v1.0}{2002/07/06}{Initial version}
103 % \changes{v2.2}{2014/02/19}{Disabled \textsf{tracking}'s effect
104 % except when called from pdf\LaTeX, and disabled \textsf{charwidths}'s
105 % effect except when called from either pdf\LaTeX\ or Lua\LaTeX}
106 %
107 % \GetFileInfo{savetrees.dtx}
108 %
109 % \DoNotIndex{\.,\@arabic,\@author,\@biblabel,\@clubpenalty,\@date,\@empty}
110 % \DoNotIndex{\@enumctr,\@enumdepth,\@gobble,\@ifundefined,\@itemdepth}
111 % \DoNotIndex{\@itemitem,\@latex@warning,\@m,\@mkboth,\@ne,\@noitemerr}
112 % \DoNotIndex{\@openbib@code,\@tempcnta,\@tempdima,\@title,\@toodeep}
113 % \DoNotIndex{\@undefined,\MakeUppercase,\MessageBreak,\addtolength}
114 % \DoNotIndex{\advance,\baselineskip,\begin,\bibname,\c@enumiv,\chapter}
115 % \DoNotIndex{\clubpenalty,\csname,\def,\descriptionlabel,\divide,\edef}
116 % \DoNotIndex{\else,\end,\endcsname,\endlist,\expandafter,\fi,\footnote}
117 % \DoNotIndex{\g@addto@macro,\gdef,\hss,\ifnum,\ifx,\itemindent,\labelwidth}
118 % \DoNotIndex{\large,\let,\list,\llap,\multiply,\newcommand,\newenvironment}
119 % \DoNotIndex{\newif,\newlength,\newpage,\newtoks,\null,\p@enumiv,\par}
120 % \DoNotIndex{\refname,\relax,\renewcommand,\renewenvironment,\romannumeral}
121 % \DoNotIndex{\section,\setcounter,\setlength,\settowidth,\sfcode,\sloppy}
122 % \DoNotIndex{\small,\textbf,\thanks,\the,\theenumiv,\thr@@,\usecounter}
123 % \DoNotIndex{\vskip,\widowpenalty,\xdef,\z@}
124 %
125 % ^^A ----------------------------------------------------------------------
126 %
127 % \title{The \textsf{savetrees} package\thanks{This document
128 % corresponds to \textsf{savetrees}~\fileversion, dated \filedate.}}
129 % \author{Scott Pakin \\ \texttt{[email protected]}}
130 %
131 % ^^A Define macros for typesetting/indexing package and program names.
132 % \DeclareRobustCommand{\pkgname}[1]{^^A
133 % \textsf{#1}^^A
134 % \index{#1 (package)\actualchar\string\textsf{#1} (package)\encapchar usage}^^A
135 % \index{packages:\levelchar#1\actualchar^^A
136 % \string\textsf{#1}\encapchar usage}^^A
137 % }
138 % \DeclareRobustCommand{\progname}[1]{^^A
139 % \texttt{#1}^^A
140 % \index{#1 (program)\actualchar\string\texttt{#1} (program)\encapchar usage}^^A
141 % \index{programs:\levelchar#1\actualchar^^A
142 % \string\texttt{#1}\encapchar usage}^^A
143 % }
144 %
145 % ^^A Display and index a package option.
146 % \newcommand{\pkgoption}[1]{^^A
147 % \textsf{#1}^^A
148 % \index{#1 (package option)\actualchar^^A
149 % \string\textsf{#1} (package option)\encapchar usage}^^A
150 % \index{package options:\levelchar#1\actualchar^^A
151 % \string\textsf{#1}\encapchar usage}^^A
152 % }
153 %
154 % ^^A Define a macro to index an option declaration that appeared on the
155 % ^^A previous code line.
156 % \makeatletter
157 % \newcommand{\pkgoptiondecl}[1]{^^A
158 % \special@index{#1 (package option)\actualchar^^A
159 % \string\textsf{#1} (package option)\encapchar main}^^A
160 % \special@index{package options:\levelchar#1\actualchar^^A
161 % \string\textsf{#1}\encapchar main}^^A
162 % }
163 % \makeatother
164 %
165 % ^^A Define macros for computing the average character width of various fonts.
166 % \newcommand{\thousandletters}{^^A
167 % aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^^A
168 % bbbbbbbbb^^A
169 % cccccccccccccccccccccccccccccc^^A
170 % dddddddddddddddddddddddddddddddddddddddddddd^^A
171 % eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee^^A
172 % ffffffffffffffffffffffffffff^^A
173 % gggggggggggggggg^^A
174 % hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh^^A
175 % iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii^^A
176 % jj^^A
177 % kkk^^A
178 % lllllllllllllllllllllllllllllllllll^^A
179 % mmmmmmmmmmmmmmmmmmmmmmmmm^^A
180 % nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn^^A
181 % oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo^^A
182 % ppppppppppppppppppppppppppp^^A
183 % qqq^^A
184 % rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr^^A
185 % sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss^^A
186 % ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt^^A
187 % uuuuuuuuuuuuuuuuuuuuuuuuuuu^^A
188 % vvvvvvvvvvvvv^^A
189 % wwwwwwwwwwwwwwww^^A
190 % xxxxx^^A
191 % yyyyyyyyyyyyyyyyyyy^^A
192 % z^^A
193 % }
194 % \newlength{\thousandwidth}
195 % \makeatletter
196 % \newcommand{\fontwidth}[1]{^^A
197 % \settowidth{\thousandwidth}{\fontsize{10}{12}\fontfamily{#1}\selectfont\thousandletters}^^A
198 % \divide\thousandwidth by 1000\relax
199 % \strip@pt\thousandwidth
200 % }
201 % \makeatother
202 %
203 % ^^A Include "Table" and "Figure" in the hyperlink itself.
204 % \labelformat{table}{Table~#1}
205 % \labelformat{figure}{Figure~#1}
206 % \labelformat{section}{Section~#1}
207 % \labelformat{subsection}{Section~#1}
208 %
209 % ^^A Define a block of text to use to showcase savetrees's
210 % ^^A space-saving techniques.
211 % \newcommand*{\lipsumtext}{%
212 % Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
213 % dapibus tempus dolor ac dignissim. Nam et ante eu velit interdum
214 % bibendum. Etiam ligula dolor, varius at rutrum at, porta vit\ae{}
215 % lacus. Cras et elit ut lectus aliquet scelerisque ut sed arcu.
216 % Morbi eleifend iaculis augue non tristique. Pr\ae{}sent cursus
217 % iaculis diam et tristique. Curabitur facilisis, eros in scelerisque
218 % mollis, diam ante mollis purus, vel euismod neque velit vit\ae{}
219 % augue. In sit amet nulla odio, at ultrices dui. Quisque venenatis
220 % velit eget nulla ultrices rutrum. In hac habitasse platea dictumst.
221 % \AE{}nean odio turpis, laoreet non vulputate eu, fermentum sed
222 % metus.
223 % }
224 %
225 % ^^A Store \lipsumtext in a box so we can both measure and re-use it.
226 % \newsavebox{\normalbox}
227 % \savebox{\normalbox}{^^A
228 % \fbox{^^A
229 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
230 % \lipsumtext
231 % \end{minipage}}^^A
232 % }
233 %
234 % ^^A Define a macro that presents "before" and "after" comparisons
235 % ^^A of a savetrees space-saving technique.
236 % \newcommand{\comparisonfigure}[4][\lipsumtext]{^^A
237 % \begin{figure}[htbp]
238 % \savebox{\normalbox}{^^A
239 % \fbox{^^A
240 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
241 % #1
242 % \end{minipage}}}^^A
243 % \subfloat[\texttt{#2=normal}]{^^A
244 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
245 % \usebox{\normalbox}}^^A
246 % \hfill
247 % \subfloat[\texttt{#2=tight}]{^^A
248 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
249 % \fbox{^^A
250 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
251 % #3#1#4^^A
252 % \end{minipage}}}^^A
253 % \caption{Effect of the \texttt{#2} option}
254 % \label{fig:ex-#2}
255 % \end{figure}
256 % }
257 %
258 % ^^A Define macros for labeling lines of code.
259 % \makeatletter
260 % \newcommand{\labelprevcodeline}[1]{^^A
261 % \begingroup
262 % \edef\@currentlabel{\the\c@CodelineNo}^^A
263 % \label{#1}^^A
264 % \endgroup
265 % }
266 % \newcounter{nextCodelineNo}
267 % \newcommand{\labelnextcodeline}[1]{^^A
268 % \begingroup
269 % \setcounter{nextCodelineNo}{\c@CodelineNo}^^A
270 % \addtocounter{nextCodelineNo}{1}^^A
271 % \edef\@currentlabel{\thenextCodelineNo}^^A
272 % \label{#1}^^A
273 % \endgroup
274 % }
275 % \makeatother
276 %
277 %
278 % \sloppy
279 % \maketitle
280 %
281 %
282 % \section{Introduction}
283 %
284 % The goal of the \pkgname{savetrees} package is to pack as much text as
285 % possible onto each page of a \LaTeX{} document. Admittedly, this
286 % makes the document far less attractive. Nevertheless,
287 % \pkgname{savetrees} provides a simple way to save paper when printing
288 % draft copies of a document. It can also be useful when trying to meet
289 % a tight page-length requirement. For example, consider the difference
290 % between
291 %
292 % \savebox{\normalbox}{^^A
293 % \fbox{^^A
294 % \begin{minipage}[t]{\linewidth-2cm}^^A
295 % \lipsumtext
296 % \end{minipage}}^^A
297 % }
298 % \begin{center}
299 % \usebox{\normalbox}
300 % \end{center}
301 %
302 % \noindent
303 % and
304 %
305 % \newlength{\oldwordspacing}
306 % \setlength{\oldwordspacing}{\fontdimen2\font}
307 % \begin{center}
308 % \renewcommand{\baselinestretch}{0.95}^^A
309 % \fbox{^^A
310 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
311 % \begin{minipage}[t]{\linewidth-2cm}^^A
312 % \begin{microtypecontext}{expansion=tightcharwidths}^^A
313 % \SetTracking{encoding=*,shape=*}{-25}^^A
314 % \lsstyle
315 % \fontdimen2\font=0.75\oldwordspacing
316 % \lipsumtext
317 % \end{microtypecontext}^^A
318 % \end{minipage}}^^A
319 % \end{center}
320 %
321 % The former (default) layout looks nicer, but the latter consumes
322 % approximately~10\% less space.
323 %
324 % \bigskip
325 %
326 % The easiest way to use \pkgname{savetrees} is simply to place one of
327 % the following in your document's preable:
328 %
329 % \begin{itemize}
330 % \item |\usepackage[subtle]{savetrees}|
331 % \item |\usepackage[moderate]{savetrees}|
332 % \item |\usepackage[extreme]{savetrees}|
333 % \end{itemize}
334 %
335 % The first option, \pkgoption{subtle}, preserves all document layout
336 % and merely encourages \LaTeX\ to try harder to pack text onto the page
337 % while introducing white space only when absolutely necessary. The
338 % second option, \pkgoption{moderate}, additionally reduces paragraph
339 % indentation, typesets lists and mathematical displays without
340 % indentation or surrounding vertical space, reduces interline spacing,
341 % and makes the font slightly narrower, if supported. The third option,
342 % \pkgoption{extreme}, which is in fact the default if no package
343 % options are specified, turns on all of the space-saving techniques in
344 % \pkgname{savetrees}'s repertoire, including using smaller title and
345 % section fonts, typesetting the bibliography with a smaller font and no
346 % inter-item spacing, and substantially reducing the page margins. For
347 % a demonstration of these package options, see the accompanying
348 % \href[pdfnewwindow]{st-sample2e.pdf}{\texttt{st-sample2e.pdf}} file,
349 % which presents Lamport's ``An Example Document'' typeset both normally
350 % and with each of \pkgname{savetrees}'s \pkgoption{subtle},
351 % \pkgoption{moderate}, and \pkgoption{extreme} options.
352 %
353 % The following section describes those and the rest of
354 % \pkgname{savetrees}'s space-saving capabilities in more detail.
355 %
356 %
357 % \section{Usage}
358 %
359 % \vrefrange{tbl:st-opts-subt}{tbl:st-opts-ext} describe
360 % \pkgname{savetrees}'s main package options and summarize their
361 % implementation. Some package options merely load a package or
362 % redefine some variables. Others redefine entire environments to
363 % consume less space. A few resort to some underhanded \TeX\ trickery
364 % to squeeze as much text as possible onto the page.
365 % \makeatletter
366 % \@ifundefined{r@sec:savetrees.sty}{^^A
367 % See the \pkgname{savetrees} source code
368 % }{^^A
369 % See the annotated source code listing in \ref{sec:savetrees.sty}
370 % }^^A
371 % \makeatother
372 % for the definitive description of the mechanics underlying the
373 % \pkgname{savetrees} package.
374 %
375 % \newlength{\implwidth}
376 % \settowidth{\implwidth}{and \texttt{\string\belowdisplayshortskip}.}
377 % \begin{table}
378 % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt}
379 % \centering
380 % \topcaption{\pkgname{savetrees} package options for enabling/disabling
381 % space-saving techniques (\texttt{subtle})}
382 % \label{tbl:st-opts-subt}
383 % \renewcommand{\arraystretch}{2}
384 % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}}
385 % \toprule
386 % Option & Space-saving technique & Implementation \\
387 % \midrule
388 %
389 % \pkgoption{bibbreaks}
390 % & Allow page breaks within bibliographic entries.
391 % & Redefine Biblatex's \texttt{\string\bibsetup} hook. \\
392 %
393 % \pkgoption{paragraphs}
394 % & Discourage \TeX\ from allowing the last line of a paragraph to
395 % contain only a single word.
396 % & Reassign |\looseness|. \\
397 %
398 % \pkgoption{floats}
399 % & Relax float placement (more floats per page, increased ability to
400 % share pages with text, etc.).
401 % & Reassign \LaTeXe{} float variables. \\
402 %
403 % \pkgoption{mathspacing}
404 % & Reduce the amount of space within mathematical expressions.
405 % & Reassign |\thinmuskip|, |\medmuskip|, and |\thickmuskip|. \\
406 %
407 % \pkgoption{wordspacing}
408 % & Reduce the amount of space between words.
409 % & Reassign \texttt{\string\fontdimen2}. \\
410 %
411 % \pkgoption{tracking}
412 % & Reduce the amount of space between characters.
413 % & Pass options to the \pkgname{microtype} package. \\
414 %
415 % \bottomrule
416 % \end{tabularx}
417 % \end{adjustwidth}
418 % \end{table}
419 %
420 % \begin{table}
421 % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt}
422 % \centering
423 % \topcaption{\pkgname{savetrees} package options for enabling/disabling
424 % space-saving techniques (\texttt{moderate})}
425 % \label{tbl:st-opts-mod}
426 % \renewcommand{\arraystretch}{2}
427 % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}}
428 % \toprule
429 % Option & Space-saving technique & Implementation \\
430 % \midrule
431 %
432 % \pkgoption{bibnotes}
433 % & Ignore \texttt{NOTE} fields in the bibliography.
434 % & Pass information to |savetrees.bst| (\BibTeX) or |savetrees.bbx|
435 % (Biblatex). \\
436 %
437 % \pkgoption{charwidths}
438 % & Allow character glyphs to be drawn slightly narrower than
439 % normal.
440 % & Pass options to the \pkgname{microtype} package. \\
441 %
442 % \pkgoption{mathdisplays}
443 % & Reduce the amount of vertical space surrounding displayed mathematics.
444 % & Reassign |\abovedisplayskip|, |\belowdisplayskip|,
445 % |\abovedisplayshortskip|, and |\belowdisplayshortskip|. \\
446 %
447 % \pkgoption{leading}
448 % & Reduce interline spacing.
449 % & Reassign |\baselinestretch|. \\
450 %
451 % \pkgoption{indent}
452 % & Decrease paragraph indentation.
453 % & Reassign |\parindent|. \\
454 %
455 % \pkgoption{lists}
456 % & Remove both indentation and inter-item spacing from the various
457 % list environments.
458 % & Redefine the \texttt{itemize}, \texttt{enumerate}, and
459 % \texttt{description} environments. \\
460 %
461 % \bottomrule
462 % \end{tabularx}
463 % \end{adjustwidth}
464 % \end{table}
465 %
466 % \begin{table}
467 % \begin{adjustwidth}{1in-\marginparwidth-\marginparsep}{0pt}
468 % \centering
469 % \topcaption{\pkgname{savetrees} package options for enabling/disabling
470 % space-saving techniques (\texttt{extreme})}
471 % \label{tbl:st-opts-ext}
472 % \renewcommand{\arraystretch}{2}
473 % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}X>{\raggedright\arraybackslash}p{\implwidth}@{}}
474 % \toprule
475 % Option & Space-saving technique & Implementation \\
476 % \midrule
477 %
478 % \pkgoption{bibliography}
479 % & Typeset the bibliography in a smaller font and with no inter-item
480 % spacing.
481 % & Redefine \texttt{thebibliography}, |\bibfont|, and |\bibitemsep|. \\
482 %
483 % \pkgoption{title}
484 % & Typeset the document title with smaller fonts and with less
485 % surrounding white space.
486 % & Redefine |\maketitle|. \\
487 %
488 % \pkgoption{sections}
489 % & Typeset section titles with smaller fonts and with less surrounding
490 % white space.
491 % & Pass options to the \pkgname{titlesec} package. \\
492 %
493 % \pkgoption{margins}
494 % & Reduce the page margins.
495 % & Pass options to the \pkgname{geometry} package. \\
496 %
497 % \bottomrule
498 % \end{tabularx}
499 % \end{adjustwidth}
500 % \end{table}
501 %
502 % Each of the options that appears in \ref{tbl:st-opts-subt} through
503 % \ref{tbl:st-opts-ext} can be set to either |tight| or |normal|.
504 % |tight|, the default, enables the space-saving technique while
505 % |normal| disables it. For example, specifying
506 % |\usepackage[title=normal]{savetrees}| instructs \pkgname{savetrees}
507 % not to modify the font size and spacing used to typeset the document's
508 % title. The \pkgoption{all} option can be used to set all of
509 % \pkgname{savetrees}'s options en~masse to either |tight| or |normal|.
510 % For example, if only a few space-saving techniques should be enabled,
511 % it may be more convenient to specify |all=normal| followed by a small
512 % list of options set to |tight| than to specify |normal| typesetting
513 % for a large set of options. The arguments passed to |\usepackage| are
514 % processed left-to-right.
515 %
516 % As convenient shortcuts, the options in \ref{tbl:st-opts-subt} can be
517 % enabled as a group by passing the \pkgoption{subtle} option to
518 % \pkgname{savetrees}; the options in both \ref{tbl:st-opts-subt} and
519 % \ref{tbl:st-opts-mod} can be enabled as a group by passing the
520 % \pkgoption{moderate} option to \pkgname{savetrees}; and all of the
521 % options in \ref{tbl:st-opts-subt}, \ref{tbl:st-opts-mod}, and
522 % \ref{tbl:st-opts-ext} can be enabled as a group by passing the
523 % \pkgoption{extreme} option to \pkgname{savetrees}.
524 %
525 % The options in \ref{tbl:st-opts-subt} through \ref{tbl:st-opts-ext}
526 % are presented in roughly decreasing order of subtlety. If you find
527 % that \pkgname{savetrees}'s default options---or the
528 % \pkgoption{subtle}, \pkgoption{moderate}, and \pkgoption{extreme}
529 % meta-options---produce too hideous a result, try incrementally setting
530 % to |normal| the options from the bottom of the options list up, and
531 % see if doing so improves the document's appearance while still saving
532 % space over the non-\pkgname{savetrees} version. That is, start by
533 % including |margins=normal| in the optional argument to |\usepackage|.
534 % Then add |sections=normal|, then |title=normal|, and so forth,
535 % rebuilding the document and examining the result each time.
536 % Alternatively, if you need to save just a small amount of space
537 % (e.g.,~if your document is just barely over a maximum page length),
538 % specify |all=normal| then incrementally add options from the top of
539 % the three tables downwards: |paragraphs=tight|, then |floats=tight|,
540 % then |mathspacing=tight|, and so forth. \ref{sec:gallery} presents
541 % examples of some of \pkgname{savetrees}'s space-saving features so you
542 % can decide for yourself which are worth the price paid in typesetting
543 % elegance.
544 %
545 % Saving space in a document is always a balancing act between document
546 % aesthetics and the amount of space that can be saved. If you find
547 % that a particular space-saving option makes the document formatting
548 % just a little too ugly---or if you're willing to make it even uglier
549 % to save even more space---\pkgname{savetrees} provides additional
550 % package options that let you adjust the aggressiveness of various
551 % space-saving techniques. \vref{tbl:st-refinements} lists and
552 % describes these package options. As an example, \LaTeX's normal line
553 % height is defined to have a value of~1.0. When \pkgname{savetrees} is
554 % loaded with |leading=tight| (the default), \ref{tbl:st-refinements}
555 % indicates that the line height is reduced to 95\% of that.
556 % Additionally including |leadingfraction=0.98| on the |\usepackage| line
557 % increases the line height to 98\% of \LaTeX's default---still a space
558 % reduction but possibly a somewhat less overt one.
559 %
560 % \begin{table}
561 % \topcaption{\pkgname{savetrees} package options for refining the way
562 % space is saved}
563 % \label{tbl:st-refinements}
564 % \renewcommand{\arraystretch}{2}
565 % \begin{tabularx}{\linewidth}{@{}l>{\raggedright}Xlr@{}}
566 % \toprule
567 % Option & Description & \multicolumn{1}{l}{Requires \texttt{tight}} & Default \\
568 % \midrule
569 %
570 % \pkgoption{charwidthfraction}
571 % & Fraction of normal character widths
572 % & \pkgoption{charwidths}
573 % & 0.95 \\
574 %
575 % \pkgoption{leadingfraction}
576 % & Fraction of normal line height
577 % & \pkgoption{leading}
578 % & 0.95 \\
579 %
580 % \pkgoption{marginwidth}
581 % & Width of the page margins
582 % & \pkgoption{margins}
583 % & 1.5cm \\
584 %
585 % \pkgoption{parindent}
586 % & Paragraph indentation
587 % & \pkgoption{indent}
588 % & 1em \\
589 %
590 % \pkgoption{trackingfraction}
591 % & Fraction of normal inter-character spacing
592 % & \pkgoption{tracking}
593 % & 0.975 \\
594 %
595 % \pkgoption{wordspacingfraction}
596 % & Fraction of normal inter-word spacing
597 % & \pkgoption{wordspacing}
598 % & 0.8 \\
599 %
600 % \bottomrule
601 % \end{tabularx}
602 % \end{table}
603 %
604 % There are a few restrictions on the space-saving techniques that can
605 % be applied. The \pkgname{tracking} option requires pdf\LaTeX\@. The
606 % \pkgoption{charwidths} option requires either pdf\LaTeX\ or
607 % Lua\LaTeX\@. For both options, pdf\LaTeX\ must be in PDF mode, not
608 % DVI mode. See the \pkgname{microtype} documentation for additional
609 % (and possibly more up-to-date) information.
610 %
611 %
612 % \section{Abbreviating bibliographic information}
613 %
614 % One of the advantages of a tool like \BibTeX\ is that the
615 % bibliographic database can---and should---contain complete
616 % bibliographic information for each reference while style files
617 % determine the subset of that information that is actually typeset.
618 % Hence, to help further reduce a document's length, the
619 % \pkgname{savetrees} package additionally provides a \BibTeX{} style
620 % file, |savetrees.bst|, which exhibits the following salient
621 % differences from |plain.bst|:
622 %
623 % \begin{itemize}
624 % \item Abbreviations are used wherever possible:
625 %
626 % \begin{center}
627 % \begin{tabular}{l@{\quad$\Longrightarrow$\quad}l}
628 % chapter & chap. \\
629 % edition & ed. \\
630 % editor \emph{or} editors & ed.\ \emph{or} eds. \\
631 % January, February,~\dots & Jan., Feb.,~\dots \\
632 % page \emph{or} pages & p.\ \emph{or} pp. \\
633 % Technical Report & Tech. Rep. \\
634 % \end{tabular}
635 % \end{center}
636 %
637 % \item At most two authors are listed. The remainder are replaced by
638 % ``et al.''
639 %
640 % \item Authors' names are abbreviated to their initials plus surname
641 % (e.g.,~``S.~D.~Pakin'').
642 % \end{itemize}
643 %
644 % \noindent
645 % In addition, |savetrees.bst| does not normally typeset |NOTE| fields,
646 % although it can be instructed to do so by passing \pkgname{savetrees}
647 % the |bibnotes=normal| package option.
648 %
649 % To use |savetrees.bst|, simply replace your document's existing
650 % |\bibliographystyle| line with ``|\bibliographystyle{savetrees}|''.
651 % Then, to give |savetrees.bst|---or \emph{any} \BibTeX{} style
652 % file---maximum flexibility, you should obey the following rules when
653 % writing your |.bib| file:
654 %
655 % \begin{enumerate}
656 % \item Use the three-letter month macros defined by virtually all
657 % \BibTeX{} style files instead of spelling out month names
658 % explicitly:
659 %
660 % \begin{tabularx}{\linewidth}{@{}lX@{}}
661 % \toprule
662 % Good: & \texttt{MONTH = sep,} \\
663 % & Can be typeset as ``September'', ``Sept.'', ``SEP'',
664 % ``Septiembre'', etc. \\
665 %
666 % Bad: & \texttt{MONTH = \{September\},} \\
667 % & Can be typeset only as ``September''. \\
668 % \bottomrule
669 % \end{tabularx}
670 %
671 % \item Include authors' full names (or as much of each name as is
672 % available); let \BibTeX{} abbreviate as necessary:
673 %
674 % \begin{tabularx}{\linewidth}{@{}lX@{}}
675 % \toprule
676 % Good: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla\}}, \\
677 % & Can be typeset either in full or abbreviated to
678 % ``Rufus~X. Sarsaparilla'', ``R.~X. Sarsaparilla'', etc. \\
679 %
680 % Bad: & \texttt{AUTHOR = \{R.~X. Sarsaparilla\}}, \\
681 % & Can be typeset only as ``R.~X. Sarsaparilla'' and can't
682 % be expanded to the full name. \\
683 % \bottomrule
684 % \end{tabularx}
685 %
686 % \item Include the names of \emph{all} authors; let \BibTeX{} decide
687 % where to truncate the list:
688 %
689 % \begin{tabularx}{\linewidth}{@{}lX@{}}
690 % \toprule
691 %
692 % Good: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla and
693 % Rafaella Gabriela Sarsaparilla and Albert Andreas
694 % Armadillo\},} \\
695 % & All authors can be named, or the list can be truncated at any
696 % point with ``et al.'', ``and others'', or whatever. \\
697 %
698 % Bad: & \texttt{AUTHOR = \{Rufus Xavier Sarsaparilla and others\},} \\
699 % & At most one author can be named, but ``and others'' can
700 % still be replaced by ``et al.''\ or a different phrase,
701 % and the author's name can still be abbreviated, as
702 % discussed in the previous rule. \\
703 % Worse: & \texttt{AUTHOR = \{\{Rufus Xavier Sarsaparilla, et al.\}\},} \\
704 % & Can be typeset only precisely as ``Rufus Xavier
705 % Sarsaparilla, et al.'' \\
706 % \bottomrule
707 % \end{tabularx}
708 % \end{enumerate}
709 %
710 % The \pkgname{savetrees} \BibTeX{} style utilizes the same fields as
711 % the standard \BibTeX{} styles (|plain|, |alpha|, |abbrv|, |unsrt|,
712 % etc.), with the exception that the |NOTE| field is suppressed unless
713 % the |bibnotes=normal| package option is provided.
714 %
715 % \bigskip
716 %
717 % In addition to |savetrees.bst|, \pkgname{savetrees} provides analogous
718 % Biblatex style files: |savetrees.bbx| and |savetrees.cbx|. Like their
719 % \BibTeX\ counterpart, they use abbreviated terms whenever possible,
720 % list at most two authors before truncating them with ``et~al.'', and
721 % abbreviate authors' names to initials plus surname.
722 %
723 % To use the \pkgname{savetrees} Biblatex style files, simply load
724 % \pkgname{biblatex} with ``|\usepackage[style=savetrees]{biblatex}|''.
725 % By default, the bibliography style suppresses the |isbn| |url|, |doi|,
726 % and |eprint| fields from typesetting, but these can be re-enabled
727 % explicitly:
728 %
729 % \begin{verbatim}
730 % \usepackage[style=savetrees,isbn,url,doi,eprint]{biblatex}
731 % \end{verbatim}
732 %
733 % The \pkgname{savetrees} \BibTeX\ and Biblatex style files can be
734 % used independently of |savetrees.sty|.
735 %
736 %
737 % \changes{v2.0}{2011/05/03}{Removed the awkward-to-use
738 % \progname{makethin} script now that the \pkgname{microtype} package
739 % can shrink character widths more automatically}
740 %
741 % \StopEventually{^^A
742 % \labelformat{section}{Appendix~##1}
743 % \appendix
744 % \section{Average character widths of common fonts}
745 %
746 % \paragraph{Question:}
747 % What's the narrowest font?
748 %
749 % \paragraph{Answer:}
750 % It depends upon how you measure. \ref{tbl:font-widths} shows,
751 % for various 10\,pt.\ fonts, the width in points of 1000 lowercase
752 % letters with relative frequencies chosen to match ``typical'' English
753 % text. There are 130~e's, 93~t's, 78~n's, 77~r's, and so forth down
754 % the frequency distribution. According to the table, Times is
755 % statistically likely to be the best typeface for maximizing the amount
756 % of text on the page. However, Times may not be the narrowest for
757 % \emph{your} document; you'll have to experiment and see.
758 %
759 % \begin{table}[htbp]
760 % \centering
761 % \begin{tabular}{@{}l>{\sffamily\selectfont}l@{\qquad}D{.}{.}{-1}@{}}
762 % \hline
763 % Typeface &
764 % \multicolumn{1}{l}{Package} &
765 % \multicolumn{1}{l@{}}{Avg. width (pt.)} \\
766 % \hline
767 %
768 % Times & mathptmx & \fontwidth{ptm} \\
769 % Computer Modern & \multicolumn{1}{l}{(default)} & \fontwidth{cmr} \\
770 % Charter & charter & \fontwidth{bch} \\
771 % Helvetica & helvet & \fontwidth{phv} \\
772 % Palatino & mathpazo & \fontwidth{ppl} \\
773 % Utopia & utopia & \fontwidth{put} \\
774 % New Century Schoolbook & newcent & \fontwidth{pnc} \\
775 % Avant Garde & avant & \fontwidth{pag} \\
776 % Bookman & bookman & \fontwidth{pbk} \\
777 % Courier & courier & \fontwidth{pcr} \\
778 % \hline
779 % \end{tabular}
780 % \caption{Common fonts sorted by increasing width}
781 % \label{tbl:font-widths}
782 % \end{table}
783 %
784 % Although \pkgname{savetrees} does not automatically change the
785 % document font it does specify that character glyphs may be typeset
786 % narrower than normal (cf.~the \pkgoption{charwidth} option). Note,
787 % however, that \pkgname{savetrees} unfortunately has no control over
788 % precisely which lines of text are typeset with narrow characters.
789 % This narrowing technique works only with pdf\LaTeX, so that program
790 % should be used if possible to maximize the space-saving achievable
791 % with \pkgname{savetrees}.
792 %
793 %
794 % \section{Gallery of space-saving techniques}
795 % \label{sec:gallery}
796 %
797 % \ref{fig:ex-lists} through \ref{fig:ex-leading}
798 % \vpagerefrange{fig:ex-lists}{fig:ex-leading} provide examples of some
799 % of the ways that \pkgname{savetrees} saves space when typesetting
800 % text. Each figure showcases a single space-saving technique in
801 % isolation. The default pararameters are used for each technique.
802 % \vref{tbl:st-refinements} documents the package options that can be
803 % used to refine these parameters either to save more space or to make
804 % the typesetting less offensive.
805 %
806 % \ref{fig:ex-lists} shows how setting |lists=tight| saves space by
807 % reducing the white space above, below, and within list environments (in
808 % this case, the |itemize| environment). \ref{fig:ex-mathspacing} shows
809 % how setting |mathspacing=tight| saves space by typesetting
810 % mathematical expressions denser. \ref{fig:ex-mathdisplays} shows how
811 % setting |mathdisplays=tight| removes the space around mathematical
812 % displays (e.g.,~\texttt{\string\[}\dots\texttt{\string\]} or
813 % \texttt{\string\begin\string{equation\string}}\dots\linebreak[0]\texttt{\string\end\string{equation\string}}).
814 % \ref{fig:ex-wordspacing} shows how setting |wordspacing=tight| saves
815 % space by typesetting words closer together. \ref{fig:ex-tracking}
816 % shows how setting |tracking=tight| saves space by typesetting the
817 % characters within a word closer together. \ref{fig:ex-charwidths}
818 % shows how setting |charwidths=tight| saves space by narrowing the
819 % individual character glyphs without affecting the font's point size
820 % (height) or amount of white space. Finally, \ref{fig:ex-leading} shows
821 % how setting |leading=tight| saves space by removing white space between
822 % adjacent lines of text. Again, these techniques are shown with their
823 % default parameters, which can be adjusted if desired.
824 %
825 % While \ref{fig:ex-lists} through \ref{fig:ex-leading} each illustrate
826 % a single space-saving technique, \vref{fig:ex-multiple} demonstrates
827 % that when multiple techniques are used in combination, the benefits
828 % are essentially additive.
829 %
830 % \begin{figure}[htbp]
831 % \savebox{\normalbox}{^^A
832 % \fbox{^^A
833 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
834 % Lorem ipsum dolor sit amet, consectetur adipiscing elit.
835 % \begin{itemize}
836 % \item curabitur
837 % \item tellus
838 % \item nulla
839 % \end{itemize}
840 % Quisque feugiat lacinia mauris ut tincidunt.
841 % \end{minipage}}}^^A
842 % \subfloat[\texttt{lists=normal}]{^^A
843 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
844 % \usebox{\normalbox}}^^A
845 % \hfill
846 % \subfloat[\texttt{lists=tight}]{^^A
847 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
848 % \fbox{^^A
849 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
850 % Lorem ipsum dolor sit amet, consectetur adipiscing elit.
851 % \begin{list}{\labelitemi}{^^A
852 % \def\makelabel##1{\hss\llap{##1}}
853 % \settowidth{\leftmargin}{\labelitemi}^^A
854 % \addtolength{\leftmargin}{\labelsep}^^A
855 % \setlength{\partopsep}{0pt plus 4pt}^^A
856 % \setlength{\topsep}{0pt plus 4pt}^^A
857 % \setlength{\itemsep}{0pt}^^A
858 % \setlength{\parsep}{0pt}^^A
859 % \setlength{\listparindent}{1em}^^A
860 % }^^A
861 % \item curabitur
862 % \item tellus
863 % \item nulla
864 % \end{list}
865 % Quisque feugiat lacinia mauris ut tincidunt.
866 % \end{minipage}}}^^A
867 % \caption{Effect of the \texttt{lists} option}
868 % \label{fig:ex-lists}
869 % \end{figure}
870 %
871 % \comparisonfigure[^^A
872 % Lorem ipsum dolor sit amet, consectetur adipiscing elit
873 % ${\cal H} = T + V$
874 % quisque feugiat
875 % $T = \frac{p^2}{2m}$
876 % lacinia mauris
877 % $V = V(q)$
878 % ut tincidunt. Etiam ligula dolor
879 % ${\cal H} = \sum_i \dot{q_i}
880 % \frac{\partial \cal L}{\partial \dot{q_i}} -
881 % {\cal L} = \sum_i \dot{q_i} p_i - {\cal L}$
882 % eget nulla.
883 % ]^^A
884 % {mathspacing}
885 % {^^A
886 % \thinmuskip=0mu plus 3mu
887 % \medmuskip=1mu plus 4mu
888 % \thickmuskip=2mu plus 5mu
889 % }{}
890 %
891 % \comparisonfigure[^^A
892 % Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dapibus
893 % \[
894 % \mathrm{d}{\cal L}
895 % = \sum_i
896 % \left(
897 % \frac{\partial {\cal L}}{\partial q_i} \mathrm{d}q_i +
898 % p_i \mathrm{d}\dot{q}_i
899 % \right) +
900 % \frac{\partial {\cal L}}{\partial t} \mathrm{d}t
901 % \]
902 % tempus dolor ac dignissim. Etiam ligula dolor, varius at rutrum.
903 % ]^^A
904 % {mathdisplays}
905 % {^^A
906 % \abovedisplayskip=0pt plus 3pt
907 % \belowdisplayskip=0pt plus 3pt
908 % \abovedisplayshortskip=0pt plus 3pt
909 % \belowdisplayshortskip=0pt plus 3pt
910 % }{}
911 %
912 % \newlength{\origwordspacing}
913 % \setlength{\origwordspacing}{\fontdimen2\font}
914 % \comparisonfigure{wordspacing}{^^A
915 % \fontdimen2\font=0.75\origwordspacing
916 % }{^^A
917 % \fontdimen2\font=\origwordspacing
918 % }
919 %
920 % \comparisonfigure{tracking}{^^A
921 % \SetTracking{encoding=*,shape=*}{-25}^^A
922 % \lsstyle
923 % }{}
924 %
925 % \comparisonfigure{charwidths}{^^A
926 % \begin{microtypecontext}{expansion=tightcharwidths}^^A
927 % }{^^A
928 % \end{microtypecontext}^^A
929 % }
930 %
931 % \comparisonfigure{leading}{\fontsize{10}{11.4}\selectfont}{}
932 %
933 % \begin{figure}[htbp]
934 % \savebox{\normalbox}{^^A
935 % \fbox{^^A
936 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
937 % \lipsumtext
938 % \end{minipage}}}^^A
939 % \subfloat[\texttt{all=normal}]{^^A
940 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
941 % \usebox{\normalbox}}^^A
942 % \hfill
943 % \subfloat[\texttt{wordspacing=tight, tracking=tight,
944 % charwidths=tight, leading=tight}]{^^A
945 % \rule[-\dp\normalbox]{0pt}{\dp\normalbox}^^A
946 % \fbox{^^A
947 % \begin{minipage}[t]{0.5\linewidth-0.5cm}^^A
948 % \fontdimen2\font=0.75\origwordspacing
949 % \fontsize{10}{11.4}\selectfont
950 % \begin{microtypecontext}{expansion=tightcharwidths}^^A
951 % \lsstyle
952 % \lipsumtext
953 % \end{microtypecontext}^^A
954 % \fontdimen2\font=\origwordspacing
955 % \end{minipage}}}^^A
956 % \caption{Combined effect of using multiple options}
957 % \label{fig:ex-multiple}
958 % \end{figure}
959 %
960 % }
961 %
962 %
963 % \section{Implementation of \texttt{savetrees.sty}}
964 % \label{sec:savetrees.sty}
965 %
966 % This section presents the complete, commented source code for the
967 % \pkgname{savetrees} package. Although reading this section---and the
968 % subsequent implementation sections---is not necessary for
969 % understanding how to use \pkgname{savetrees}, it may be a useful
970 % teaching instrument for \LaTeX{} newcomers who want to learn more
971 % about fine-tuning document formatting.
972 %
973 % \iffalse
974 %<*package>
975 % \fi
976 %
977 % \subsection{Default values}
978 %
979 % \pkgname{savetrees} attempts to provide a reasonable balance between
980 % aesthetics and the amount of space saved in a document. However,
981 % \pkgname{savetrees} does enable the document author to adjust a number
982 % of parameters to bias \pkgname{savetrees}'s behavior towards either
983 % reduced document length or prettier output. This section defines the
984 % default values for various package parameters.
985 %
986 % \begin{macro}{\st@margin@width}
987 % When |margins=tight|, |\st@margin@width| specifies how wide the page
988 % margins should be. The default, 1.5\,cm, is extremely small, but it
989 % can sure save a lot of space on the page.
990 % \begin{macrocode}
991 \newcommand*{\st@margin@width}{1.5cm}
992 % \end{macrocode}
993 % \end{macro}
994 %
995 % \begin{macro}{\st@parindent}
996 % The standard \LaTeX\ classes (|article|, |report|, and |book|) define
997 % paragraph indentation as follows. If |twocolumn| is in effect,
998 % |\parindent| is set to 1\,em. Otherwise, if the base font size is
999 % 10\,pt., |\parindent| is set to 15\,pt.; if the base font size is
1000 % 11\,pt., |\parindent| is set to 17\,pt.; and if the base font size is
1001 % 12\,pt., |\parindent| is set to 1.5\,em. When |indent=tight|,
1002 % \pkgname{savetrees} uses a default of 1\,em---approximately a third of
1003 % the no-\pkgname{savetrees} value---regardless of font size.
1004 % \begin{macrocode}
1005 \newcommand*{\st@parindent}{1em}
1006 % \end{macrocode}
1007 % \end{macro}
1008 %
1009 % \begin{macro}{\st@baselinestretch}
1010 % Depending on font size, the standard \LaTeX\ classes (|article|,
1011 % |report|, and |book|) use 2--2.6\,pt.\ lead (inter-line spacing), or
1012 % approximately~20\% of font size. Specifically, they typeset body text
1013 % at 10/12, 11/13.6, or 12/14.5. When |leading=tight|,
1014 % \pkgname{savetrees} reduces the line spacing to 95\% of normal or an
1015 % average of about~0.67\,pt.\ less lead than \LaTeX's defaults: 10/11.4,
1016 % 11/12.92, or 12/13.78. 95\% gives very good compression but still
1017 % prevents descenders from running into successive ascenders.
1018 % \begin{macrocode}
1019 \newcommand*{\st@baselinestretch}{0.95}
1020 % \end{macrocode}
1021 % \end{macro}
1022 %
1023 % \begin{macro}{\st@char@shrink}
1024 % When |charwidths=tight|, \pkgname{savetrees} disables font expansion
1025 % but enables font compaction. The default contraction of 5\% (50/1000)
1026 % of normal character widths is largely undetectable to the casual
1027 % observer but can save a great deal of space over the course of a long
1028 % document.
1029 % \begin{macrocode}
1030 \newcommand*{\st@char@shrink}{50}
1031 % \end{macrocode}
1032 % \end{macro}
1033 %
1034 % \begin{macro}{\st@cspace@shrink}
1035 % \pkgname{savetrees} reduces tracking (inter-character spacing)
1036 % when |tracking=tight|. By default, tracking is set to -2.5\%
1037 % (-25/1000) of an em~width. When decreased much more than that,
1038 % characters begin to overlap and become hard to read.
1039 % \begin{macrocode}
1040 \newcommand*{\st@cspace@shrink}{-25}
1041 % \end{macrocode}
1042 % \end{macro}
1043 %
1044 % \begin{macro}{\st@wspace@factor}
1045 % \pkgname{savetrees} reduces inter-word spacing when
1046 % |wordspacing=tight|. By default, inter-word spacing is set to 80\% of
1047 % normal. If decreased much beyond that, words start to run together
1048 % and become hard to read.
1049 % \begin{macrocode}
1050 \newcommand*{\st@wspace@factor}{0.8}
1051 % \end{macrocode}
1052 % \end{macro}
1053 %
1054 %
1055 % \subsection{Option processing}
1056 % \label{sec:options}
1057 %
1058 % \subsubsection{Enabling/disabling space-saving techniques}
1059 %
1060 % By default, \pkgname{savetrees} tries to make documents extremely
1061 % dense. However, this also makes them rather ugly. The package
1062 % options defined below let the author specify which space-saving
1063 % routines are unacceptably grotesque and should not be utilized.
1064 %
1065 % \bigskip
1066 %
1067 % \pkgname{savetrees} uses the \pkgname{xkeyval} package to parse its
1068 % package options.
1069 % \begin{macrocode}
1070 \RequirePackage{xkeyval}
1071 % \end{macrocode}
1072 %
1073 % \pkgname{savetrees} uses the \pkgname{ifpdf} and \pkgname{ifluatex}
1074 % packages to control the use of the \pkgname{microtype} package.
1075 % \begin{macrocode}
1076 \RequirePackage{ifpdf}
1077 \RequirePackage{ifluatex}
1078 % \end{macrocode}
1079 %
1080 % \begin{macro}{\st@more@packages}
1081 % \begin{macro}{\st@RequirePackage}
1082 % As we process the package options we may encounter additional packages
1083 % that we need to load. Rather than load them eagerly, which may lead
1084 % to the same package problematically being loaded twice with different
1085 % options, we merely construct a list of required packages. Then, as
1086 % \pkgname{savetrees}'s last action before finishing, it loads all of
1087 % the pending packages. |\st@RequirePackage| takes the same arguments
1088 % as |\RequirePackage| but simply adds the package name to the
1089 % |\st@more@packages| list and instructs \LaTeXe\ to eventually pass the
1090 % given arguments, if any, to the package.
1091 % \begin{macrocode}
1092 \def\st@more@packages{}
1093 % \end{macrocode}
1094 % \begin{macrocode}
1095 \newcommand*{\st@RequirePackage}[2][]{%
1096 \PassOptionsToPackage{#1}{#2}%
1097 \@cons\st@more@packages{{#2}}%
1098 }
1099 % \end{macrocode}
1100 % \begin{macrocode}
1101 \AtEndOfPackage{%
1102 \let\@elt=\RequirePackage
1103 \st@more@packages
1104 \let\@elt=\relax
1105 }
1106 % \end{macrocode}
1107 % \end{macro}
1108 % \end{macro}
1109 %
1110 % \begin{macro}{\st@define@option}
1111 % \begin{macro}{\st@arg}
1112 % \begin{macro}{\st@arg@num}
1113 % \pkgname{savetrees} accepts a large number of package options, each of
1114 % which can be set to |tight| (the default) to enable a feature or
1115 % |normal| to disable it. As the definitions of these options are fairly
1116 % repetitive, we define a helper macro to assist with the processing.
1117 % \begin{macrocode}
1118 \newcommand*{\st@define@option}[1]{%
1119 \expandafter\newif\csname if@st@tight@#1\endcsname
1120 \csname @st@tight@#1true\endcsname
1121 \define@choicekey{savetrees}{#1}[\st@arg\st@arg@num]{tight,normal}[tight]{%
1122 \ifnum\st@arg@num=0
1123 \csname @st@tight@#1true\endcsname
1124 \else
1125 \csname @st@tight@#1false\endcsname
1126 \fi
1127 }%
1128 \DeclareOptionX{#1}[tight]{\csname KV@savetrees@#1\endcsname{##1}}%
1129 }
1130 % \end{macrocode}
1131 % \end{macro}
1132 % \end{macro}
1133 % \end{macro}
1134 %
1135 % Using the preceding macro we define one conditional and one package
1136 % option for each trick in \pkgname{savetrees}'s book. When
1137 % \emph{true} (caused by passing |tight| to the package option), the
1138 % conditional enables the corresponding space compression; when
1139 % \emph{false}, (caused by passing |normal| to the package option),
1140 % \pkgname{savetrees} leaves alone that aspect of the formatting.
1141 %
1142 % \begin{macro}{\if@st@tight@sections}
1143 % \begin{macro}{\@st@tight@sectionstrue}
1144 % \begin{macro}{\@st@tight@sectionsfalse}
1145 % \begin{macro}{\KV@savetrees@sections}
1146 % The \pkgoption{sections} package option enables or disables
1147 % \pkgname{savetrees}'s modifications to section titles by setting
1148 % |\@st@tight@sectionstrue| or |\@st@tight@sectionsfalse|, respectively.
1149 % \begin{macrocode}
1150 \st@define@option{sections}
1151 % \end{macrocode}
1152 % \pkgoptiondecl{sections}
1153 % \end{macro}
1154 % \end{macro}
1155 % \end{macro}
1156 % \end{macro}
1157 %
1158 % \begin{macro}{\if@st@tight@margins}
1159 % \begin{macro}{\@st@tight@marginstrue}
1160 % \begin{macro}{\@st@tight@marginsfalse}
1161 % \begin{macro}{\KV@savetrees@margins}
1162 % The \pkgoption{margins} package option enables or disables
1163 % \pkgname{savetrees}'s modifications to page margins by setting
1164 % |\@st@tight@marginstrue| or |\@st@tight@marginsfalse|, respectively.
1165 % \begin{macrocode}
1166 \st@define@option{margins}
1167 % \end{macrocode}
1168 % \pkgoptiondecl{margins}
1169 % \end{macro}
1170 % \end{macro}
1171 % \end{macro}
1172 % \end{macro}
1173 %
1174 % \begin{macro}{\if@st@tight@lists}
1175 % \begin{macro}{\@st@tight@liststrue}
1176 % \begin{macro}{\@st@tight@listsfalse}
1177 % \begin{macro}{\KV@savetrees@lists}
1178 % The \pkgoption{lists} package option enables or disables
1179 % \pkgname{savetrees}'s modifications to the various list environments
1180 % by setting |\@st@tight@liststrue| or |\@st@tight@listsfalse|,
1181 % respectively.
1182 % \begin{macrocode}
1183 \st@define@option{lists}
1184 % \end{macrocode}
1185 % \pkgoptiondecl{lists}
1186 % \end{macro}
1187 % \end{macro}
1188 % \end{macro}
1189 % \end{macro}
1190 %
1191 % \begin{macro}{\if@st@tight@floats}
1192 % \begin{macro}{\@st@tight@floatstrue}
1193 % \begin{macro}{\@st@tight@floatsfalse}
1194 % \begin{macro}{\KV@savetrees@floats}
1195 % The \pkgoption{floats} package option enables or disables
1196 % \pkgname{savetrees}'s modifications to \LaTeX's float-placement
1197 % parameters by setting |\@st@tight@floatstrue| or
1198 % |\@st@tight@floatsfalse|, respectively.
1199 % \begin{macrocode}
1200 \st@define@option{floats}
1201 % \end{macrocode}
1202 % \pkgoptiondecl{floats}
1203 % \end{macro}
1204 % \end{macro}
1205 % \end{macro}
1206 % \end{macro}
1207 %
1208 % \begin{macro}{\if@st@tight@indent}
1209 % \begin{macro}{\@st@tight@indenttrue}
1210 % \begin{macro}{\@st@tight@indentfalse}
1211 % \begin{macro}{\KV@savetrees@indent}
1212 % The \pkgoption{indent} package option enables or disables
1213 % \pkgname{savetrees}'s modifications to paragraph indentation by
1214 % setting |\@st@tight@indenttrue| or |\@st@tight@indentfalse|,
1215 % respectively.
1216 % \begin{macrocode}
1217 \st@define@option{indent}
1218 % \end{macrocode}
1219 % \pkgoptiondecl{indent}
1220 % \end{macro}
1221 % \end{macro}
1222 % \end{macro}
1223 % \end{macro}
1224 %
1225 % \begin{macro}{\if@st@tight@title}
1226 % \begin{macro}{\@st@tight@titletrue}
1227 % \begin{macro}{\@st@tight@titlefalse}
1228 % \begin{macro}{\KV@savetrees@title}
1229 % The \pkgoption{title} package option enables or disables
1230 % \pkgname{savetrees}'s modifications to title formatting by setting
1231 % |\@st@tight@titletrue| or |\@st@tight@titlefalse|, respectively.
1232 % \begin{macrocode}
1233 \st@define@option{title}
1234 % \end{macrocode}
1235 % \pkgoptiondecl{title}
1236 % \end{macro}
1237 % \end{macro}
1238 % \end{macro}
1239 % \end{macro}
1240 %
1241 % \begin{macro}{\if@st@tight@leading}
1242 % \begin{macro}{\@st@tight@leadingtrue}
1243 % \begin{macro}{\@st@tight@leadingfalse}
1244 % \begin{macro}{\KV@savetrees@leading}
1245 % The \pkgoption{leading} package option enables or disables
1246 % \pkgname{savetrees}'s modifications to interline spacing by setting
1247 % |\@st@tight@leadingtrue| or |\@st@tight@leadingfalse|, respectively.
1248 % This interline spacing is known as ``leading'' because of the
1249 % additional strips of lead placed between lines in the days of metal
1250 % type.
1251 % \begin{macrocode}
1252 \st@define@option{leading}
1253 % \end{macrocode}
1254 % \pkgoptiondecl{leading}
1255 % \end{macro}
1256 % \end{macro}
1257 % \end{macro}
1258 % \end{macro}
1259 %
1260 % \begin{macro}{\if@st@tight@paragraphs}
1261 % \begin{macro}{\@st@tight@paragraphstrue}
1262 % \begin{macro}{\@st@tight@paragraphsfalse}
1263 % \begin{macro}{\KV@savetrees@paragraphs}
1264 % The \pkgoption{paragraphs} package option enables or disables
1265 % \pkgname{savetrees}'s modifications to \TeX's paragraph looseness
1266 % (i.e.,~the number of lines by which \TeX\ is instructed to shrink each
1267 % paragraph) by setting |\@st@tight@paragraphstrue| or
1268 % |\@st@tight@paragraphsfalse|, respectively.
1269 % \begin{macrocode}
1270 \st@define@option{paragraphs}
1271 % \end{macrocode}
1272 % \pkgoptiondecl{paragraphs}
1273 % \end{macro}
1274 % \end{macro}
1275 % \end{macro}
1276 % \end{macro}
1277 %
1278 % \begin{macro}{\if@st@tight@charwidths}
1279 % \begin{macro}{\@st@tight@charwidthstrue}
1280 % \begin{macro}{\@st@tight@charwidthsfalse}
1281 % \begin{macro}{\KV@savetrees@charwidths}
1282 % The \pkgoption{charwidths} package option enables or disables
1283 % \pkgname{savetrees}'s modifications to character width by setting
1284 % |\@st@tight@charwidthstrue| or |\@st@tight@charwidthsfalse|,
1285 % respectively.
1286 % \begin{macrocode}
1287 \st@define@option{charwidths}
1288 % \end{macrocode}
1289 % \pkgoptiondecl{charwidths}
1290 % \end{macro}
1291 % \end{macro}
1292 % \end{macro}
1293 % \end{macro}
1294 %
1295 % \begin{macro}{\if@st@tight@tracking}
1296 % \begin{macro}{\@st@tight@trackingtrue}
1297 % \begin{macro}{\@st@tight@trackingfalse}
1298 % \begin{macro}{\KV@savetrees@tracking}
1299 % The \pkgoption{tracking} package option enables or disables
1300 % \pkgname{savetrees}'s modifications to tracking (spacing between
1301 % letters) by setting |\@st@tight@trackingtrue| or
1302 % |\@st@tight@trackingfalse|, respectively.
1303 % \begin{macrocode}
1304 \st@define@option{tracking}
1305 % \end{macrocode}
1306 % \pkgoptiondecl{tracking}
1307 % \end{macro}
1308 % \end{macro}
1309 % \end{macro}
1310 % \end{macro}
1311 %
1312 % \begin{macro}{\if@st@tight@wordspacing}
1313 % \begin{macro}{\@st@tight@wordspacingtrue}
1314 % \begin{macro}{\@st@tight@wordspacingfalse}
1315 % \begin{macro}{\KV@savetrees@wordspacing}
1316 % The \pkgoption{wordspacing} package option enables or disables
1317 % \pkgname{savetrees}'s modifications to inter-word spacing by setting
1318 % |\@st@tight@wordspacingtrue| or |\@st@tight@wordspacingfalse|,
1319 % respectively.
1320 % \begin{macrocode}
1321 \st@define@option{wordspacing}
1322 % \end{macrocode}
1323 % \pkgoptiondecl{wordspacing}
1324 % \end{macro}
1325 % \end{macro}
1326 % \end{macro}
1327 % \end{macro}
1328 %
1329 % \begin{macro}{\if@st@tight@bibliography}
1330 % \begin{macro}{\@st@tight@bibliographytrue}
1331 % \begin{macro}{\@st@tight@bibliographyfalse}
1332 % \begin{macro}{\KV@savetrees@bibliography}
1333 % The \pkgoption{bibliography} package option enables or disables
1334 % \pkgname{savetrees}'s modifications to bibliography formatting by
1335 % setting |\@st@tight@bibliographytrue| or
1336 % |\@st@tight@bibliographyfalse|, respectively.
1337 % \begin{macrocode}
1338 \st@define@option{bibliography}
1339 % \end{macrocode}
1340 % \pkgoptiondecl{bibliography}
1341 % \end{macro}
1342 % \end{macro}
1343 % \end{macro}
1344 % \end{macro}
1345 %
1346 % \begin{macro}{\if@st@tight@bibnotes}
1347 % \begin{macro}{\@st@tight@bibnotestrue}
1348 % \begin{macro}{\@st@tight@bibnotesfalse}
1349 % \begin{macro}{\KV@savetrees@bibnotes}
1350 % The \pkgoption{bibnotes} package option conditionally excludes or
1351 % includes |NOTE| fields when using |savetrees.bst| by setting
1352 % |\@st@tight@bibnotestrue| or |\@st@tight@bibnotesfalse|, respectively.
1353 % \begin{macrocode}
1354 \st@define@option{bibnotes}
1355 % \end{macrocode}
1356 % \pkgoptiondecl{bibnotes}
1357 % \end{macro}
1358 % \end{macro}
1359 % \end{macro}
1360 % \end{macro}
1361 %
1362 % \begin{macro}{\if@st@tight@bibbreaks}
1363 % \begin{macro}{\@st@tight@bibbreakstrue}
1364 % \begin{macro}{\@st@tight@bibbreaksfalse}
1365 % \begin{macro}{\KV@savetrees@bibbreaks}
1366 % The \pkgoption{bibbreaks} package option allows Biblatex to break
1367 % pages within bibliographic items.
1368 % \begin{macrocode}
1369 \st@define@option{bibbreaks}
1370 % \end{macrocode}
1371 % \pkgoptiondecl{bibbreaks}
1372 % \end{macro}
1373 % \end{macro}
1374 % \end{macro}
1375 % \end{macro}
1376 %
1377 % \begin{macro}{\if@st@tight@mathspacing}
1378 % \begin{macro}{\@st@tight@mathspacingtrue}
1379 % \begin{macro}{\@st@tight@mathspacingfalse}
1380 % \begin{macro}{\KV@savetrees@mathspacing}
1381 % The \pkgoption{mathspacing} package option enables or disables
1382 % \pkgname{savetrees}'s modifications to horizontal spacing within
1383 % mathematical expressions by setting |\@st@tight@mathspacingtrue| or
1384 % |\@st@tight@mathspacingfalse|, respectively.
1385 % \begin{macrocode}
1386 \st@define@option{mathspacing}
1387 % \end{macrocode}
1388 % \pkgoptiondecl{mathspacing}
1389 % \end{macro}
1390 % \end{macro}
1391 % \end{macro}
1392 % \end{macro}
1393 %
1394 % \begin{macro}{\if@st@tight@mathdisplays}
1395 % \begin{macro}{\@st@tight@mathdisplaystrue}
1396 % \begin{macro}{\@st@tight@mathdisplaysfalse}
1397 % \begin{macro}{\KV@savetrees@mathdisplays}
1398 % The \pkgoption{mathdisplays} package option enables or disables
1399 % \pkgname{savetrees}'s modifications to vertical spacing surrounding
1400 % mathematical displays by setting |\@st@tight@mathdisplaystrue| or
1401 % |\@st@tight@mathdisplaysfalse|, respectively.
1402 % \begin{macrocode}
1403 \st@define@option{mathdisplays}
1404 % \end{macrocode}
1405 % \pkgoptiondecl{mathdisplays}
1406 % \end{macro}
1407 % \end{macro}
1408 % \end{macro}
1409 % \end{macro}
1410 %
1411 % \subsubsection{Meta options}
1412 %
1413 % \pkgname{savetrees} provides a large number of package options, which
1414 % might be overwhelming for a casual user. Here, we define a few ``meta
1415 % options'' that set multiple, related, package options en masse.
1416 %
1417 % \begin{macro}{\KV@savetrees@all}
1418 % \begin{macro}{\st@arg}
1419 % \begin{macro}{\st@arg@num}
1420 % Define an \pkgoption{all} meta-option that can be used to enable or
1421 % disable all of \pkgname{savetrees}'s space-saving features at once.
1422 % \begin{macrocode}
1423 \define@choicekey{savetrees}{all}[\st@arg\st@arg@num]{tight,normal}[tight]{%
1424 \ifnum\st@arg@num=0
1425 \@st@tight@sectionstrue
1426 \@st@tight@marginstrue
1427 \@st@tight@liststrue
1428 \@st@tight@floatstrue
1429 \@st@tight@indenttrue
1430 \@st@tight@titletrue
1431 \@st@tight@leadingtrue
1432 \@st@tight@paragraphstrue
1433 \@st@tight@charwidthstrue
1434 \@st@tight@trackingtrue
1435 \@st@tight@wordspacingtrue
1436 \@st@tight@bibliographytrue
1437 \@st@tight@bibnotestrue
1438 \@st@tight@bibbreakstrue
1439 \@st@tight@mathspacingtrue
1440 \@st@tight@mathdisplaystrue
1441 \else
1442 \@st@tight@sectionsfalse
1443 \@st@tight@marginsfalse
1444 \@st@tight@listsfalse
1445 \@st@tight@floatsfalse
1446 \@st@tight@indentfalse
1447 \@st@tight@titlefalse
1448 \@st@tight@leadingfalse
1449 \@st@tight@paragraphsfalse
1450 \@st@tight@charwidthsfalse
1451 \@st@tight@trackingfalse
1452 \@st@tight@wordspacingfalse
1453 \@st@tight@bibliographyfalse
1454 \@st@tight@bibnotesfalse
1455 \@st@tight@bibbreaksfalse
1456 \@st@tight@mathspacingfalse
1457 \@st@tight@mathdisplaysfalse
1458 \fi
1459 }
1460 \DeclareOptionX{all}[tight]{\KV@savetrees@all{#1}}
1461 % \end{macrocode}
1462 % \pkgoptiondecl{all}
1463 % \end{macro}
1464 % \end{macro}
1465 % \end{macro}
1466 %
1467 % \changes{v2.1}{2013/04/07}{Introduced the \textsf{subtle}, \textsf{moderate},
1468 % and \textsf{extreme} package options}
1469 %
1470 % \begin{macro}{\KV@savetrees@subtle}
1471 % The \pkgoption{subtle} package option turns off all of
1472 % \pkgname{savetrees}'s space-saving tricks except those that preserve
1473 % document layout: margins, indentation, font heights, vertical spacing
1474 % surrounding titles, lists, displays, etc.
1475 %
1476 % \begin{macrocode}
1477 \define@key{savetrees}{subtle}{%
1478 \setkeys{savetrees}{%
1479 all=normal,
1480 paragraphs=tight,
1481 floats=tight,
1482 mathspacing=tight,
1483 wordspacing=tight,
1484 tracking=tight,
1485 bibbreaks=tight
1486 }%
1487 }
1488 \DeclareOptionX{subtle}{\KV@savetrees@subtle}
1489 % \end{macrocode}
1490 % \pkgoptiondecl{subtle}
1491 % \end{macro}
1492 %
1493 % \begin{macro}{\KV@savetrees@moderate}
1494 % The \pkgoption{moderate} package option includes everything covered by
1495 % \pkgoption{subtle} but additionally makes the font narrower, removes
1496 % vertical white space around lists and displays, cuts back on
1497 % indentation, reduces interline spacing, and drops \texttt{NOTE} fields
1498 % from the bibliography,
1499 %
1500 % \begin{macrocode}
1501 \define@key{savetrees}{moderate}{%
1502 \setkeys{savetrees}{%
1503 subtle=yes,
1504 charwidths=tight,
1505 mathdisplays=tight,
1506 lists=tight,
1507 indent=tight,
1508 leading=tight,
1509 bibnotes=tight
1510 }%
1511 }
1512 \DeclareOptionX{moderate}{\KV@savetrees@moderate}
1513 % \end{macrocode}
1514 % \pkgoptiondecl{moderate}
1515 % \end{macro}
1516 %
1517 % \begin{macro}{\KV@savetrees@extreme}
1518 % The \pkgoption{extreme} package option is simply a synonym for |all=tight|.
1519 %
1520 % \begin{macrocode}
1521 \DeclareOptionX{extreme}{%
1522 \setkeys{savetrees}{all=tight}%
1523 }
1524 % \end{macrocode}
1525 % \pkgoptiondecl{extreme}
1526 % \end{macro}
1527 %
1528 % \subsubsection{Parameter tuning}
1529 %
1530 % While \pkgname{savetrees} tries to use reasonable defaults for the
1531 % numerical values used by its space-saving techniques, many of these
1532 % parameters can be modified conveniently via package options:
1533 % \changes{v2.0}{2011/05/07}{Added package options for altering various
1534 % formatting parameters}
1535 %
1536 % The \pkgoption{marginwidth} option specifies the width of the page
1537 % margins when |margins=tight|.
1538 % \begin{macrocode}
1539 \DeclareOptionX{marginwidth}{\gdef\st@margin@width{#1}}
1540 % \end{macrocode}
1541 % \pkgoptiondecl{marginwidth}
1542 %
1543 % The \pkgoption{parindent} option specifies the paragraph indent
1544 % when |indent=tight|.
1545 % \begin{macrocode}
1546 \DeclareOptionX{parindent}{\gdef\st@parindent{#1}}
1547 % \end{macrocode}
1548 % \pkgoptiondecl{parindent}
1549 %
1550 % The \pkgoption{leadingfraction} option specifies the fraction by which
1551 % to multiply the line spacing when |leading=tight|.
1552 % \begin{macrocode}
1553 \DeclareOptionX{leadingfraction}{\gdef\st@baselinestretch{#1}}
1554 % \end{macrocode}
1555 % \pkgoptiondecl{leadingfraction}
1556 %
1557 % The \pkgoption{charwidthfraction} option specifies the fraction by
1558 % which to multiply character-glyph widths when |charwidths=tight|.
1559 % Because the \pkgname{microtype} package takes a per~mill width
1560 % contraction we have to do some arithmetic to produce
1561 % |\st@char@shrink|.
1562 % \begin{macrocode}
1563 \DeclareOptionX{charwidthfraction}{%
1564 \@tempdima=#1pt
1565 \multiply\@tempdima by -1000
1566 \advance\@tempdima by 1000pt
1567 \divide\@tempdima by 65536
1568 \@tempcnta=\@tempdima
1569 \xdef\st@char@shrink{\the\@tempcnta}%
1570 }
1571 % \end{macrocode}
1572 % \pkgoptiondecl{charwidthfraction}
1573 %
1574 % The \pkgoption{trackingfraction} option specifies the fraction by
1575 % which to multiply character spacing when |tracking=tight|. Because
1576 % the \pkgname{microtype} package takes a per~mill width expansion we
1577 % have to do some arithmetic to produce |\st@cspace@shrink|.
1578 % \begin{macrocode}
1579 \DeclareOptionX{trackingfraction}{%
1580 \@tempdima=#1pt
1581 \advance\@tempdima by -1pt
1582 \multiply\@tempdima by 1000
1583 \divide\@tempdima by 65536
1584 \@tempcnta=\@tempdima
1585 \xdef\st@cspace@shrink{\the\@tempcnta}%
1586 }
1587 % \end{macrocode}
1588 % \pkgoptiondecl{trackingfraction}
1589 %
1590 % The \pkgoption{wordspacingfraction} option specifies the fraction by
1591 % which to multiply inter-word spacing when |wordspacing=tight|.
1592 % \begin{macrocode}
1593 \DeclareOptionX{wordspacingfraction}{\gdef\st@wspace@factor{#1}}
1594 % \end{macrocode}
1595 % \pkgoptiondecl{wordspacingfraction}
1596 %
1597 % \subsubsection{Obsolete options}
1598 %
1599 % \pkgname{savetrees} used to name all of its options
1600 % |normal|\meta{something}. None of these took arguments so the only
1601 % usage model was for \pkgname{savetrees} to turn all space-saving
1602 % techniques on by default and let the user selectively disable them.
1603 % Starting with version~2.0, \pkgname{savetrees} package options take
1604 % the form \meta{something}[|=tight|] or \meta{something}|=normal|, which
1605 % gives a document author the ability to enable or disable options as
1606 % desired. To move authors to the new set of parameters, we define all
1607 % of the old options as error-generating calls.
1608 %
1609 % \begin{macro}{\st@mark@as@obsolete}
1610 % We define a helper macro that processes the given option by issuing an
1611 % error message that instructs the document author to use a different
1612 % option instead.
1613 % \begin{macrocode}
1614 \newcommand*{\st@mark@as@obsolete}[2]{%
1615 \define@key{savetrees}{#1}[tight]{%
1616 \PackageError{savetrees}{Package option `#1' is no longer supported}{%
1617 Rather than `#1', please specify `#2=normal'.\MessageBreak
1618 Instead of enabling all features by default and letting the\MessageBreak
1619 user selectively disable them, savetrees now provides the\MessageBreak
1620 ability to turn features on or off as desired, including all\MessageBreak
1621 features en masse.}%
1622 % \end{macrocode}
1623 % Out of the goodness of our heart, we automatically convert the
1624 % obsolete option to a new option and evaluate that.
1625 % \begin{macrocode}
1626 \csname @st@tight@#2false\endcsname
1627 }%
1628 \DeclareOptionX{#1}[tight]{\csname KV@savetrees@#1\endcsname{##1}}%
1629 }
1630 % \end{macrocode}
1631 % \end{macro}
1632 %
1633 % We now invoke |\st@mark@as@obsolete| once for each obsolete
1634 % \pkgname{savetrees} option,
1635 % \begin{macrocode}
1636 \st@mark@as@obsolete{normalsections}{sections}
1637 \st@mark@as@obsolete{normalmargins}{margins}
1638 \st@mark@as@obsolete{normallists}{lists}
1639 \st@mark@as@obsolete{normalfloats}{floats}
1640 \st@mark@as@obsolete{normalindent}{indent}
1641 \st@mark@as@obsolete{normaltitle}{title}
1642 \st@mark@as@obsolete{normalleading}{leading}
1643 \st@mark@as@obsolete{normallooseness}{paragraphs}
1644 \st@mark@as@obsolete{normalcharwidths}{charwidths}
1645 \st@mark@as@obsolete{normalbib}{bibliography}
1646 \st@mark@as@obsolete{normalbibnotes}{bibnotes}
1647 % \end{macrocode}
1648 %
1649 % At long last, we can process all of the options defined in
1650 % Section~\ref{sec:options}.
1651 % \begin{macrocode}
1652 \ProcessOptionsX\relax
1653 % \end{macrocode}
1654 %
1655 %
1656 % \subsection{Section titles}
1657 %
1658 % The \LaTeX{} default is to typeset section titles in a large font and
1659 % with significant surrounding white space. We use the
1660 % \pkgname{titlesec} package to typeset section titles in the same font
1661 % size as the body text and to leave only a single blank line above and
1662 % below them.
1663 %
1664 % \begin{macrocode}
1665 \if@st@tight@sections
1666 \st@RequirePackage[tiny,compact]{titlesec}
1667 \fi
1668 % \end{macrocode}
1669 %
1670 % \subsection{Page margins}
1671 %
1672 % The typesetting wisdom of the ages says that the human eye is most
1673 % comfortable reading approximately 60~characters per line of text, and
1674 % this is what \LaTeX's default margins aim to achieve. Of course,
1675 % narrower margins mean fewer pages, and that's what \pkgname{savetrees}
1676 % is striving for.
1677 %
1678 % We use the \pkgname{geometry} package to narrow our page margins
1679 % unless the author wants to keep \LaTeX's original ones. Note that we
1680 % accept \pkgname{geometry}'s default of zero space allocated to
1681 % marginal notes.
1682 % \changes{v1.2}{2006/11/20}{Made the top margin consistent with the other
1683 % margins and allocated space for the footer}
1684 % \begin{macrocode}
1685 \if@st@tight@margins
1686 \st@RequirePackage[lmargin=\st@margin@width,
1687 rmargin=\st@margin@width,
1688 tmargin=\st@margin@width,
1689 bmargin=\st@margin@width,
1690 includefoot,
1691 footskip=2ex]{geometry}
1692 \fi
1693 % \end{macrocode}
1694 %
1695 %
1696 % \subsection{List spacing}
1697 %
1698 % We try to save space in itemized lists, enumerated lists, and
1699 % description lists by reducing indentation and by eliminating
1700 % pre-list and inter-item spacing altogether.
1701 %
1702 % \begin{macrocode}
1703 \if@st@tight@lists
1704 % \end{macrocode}
1705 % The \pkgname{calc} package helps simplify our list redefinitions.
1706 % \begin{macrocode}
1707 \st@RequirePackage{calc}
1708 % \end{macrocode}
1709 %
1710 % \begin{environment}{itemize}
1711 % Except where indicated, the following code was taken directly from
1712 % \LaTeXe's definition of the |itemize| environment, in |ltlists.dtx|:
1713 % \begin{macrocode}
1714 \def\itemize{%
1715 \ifnum \@itemdepth >\thr@@\@toodeep\else
1716 \advance\@itemdepth\@ne
1717 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
1718 \expandafter
1719 \list
1720 \csname\@itemitem\endcsname
1721 {\def\makelabel##1{\hss\llap{##1}}%
1722 % \end{macrocode}
1723 % The following lines have been modified from the original.
1724 % \changes{v2.1}{2013/04/05}{Reduced vertical space before the list}
1725 % \begin{macrocode}
1726 \settowidth{\leftmargin}{\csname\@itemitem\endcsname}%
1727 \addtolength{\leftmargin}{\labelsep * \@itemdepth}%
1728 \setlength{\partopsep}{0pt plus 4pt}%
1729 \setlength{\topsep}{0pt plus 4pt}%
1730 \setlength{\itemsep}{0pt}%
1731 \setlength{\parsep}{0pt}%
1732 \setlength{\listparindent}{\st@parindent}%
1733 % \end{macrocode}
1734 % That's it for the modifications. We can now finish up the redefinition
1735 % of |itemize|.
1736 % \begin{macrocode}
1737 }%
1738 \fi}
1739 % \end{macrocode}
1740 % \end{environment}
1741 %
1742 % \begin{environment}{enumerate}
1743 % Except where indicated, the following code was taken directly from
1744 % \LaTeXe's definition of the |enumerate| environment, in |ltlists.dtx|:
1745 % \begin{macrocode}
1746 \def\enumerate{%
1747 \ifnum \@enumdepth >\thr@@\@toodeep\else
1748 \advance\@enumdepth\@ne
1749 \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
1750 \expandafter
1751 \list
1752 \csname label\@enumctr\endcsname
1753 {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}%
1754 % \end{macrocode}
1755 % The following lines have been modified from the original.
1756 % \changes{v2.1}{2013/04/05}{Reduced vertical space before the list}
1757 % \begin{macrocode}
1758 \settowidth{\leftmargin}{\csname label\@enumctr\endcsname}%
1759 \addtolength{\leftmargin}{\labelsep * \@enumdepth}%
1760 \setlength{\partopsep}{0pt plus 4pt}%
1761 \setlength{\topsep}{0pt plus 4pt}%
1762 \setlength{\itemsep}{0pt}%
1763 \setlength{\parsep}{0pt}%
1764 \setlength{\listparindent}{\st@parindent}%
1765 % \end{macrocode}
1766 % That's it for the modifications. We can now finish up the
1767 % redefinition of |enumerate|.
1768 % \begin{macrocode}
1769 }
1770 \fi}
1771 % \end{macrocode}
1772 % \end{environment}
1773 %
1774 % \begin{environment}{description}
1775 % The |description| environment is a bit simpler than the |itemize| and
1776 % |enumerate| environments; it's a direct application of |list|. All we
1777 % need to do is reduce the left margin from the |list| default of 2\,em
1778 % to a slightly denser~1\,pc.
1779 % \changes{v2.1}{2013/04/05}{Reduced vertical space before and within the list}
1780 % \begin{macrocode}
1781 \renewenvironment{description}{%
1782 \begin{list}{}{\setlength{\leftmargin}{1pc}%
1783 \setlength{\itemindent}{-\leftmargin}%
1784 \setlength{\partopsep}{0pt plus 4pt}%
1785 \setlength{\topsep}{0pt plus 4pt}%
1786 \setlength{\itemsep}{0pt}%
1787 \setlength{\parsep}{0pt}%
1788 \setlength{\labelwidth}{0pt}%
1789 \setlength{\listparindent}{\st@parindent}%
1790 \let\makelabel\descriptionlabel}%
1791 }{%
1792 \end{list}
1793 }
1794 \fi
1795 % \end{macrocode}
1796 % \end{environment}
1797 %
1798 %
1799 % \subsection{Float placement}
1800 %
1801 % \begin{macro}{\topfraction}
1802 % \begin{macro}{\bottomfraction}
1803 % \begin{macro}{\textfraction}
1804 % \begin{macro}{\floatpagefraction}
1805 % \begin{macro}{\dbltopfraction}
1806 % \begin{macro}{\dblfloatpagefraction}
1807 % \LaTeX{} normally doesn't try very hard to pack floats onto a page.
1808 % The following parameter changes attempt to reduce the number of float
1809 % pages (and hence, total pages).
1810 % \begin{macrocode}
1811 \if@st@tight@floats
1812 \renewcommand{\topfraction}{0.85}
1813 \renewcommand{\bottomfraction}{0.85}
1814 \renewcommand{\textfraction}{0.1}
1815 \renewcommand{\floatpagefraction}{0.85}
1816 \renewcommand{\dbltopfraction}{0.85}
1817 \renewcommand{\dblfloatpagefraction}{.85}
1818 \setcounter{topnumber}{25}
1819 \setcounter{bottomnumber}{25}
1820 \setcounter{totalnumber}{25}
1821 \setcounter{dbltopnumber}{25}
1822 \fi
1823 % \end{macrocode}
1824 % \end{macro}
1825 % \end{macro}
1826 % \end{macro}
1827 % \end{macro}
1828 % \end{macro}
1829 % \end{macro}
1830 %
1831 %
1832 % \subsection{Paragraph indentation}
1833 %
1834 % \LaTeX\ normally provides approximately 1.5\,em of indentation at the
1835 % start of each paragraph. We can save a little space by slightly
1836 % reducing the indentation amount.
1837 %
1838 % \begin{macrocode}
1839 \if@st@tight@indent
1840 \setlength{\parindent}{\st@parindent}
1841 \fi
1842 % \end{macrocode}
1843 %
1844 %
1845 % \subsection{Document title formatting}
1846 %
1847 % By default, the document title is typeset in the |\LARGE| font size,
1848 % and the author list and date are typeset |\large|. We redefine
1849 % |\@maketitle| to typeset the title |\large| and everything else in the
1850 % body font. In addition, we remove the extra white space above the
1851 % title and lessen the white space below the title.
1852 % \begin{macrocode}
1853 \if@st@tight@title
1854 % \end{macrocode}
1855 % \begin{macro}{\@maketitle}
1856 % The following was taken largely from |classes.dtx|, but modified as
1857 % specified above.
1858 % \changes{v2.4}{2016/04/13}{Remove even more white space above the title}
1859 % \begin{macrocode}
1860 \def\@maketitle{%
1861 \newpage
1862 \mbox{}%
1863 \begingroup
1864 \centering
1865 \let \footnote \thanks
1866 {\large \textbf{\@title}\par}
1867 \vskip 0.5\baselineskip
1868 \begin{tabular}[t]{c}%
1869 \@author
1870 \end{tabular}\par
1871 \vskip 0.5\baselineskip
1872 \@date
1873 \par
1874 \endgroup
1875 \vskip \baselineskip
1876 }
1877 \fi
1878 % \end{macrocode}
1879 % \end{macro}
1880 %
1881 %
1882 % \subsection{Interline spacing}
1883 %
1884 % \begin{macro}{\baselinestretch}
1885 % A document's page count can be reduced quite significantly by reducing
1886 % the amount of white space between successive lines of text so that's
1887 % exactly what we do below.
1888 % \begin{macrocode}
1889 \if@st@tight@leading
1890 \renewcommand{\baselinestretch}{\st@baselinestretch}
1891 \fi
1892 % \end{macrocode}
1893 % \end{macro}
1894 %
1895 %
1896 % \subsection{Paragraph looseness}
1897 % \changes{v1.2}{2006/11/20}{Added support for reducing paragraph looseness}
1898 %
1899 % Some paragraphs end with a lone word on the last line. If we can
1900 % discourage such typesetting we can gain an extra line. The underlying
1901 % mechanism we use is \TeX's |\looseness| primitive, which encourages
1902 % \TeX\ to expand the current paragraph by a given number of lines.
1903 % However, |\looseness| can be set to a negative number, which
1904 % encourages \TeX\ to shrink the current paragraph by a given number of
1905 % lines. For this technique to work, the paragraph must be relatively
1906 % long so \TeX\ has enough shrinkable white space to work with.
1907 %
1908 % Unfortunately, |\looseness| applies only to the current paragraph. We
1909 % therefore use |\everypar| to inject |\looseness=-1| into every
1910 % paragraph. However, the approach is not quite so simple as the
1911 % |\looseness=-1| is not injected into list environments. We therefore
1912 % use some tricky code due to Donald Arseneau to make the effect of
1913 % |\looseness=-1| as global as possible:
1914 % \changes{v1.2a}{2007/12/23}{Appended \texttt{\string\string\relax} to
1915 % \texttt{\string\string\looseness!=-1} to avoid discarding any
1916 % leading digits appearing in a paragraph}
1917 % \begin{macrocode}
1918 \if@st@tight@paragraphs
1919 \let\markeverypar\everypar
1920 \newtoks\everypar
1921 \everypar\markeverypar
1922 \markeverypar{\the\everypar\looseness=-1\relax}
1923 \fi
1924 % \end{macrocode}
1925 %
1926 % Even when |\everypar| is used in the ordinary fashion it is likely to
1927 % conflict with various \LaTeX\ packages. Because the preceding code is
1928 % a particularly tricky redefinition of |\everypar| it's likely that
1929 % many documents will need to disable paragraph looseness by providing
1930 % the |paragraphs=normal| option to \pkgname{savetrees}.
1931 %
1932 %
1933 % \subsection{Font width}
1934 % \changes{v1.3}{2010/06/03}{Added support for narrowing font widths}
1935 %
1936 % The \pkgname{microtype} package provides \LaTeX\ support for the
1937 % font-expansion feature supported by pdf\TeX\ and lua\TeX\@. Font
1938 % expansion is intended to improve text ``color''---the even balance
1939 % between ink and absence of ink on a page---by subtly expanding or
1940 % narrowing character widths instead of by adding or removing
1941 % white space. \pkgname{savetrees} hijacks this feature as a
1942 % space-saving mechanisms by specifying a maximum expansion of~0\% of a
1943 % character's natural width but a maximum contraction of greater
1944 % than~0\%. At the time of this writing, this feature works only with
1945 % pdf\LaTeX\ and Lua\LaTeX.
1946 % \begin{macrocode}
1947 \if@st@tight@charwidths
1948 \ifpdf
1949 \st@RequirePackage[stretch=0,shrink=\st@char@shrink]{microtype}
1950 \fi
1951 \fi
1952 % \end{macrocode}
1953 %
1954 %
1955 % \subsection{Inter-character spacing}
1956 % \changes{v2.0}{2011/05/06}{Added support for reducing inter-character
1957 % spacing}
1958 %
1959 % The \pkgname{microtype} package provides \LaTeX\ support for pdf\TeX's
1960 % tracking feature. Rather than using tracking with a light touch and
1961 % just in certain contexts (e.g.,~small caps), we instruct
1962 % \pkgname{microtype} to track somewhat aggressively, shaving off a few
1963 % percent of an em~width between \emph{every} pair of characters. At
1964 % the time of this writing, this feature works only with pdf\LaTeX.
1965 %
1966 % \begin{macrocode}
1967 \if@st@tight@tracking
1968 \ifpdf
1969 \ifluatex
1970 \else
1971 \st@RequirePackage[letterspace=\st@cspace@shrink,tracking=all]{microtype}
1972 \fi
1973 \fi
1974 \fi
1975 % \end{macrocode}
1976 %
1977 %
1978 % \subsection{Inter-word spacing}
1979 % \changes{v2.0}{2011/05/06}{Added support for reducing inter-word
1980 % spacing}
1981 %
1982 % Any font used by \TeX\ is required to have at least seven |\fontdimen|
1983 % parameters. |\fontdimen2| represents the base inter-word spacing.
1984 % (|\fontdimen3| and |\fontdimen4| represent, respectively, the amount
1985 % by which inter-word spacing can stretch or shrink; \pkgname{savetrees}
1986 % does not currently alter those.) Here, we hook into \LaTeXe's
1987 % font-loading mechanism. Whenever a new font is loaded, we specify
1988 % that the inter-word spacing for that font should be reduced.
1989 % \begin{macrocode}
1990 \if@st@tight@wordspacing
1991 \g@addto@macro\define@newfont{%
1992 \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
1993 }%
1994 % \end{macrocode}
1995 % We also reduce the inter-word spacing for whatever font is currently
1996 % loaded.
1997 % \begin{macrocode}
1998 \fontdimen2\font@name=\st@wspace@factor\fontdimen2\font@name
1999 \fi
2000 % \end{macrocode}
2001 %
2002 %
2003 % \subsection{Bibliography formatting}
2004 %
2005 % There are two ways we save space when typesetting bibliographies.
2006 % First, we omit blank linkes between entries. And second, we typeset
2007 % the entire bibliography---excluding the section title---with |\small|.
2008 %
2009 % \begin{macrocode}
2010 \if@st@tight@bibliography
2011 % \end{macrocode}
2012 % \begin{environment}{thebibliography}
2013 % The following was taken largely from |classes.dtx|; see that file for
2014 % additional documentation. \pkgname{savetrees}'s modifications are
2015 % indicated below.
2016 % \begin{macrocode}
2017 \renewenvironment{thebibliography}[1]{%
2018 % \end{macrocode}
2019 % In the |article| document class, a bibliography is a \emph{section}
2020 % called ``|\refname|''. In the |report| and |book| document classes, a
2021 % bibliography is a \emph{chapter} called ``|\bibname|''. In
2022 % |classes.dtx|, the correct code is extracted by \pkgname{DocStrip}.
2023 % Here, we have to use an |\ifx| primitive to select the appropriate
2024 % title and formatting.
2025 % \changes{v1.1}{2004/07/17}{Modified to test for
2026 % \texttt{\string\string\string\chapter}, not
2027 % \texttt{\string\string\string\bibname}.}
2028 % \changes{v1.2}{2006/11/19}{Modified to use the more robust
2029 % \texttt{\string\string\string\@ifundefined} macro to test for the existence
2030 % of \texttt{\string\string\string\chapter}}
2031 % \begin{macrocode}
2032 \@ifundefined{chapter}{%
2033 \section*{\refname
2034 \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
2035 }{%
2036 \chapter*{\bibname
2037 \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
2038 }%
2039 % \end{macrocode}
2040 % Back to the original code\dots
2041 % \begin{macrocode}
2042 \list{\@biblabel{\@arabic\c@enumiv}}%
2043 {\settowidth\labelwidth{\@biblabel{#1}}%
2044 \leftmargin\labelwidth
2045 \advance\leftmargin\labelsep
2046 % \end{macrocode}
2047 % We eliminate the space between paragraphs, and we set the space
2048 % between items to only~1\,pt. We could have set this to~0\,pt., but
2049 % the extra space helps keep the citation numbers' brackets from getting
2050 % too close to each other, vertically.
2051 % \begin{macrocode}
2052 \setlength{\parsep}{0pt}%
2053 \setlength{\itemsep}{1pt}%
2054 % \end{macrocode}
2055 % Back to the original code\dots
2056 % \begin{macrocode}
2057 \@openbib@code
2058 \usecounter{enumiv}%
2059 \let\p@enumiv\@empty
2060 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
2061 % \end{macrocode}
2062 % Although we kept the section title in its original size, we typeset
2063 % the rest of the bibliography a little bit smaller.
2064 % \begin{macrocode}
2065 \small
2066 % \end{macrocode}
2067 % We finish up using the original code, except we reduce the club and
2068 % widow penalties from~4000 to~150.
2069 % \changes{v2.3}{2014/12/19}{Reduced club and widow penalties from~4000 to~150}
2070 % \begin{macrocode}
2071 \sloppy
2072 \clubpenalty150
2073 \@clubpenalty \clubpenalty
2074 \widowpenalty150%
2075 \sfcode`\.\@m
2076 }{%
2077 \def\@noitemerr
2078 {\@latex@warning{Empty `thebibliography' environment}}%
2079 \endlist
2080 }
2081 % \end{macrocode}
2082 % \end{environment}
2083 %
2084 % \changes{v2.3}{2014/12/19}{Made \protect\texttt{bibliography!=tight} work with
2085 % Biblatex, not just \protect\BibTeX}
2086 % \begin{macro}{\bibfont}
2087 % \begin{macro}{\bibitemsep}
2088 % If the \pkgname{biblatex} package was loaded we use Biblatex's
2089 % mechanisms for reducing the font size to |\small| (|\bibfont|) and
2090 % for omitting blank lines between bibliographic entries (|\bibitemsep|).
2091 % \begin{macrocode}
2092 \AtBeginDocument{%
2093 \@ifundefined{bibfont}{}{%
2094 \renewcommand*{\bibfont}{\normalfont\small}%
2095 \bibitemsep=0pt plus 2pt\relax
2096 }%
2097 }%
2098 \fi
2099 % \end{macrocode}
2100 % \end{macro}
2101 % \end{macro}
2102 %
2103 %
2104 % \subsection{Bibliographic notes}
2105 % \label{sec:bibliographic-notes}
2106 %
2107 % \begin{macro}{\savetreesbibnote}
2108 % The bibliographies output by the |savetrees.bst| \BibTeX{} style
2109 % (presented in \ref{sec:savetrees.bst}) surround all |NOTE| fields with
2110 % a call to the |\savetreesbibnote| macro. As a result, this macro must
2111 % be defined for |savetrees.bst| to work. By default,
2112 % |\savetreesbibnote| is defined to do nothing. Howevever, setting
2113 % |bibnotes=normal| indicates that |\savetreesbibnote| should instead
2114 % output its argument as is.
2115 % \labelnextcodeline{code:stbn-begin}
2116 % \begin{macrocode}
2117 \if@st@tight@bibnotes
2118 % \end{macrocode}
2119 % To supppress a |NOTE| field, we also have to gobble the period
2120 % following the note. Otherwise, the bibliography will show two periods
2121 % surrounding an empty note.
2122 % \begin{macrocode}
2123 \newcommand{\savetreesbibnote}[1]{\@gobble}
2124 \else
2125 \newcommand{\savetreesbibnote}[1]{#1}
2126 \fi
2127 % \end{macrocode}
2128 % \labelprevcodeline{code:stbn-end}
2129 % \end{macro}
2130 %
2131 % \subsection{Page breaks within bibliographies}
2132 % \label{sec:bibliographic-breaks}
2133 %
2134 % The Biblatex package strongly discourages \TeX\ from breaking pages
2135 % within a bibliographic entry. Instead, \TeX\ is told to favor pushing
2136 % an entire bibliographic entry onto the next page. Setting
2137 % |bibbreaks=tight| changes Biblatex's behavior to allow page breaks to
2138 % appear anywhere in a bibliography. The setting has no effect on
2139 % \BibTeX, only Biblatex.
2140 % \changes{v2.3}{2014/12/19}{Added support for allowing page breaks
2141 % within Biblatex bibliographies}
2142 % \labelnextcodeline{code:stbb-begin}
2143 % \begin{macrocode}
2144 \if@st@tight@bibbreaks
2145 \AtBeginDocument{%
2146 \@ifundefined{bibsetup}{}{%
2147 % \end{macrocode}
2148 % \begin{macro}{\bibsetup}
2149 % The \pkgname{biblatex} package was loaded. Redefine its |\bibsetup| hook.
2150 % \begin{macrocode}
2151 \renewcommand*{\bibsetup}{%
2152 \interlinepenalty=100\relax
2153 \widowpenalty=100\relax
2154 \clubpenalty=100\relax
2155 \raggedbottom
2156 \frenchspacing
2157 \biburlsetup
2158 }%
2159 }%
2160 }%
2161 \fi
2162 % \end{macrocode}
2163 % \end{macro}
2164 % \labelprevcodeline{code:stbb-end}
2165 %
2166 % \subsection{Mathematical expressions}
2167 % \label{sec:math-exprs}
2168 %
2169 % By default, mathematical expressions contain substantial white space
2170 % around operators, relations, etc. Here, we shave approximately three
2171 % math units off each of |\thinmuskip|, |\medmuskip|, and
2172 % |\thickmuskip|. This needs to happen after the |\begin{document}| so
2173 % that the new values don't get overwritten.
2174 % \changes{v2.1}{2013/04/06}{Added support for squeezing space out of
2175 % mathematical expressions}
2176 %
2177 % \begin{macrocode}
2178 \if@st@tight@mathspacing
2179 \AtBeginDocument{%
2180 \thinmuskip=0mu plus 3mu
2181 \medmuskip=1mu plus 4mu
2182 \thickmuskip=2mu plus 5mu
2183 }
2184 \fi
2185 % \end{macrocode}
2186 %
2187 %
2188 % \subsection{Displayed mathematics}
2189 % \label{sec:math-displays}
2190 %
2191 % Displayed mathematical expressions are normally offset from the
2192 % surrounding text with vertical white space. Here, we set the amount of
2193 % vertical white space to zero. This needs to happen after the
2194 % |\begin{document}| so that the new values don't get overwritten.
2195 % \changes{v2.1}{2013/04/06}{Added support for removing vertical space
2196 % around displayed mathematics}
2197 %
2198 % \begin{macrocode}
2199 \if@st@tight@mathdisplays
2200 \AtBeginDocument{%
2201 \abovedisplayskip=0pt plus 3pt
2202 \belowdisplayskip=0pt plus 3pt
2203 \abovedisplayshortskip=0pt plus 3pt
2204 \belowdisplayshortskip=0pt plus 3pt
2205 }
2206 \fi
2207 % \end{macrocode}
2208 %
2209 % \iffalse
2210 %</package>
2211 % \fi
2212 %
2213 %
2214 % \section{Implementation of the \texorpdfstring{\BibTeX}{BibTeX} style file}
2215 % \label{sec:savetrees.bst}
2216 %
2217 % In addition to a \LaTeXe{} style, the \pkgname{savetrees} package also
2218 % includes a \BibTeX{} style, |savetrees.bst|. |savetrees.bst| was
2219 % generated with the help of Patrick W. Daly's \pkgname{custom-bib}
2220 % package. The following options were provided to |merlin.mbs|:
2221 %
2222 % \begin{center}
2223 % \begin{minipage}{0.75\textwidth}
2224 % \ttfamily\selectfont
2225 % lang, nm-init, ed-au, nmdash, nmlm, x2, m2, isbn, issn, pp, ed, abr,
2226 % ednx, xedn, jabr, nfss
2227 % \end{minipage}
2228 % \end{center}
2229 %
2230 % Because |savetrees.bst| is a generated file---and can be regenerated using
2231 % the options listed above---it is unnecessary to list the complete
2232 % source code in this document. Rather, only the hand-modified parts are
2233 % presented below.
2234 %
2235 % \iffalse
2236 %<*bstfile>
2237 % \fi
2238 %
2239 % \begin{center}
2240 % $\vdots$ \\
2241 % (443 lines of code omitted) \\
2242 % $\vdots$
2243 % \end{center}
2244 %
2245 % ^^A We surround all but our modified format.note function
2246 % ^^A within \iffalse...\fi.
2247 % \iffalse
2248 % \begin{macrocode}
2249 % ===============================================================
2250 % IMPORTANT NOTICE:
2251 % This bibliographic style (bst) file has been generated from one or
2252 % more master bibliographic style (mbs) files, listed above.
2253 %
2254 % This generated file can be redistributed and/or modified under the terms
2255 % of the LaTeX Project Public License Distributed from CTAN
2256 % archives in directory macros/latex/base/lppl.txt; either
2257 % version 1 of the License, or any later version.
2258 % ===============================================================
2259 % Name and version information of the main mbs file:
2260 % \ProvidesFile{merlin.mbs}[1999/05/28 3.89 (PWD)]
2261 % For use with BibTeX version 0.99a or later
2262 %-------------------------------------------------------------------
2263 % This bibliography style file is intended for texts in ENGLISH
2264 % This is a numerical citation style, and as such is standard LaTeX.
2265 % It requires no extra package to interface to the main text.
2266 % The form of the \bibitem entries is
2267 % \bibitem{key}...
2268 % Usage of \cite is as follows:
2269 % \cite{key} ==>> [#]
2270 % \cite[chap. 2]{key} ==>> [#, chap. 2]
2271 % where # is a number determined by the ordering in the reference list.
2272 % The order in the reference list is alphabetical by authors.
2273 %---------------------------------------------------------------------
2274
2275 ENTRY
2276 { address
2277 author
2278 booktitle
2279 chapter
2280 edition
2281 editor
2282 howpublished
2283 institution
2284 isbn
2285 issn
2286 journal
2287 key
2288 language
2289 month
2290 note
2291 number
2292 organization
2293 pages
2294 publisher
2295 school
2296 series
2297 title
2298 type
2299 volume
2300 year
2301 }
2302 {}
2303 { label }
2304
2305 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
2306
2307 FUNCTION {init.state.consts}
2308 { #0 'before.all :=
2309 #1 'mid.sentence :=
2310 #2 'after.sentence :=
2311 #3 'after.block :=
2312 }
2313
2314 STRINGS { s t }
2315
2316 FUNCTION {output.nonnull}
2317 { 's :=
2318 output.state mid.sentence =
2319 { ", " * write$ }
2320 { output.state after.block =
2321 { add.period$ write$
2322 newline$
2323 "\newblock " write$
2324 }
2325 { output.state before.all =
2326 'write$
2327 { add.period$ " " * write$ }
2328 if$
2329 }
2330 if$
2331 mid.sentence 'output.state :=
2332 }
2333 if$
2334 s
2335 }
2336
2337 FUNCTION {output}
2338 { duplicate$ empty$
2339 'pop$
2340 'output.nonnull
2341 if$
2342 }
2343
2344 FUNCTION {output.check}
2345 { 't :=
2346 duplicate$ empty$
2347 { pop$ "empty " t * " in " * cite$ * warning$ }
2348 'output.nonnull
2349 if$
2350 }
2351
2352 FUNCTION {fin.entry}
2353 { add.period$
2354 write$
2355 newline$
2356 }
2357
2358 FUNCTION {new.block}
2359 { output.state before.all =
2360 'skip$
2361 { after.block 'output.state := }
2362 if$
2363 }
2364
2365 FUNCTION {new.sentence}
2366 { output.state after.block =
2367 'skip$
2368 { output.state before.all =
2369 'skip$
2370 { after.sentence 'output.state := }
2371 if$
2372 }
2373 if$
2374 }
2375
2376 FUNCTION {add.blank}
2377 { " " * before.all 'output.state :=
2378 }
2379
2380 FUNCTION {date.block}
2381 {
2382 new.block
2383 }
2384
2385 FUNCTION {not}
2386 { { #0 }
2387 { #1 }
2388 if$
2389 }
2390
2391 FUNCTION {and}
2392 { 'skip$
2393 { pop$ #0 }
2394 if$
2395 }
2396
2397 FUNCTION {or}
2398 { { pop$ #1 }
2399 'skip$
2400 if$
2401 }
2402
2403 FUNCTION {new.block.checka}
2404 { empty$
2405 'skip$
2406 'new.block
2407 if$
2408 }
2409
2410 FUNCTION {new.block.checkb}
2411 { empty$
2412 swap$ empty$
2413 and
2414 'skip$
2415 'new.block
2416 if$
2417 }
2418
2419 FUNCTION {new.sentence.checka}
2420 { empty$
2421 'skip$
2422 'new.sentence
2423 if$
2424 }
2425
2426 FUNCTION {new.sentence.checkb}
2427 { empty$
2428 swap$ empty$
2429 and
2430 'skip$
2431 'new.sentence
2432 if$
2433 }
2434
2435 FUNCTION {field.or.null}
2436 { duplicate$ empty$
2437 { pop$ "" }
2438 'skip$
2439 if$
2440 }
2441
2442 FUNCTION {emphasize}
2443 { duplicate$ empty$
2444 { pop$ "" }
2445 { "\emph{" swap$ * "}" * }
2446 if$
2447 }
2448
2449
2450 FUNCTION {capitalize}
2451 { "u" change.case$ "t" change.case$ }
2452
2453 FUNCTION {space.word}
2454 { " " swap$ * " " * }
2455
2456 % Here are the language-specific definitions for explicit words.
2457 % Each function has a name bbl.xxx where xxx is the English word.
2458 % The language selected here is ENGLISH
2459 FUNCTION {bbl.and}
2460 { "and"}
2461
2462 FUNCTION {bbl.etal}
2463 { "et~al." }
2464
2465 FUNCTION {bbl.editors}
2466 { "eds." }
2467
2468 FUNCTION {bbl.editor}
2469 { "ed." }
2470
2471 FUNCTION {bbl.edby}
2472 { "edited by" }
2473
2474 FUNCTION {bbl.edition}
2475 { "ed." }
2476
2477 FUNCTION {bbl.volume}
2478 { "vol." }
2479
2480 FUNCTION {bbl.of}
2481 { "of" }
2482
2483 FUNCTION {bbl.number}
2484 { "no." }
2485
2486 FUNCTION {bbl.nr}
2487 { "no." }
2488
2489 FUNCTION {bbl.in}
2490 { "in" }
2491
2492 FUNCTION {bbl.pages}
2493 { "pp." }
2494
2495 FUNCTION {bbl.page}
2496 { "p." }
2497
2498 FUNCTION {bbl.chapter}
2499 { "chap." }
2500
2501 FUNCTION {bbl.techrep}
2502 { "Tech. Rep." }
2503
2504 FUNCTION {bbl.mthesis}
2505 { "Master's thesis" }
2506
2507 FUNCTION {bbl.phdthesis}
2508 { "Ph.D. thesis" }
2509
2510 MACRO {jan} {"Jan."}
2511
2512 MACRO {feb} {"Feb."}
2513
2514 MACRO {mar} {"Mar."}
2515
2516 MACRO {apr} {"Apr."}
2517
2518 MACRO {may} {"May"}
2519
2520 MACRO {jun} {"Jun."}
2521
2522 MACRO {jul} {"Jul."}
2523
2524 MACRO {aug} {"Aug."}
2525
2526 MACRO {sep} {"Sep."}
2527
2528 MACRO {oct} {"Oct."}
2529
2530 MACRO {nov} {"Nov."}
2531
2532 MACRO {dec} {"Dec."}
2533
2534 MACRO {acmcs} {"ACM Comput. Surv."}
2535
2536 MACRO {acta} {"Acta Inf."}
2537
2538 MACRO {cacm} {"Commun. ACM"}
2539
2540 MACRO {ibmjrd} {"IBM J. Res. Dev."}
2541
2542 MACRO {ibmsj} {"IBM Syst.~J."}
2543
2544 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
2545
2546 MACRO {ieeetc} {"IEEE Trans. Comput."}
2547
2548 MACRO {ieeetcad}
2549 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
2550
2551 MACRO {ipl} {"Inf. Process. Lett."}
2552
2553 MACRO {jacm} {"J.~ACM"}
2554
2555 MACRO {jcss} {"J.~Comput. Syst. Sci."}
2556
2557 MACRO {scp} {"Sci. Comput. Programming"}
2558
2559 MACRO {sicomp} {"SIAM J. Comput."}
2560
2561 MACRO {tocs} {"ACM Trans. Comput. Syst."}
2562
2563 MACRO {tods} {"ACM Trans. Database Syst."}
2564
2565 MACRO {tog} {"ACM Trans. Gr."}
2566
2567 MACRO {toms} {"ACM Trans. Math. Softw."}
2568
2569 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
2570
2571 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
2572
2573 MACRO {tcs} {"Theoretical Comput. Sci."}
2574
2575
2576 INTEGERS { nameptr namesleft numnames }
2577
2578 FUNCTION {format.names}
2579 { 's :=
2580 "" 't :=
2581 #1 'nameptr :=
2582 s num.names$ 'numnames :=
2583 numnames 'namesleft :=
2584 { namesleft #0 > }
2585 { s nameptr
2586 "{f.~}{vv~}{ll}{, jj}" format.name$
2587 't :=
2588 nameptr #1 >
2589 {
2590 nameptr #2
2591 #1 + =
2592 numnames #2
2593 > and
2594 { "others" 't :=
2595 #1 'namesleft := }
2596 'skip$
2597 if$
2598 namesleft #1 >
2599 { ", " * t * }
2600 {
2601 numnames #2 >
2602 { "," * }
2603 'skip$
2604 if$
2605 s nameptr "{ll}" format.name$ duplicate$ "others" =
2606 { 't := }
2607 { pop$ }
2608 if$
2609 t "others" =
2610 {
2611 " " * bbl.etal *
2612 }
2613 { bbl.and
2614 space.word * t *
2615 }
2616 if$
2617 }
2618 if$
2619 }
2620 't
2621 if$
2622 nameptr #1 + 'nameptr :=
2623 namesleft #1 - 'namesleft :=
2624 }
2625 while$
2626 }
2627
2628 FUNCTION {format.names.ed}
2629 { format.names }
2630
2631 FUNCTION {format.authors}
2632 { author empty$
2633 { "" }
2634 { author format.names }
2635 if$
2636 }
2637
2638 FUNCTION {format.editors}
2639 { editor empty$
2640 { "" }
2641 { editor format.names
2642 ", " *
2643 editor num.names$ #1 >
2644 'bbl.editors
2645 'bbl.editor
2646 if$
2647 *
2648 }
2649 if$
2650 }
2651
2652 FUNCTION {format.in.editors}
2653 { editor empty$
2654 { "" }
2655 { editor format.names.ed
2656 editor num.names$ #1 >
2657 { ", " * bbl.editors * }
2658 { ", " * bbl.editor * }
2659 if$
2660 }
2661 if$
2662 }
2663
2664 FUNCTION {format.isbn}
2665 { isbn empty$
2666 { "" }
2667 {
2668 new.block
2669 "ISBN " isbn * }
2670 if$
2671 }
2672
2673 FUNCTION {format.issn}
2674 { issn empty$
2675 { "" }
2676 {
2677 new.block
2678 "ISSN " issn * }
2679 if$
2680 }
2681
2682 FUNCTION {select.language}
2683 { duplicate$ empty$
2684 'pop$
2685 { language empty$
2686 'skip$
2687 { "{\selectlanguage{" language * "}" * swap$ * "}" * }
2688 if$
2689 }
2690 if$
2691 }
2692 % \end{macrocode}
2693 % \fi
2694 %
2695 % |format.note| is the first of two functions modified by hand. The
2696 % modification involves placing the entire note field within
2697 % |\savetreesbibnote{|\dots|}|. This enables |savetrees.sty| to
2698 % selectively define |\savetreesbibnote| to either output its argument
2699 % as is or discard it (and the subsequent period). See
2700 % \ref{sec:bibliographic-notes} for |savetrees.sty|'s definition
2701 % of~|\savetreesbibnote|.
2702 % \begin{macrocode}
2703 FUNCTION {format.note}
2704 {
2705 note empty$
2706 { "" }
2707 { "\savetreesbibnote{"
2708 note #1 #1 substring$
2709 duplicate$ "{" =
2710 'skip$
2711 { output.state mid.sentence =
2712 { "l" }
2713 { "u" }
2714 if$
2715 change.case$
2716 }
2717 if$
2718 note #2 global.max$ substring$ *
2719 "}" * *
2720 }
2721 if$
2722 }
2723 % \end{macrocode}
2724 %
2725 % \begin{center}
2726 % $\vdots$ \\
2727 % (914 lines of code omitted) \\
2728 % $\vdots$
2729 % \end{center}
2730 %
2731 % \iffalse
2732 % \begin{macrocode}
2733
2734 FUNCTION {format.title}
2735 { title empty$
2736 { "" }
2737 { title "t" change.case$
2738 select.language
2739 }
2740 if$
2741 }
2742
2743 FUNCTION {output.bibitem}
2744 { newline$
2745 "\bibitem{" write$
2746 cite$ write$
2747 "}" write$
2748 newline$
2749 ""
2750 before.all 'output.state :=
2751 }
2752
2753 FUNCTION {n.dashify}
2754 {
2755 't :=
2756 ""
2757 { t empty$ not }
2758 { t #1 #1 substring$ "-" =
2759 { t #1 #2 substring$ "--" = not
2760 { "--" *
2761 t #2 global.max$ substring$ 't :=
2762 }
2763 { { t #1 #1 substring$ "-" = }
2764 { "-" *
2765 t #2 global.max$ substring$ 't :=
2766 }
2767 while$
2768 }
2769 if$
2770 }
2771 { t #1 #1 substring$ *
2772 t #2 global.max$ substring$ 't :=
2773 }
2774 if$
2775 }
2776 while$
2777 }
2778
2779 FUNCTION {word.in}
2780 { bbl.in capitalize
2781 " " * }
2782
2783 FUNCTION {format.date}
2784 { year empty$
2785 { month empty$
2786 { "" }
2787 { "there's a month but no year in " cite$ * warning$
2788 month
2789 }
2790 if$
2791 }
2792 { month empty$
2793 'year
2794 { month " " * year * }
2795 if$
2796 }
2797 if$
2798 }
2799
2800 FUNCTION {format.btitle}
2801 { title emphasize
2802 select.language
2803 }
2804
2805 FUNCTION {tie.or.space.connect}
2806 { duplicate$ text.length$ #3 <
2807 { "~" }
2808 { " " }
2809 if$
2810 swap$ * *
2811 }
2812
2813 FUNCTION {either.or.check}
2814 { empty$
2815 'pop$
2816 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
2817 if$
2818 }
2819
2820 FUNCTION {format.bvolume}
2821 { volume empty$
2822 { "" }
2823 { bbl.volume volume tie.or.space.connect
2824 series empty$
2825 'skip$
2826 { bbl.of space.word * series emphasize * }
2827 if$
2828 "volume and number" number either.or.check
2829 }
2830 if$
2831 }
2832
2833 FUNCTION {format.number.series}
2834 { volume empty$
2835 { number empty$
2836 { series field.or.null }
2837 { output.state mid.sentence =
2838 { bbl.number }
2839 { bbl.number capitalize }
2840 if$
2841 number tie.or.space.connect
2842 series empty$
2843 { "there's a number but no series in " cite$ * warning$ }
2844 { bbl.in space.word * series * }
2845 if$
2846 }
2847 if$
2848 }
2849 { "" }
2850 if$
2851 }
2852
2853
2854 FUNCTION {format.edition}
2855 { edition empty$
2856 { "" }
2857 { output.state mid.sentence =
2858 { edition "l" change.case$ " " * bbl.edition * }
2859 { edition "t" change.case$ " " * bbl.edition * }
2860 if$
2861 }
2862 if$
2863 }
2864
2865 INTEGERS { multiresult }
2866
2867 FUNCTION {multi.page.check}
2868 { 't :=
2869 #0 'multiresult :=
2870 { multiresult not
2871 t empty$ not
2872 and
2873 }
2874 { t #1 #1 substring$
2875 duplicate$ "-" =
2876 swap$ duplicate$ "," =
2877 swap$ "+" =
2878 or or
2879 { #1 'multiresult := }
2880 { t #2 global.max$ substring$ 't := }
2881 if$
2882 }
2883 while$
2884 multiresult
2885 }
2886
2887 FUNCTION {format.pages}
2888 { pages empty$
2889 { "" }
2890 { pages multi.page.check
2891 { bbl.pages pages n.dashify tie.or.space.connect }
2892 { bbl.page pages tie.or.space.connect }
2893 if$
2894 }
2895 if$
2896 }
2897
2898 FUNCTION {format.journal.pages}
2899 { pages empty$
2900 'skip$
2901 { duplicate$ empty$
2902 { pop$ format.pages }
2903 {
2904 ":" *
2905 pages n.dashify *
2906 }
2907 if$
2908 }
2909 if$
2910 }
2911
2912 FUNCTION {format.vol.num.pages}
2913 { volume field.or.null
2914 number empty$
2915 'skip$
2916 {
2917 "(" number * ")" * *
2918 volume empty$
2919 { "there's a number but no volume in " cite$ * warning$ }
2920 'skip$
2921 if$
2922 }
2923 if$
2924 format.journal.pages
2925 }
2926
2927 FUNCTION {format.chapter.pages}
2928 { chapter empty$
2929 'format.pages
2930 { type empty$
2931 { bbl.chapter }
2932 { type "l" change.case$ }
2933 if$
2934 chapter tie.or.space.connect
2935 pages empty$
2936 'skip$
2937 { ", " * format.pages * }
2938 if$
2939 }
2940 if$
2941 }
2942
2943 FUNCTION {format.in.ed.booktitle}
2944 { booktitle empty$
2945 { "" }
2946 { editor empty$
2947 { word.in booktitle emphasize * }
2948 { word.in format.in.editors * ", " *
2949 booktitle emphasize * }
2950 if$
2951 }
2952 if$
2953 }
2954
2955 FUNCTION {empty.misc.check}
2956 { author empty$ title empty$ howpublished empty$
2957 month empty$ year empty$ note empty$
2958 and and and and and
2959 key empty$ not and
2960 { "all relevant fields are empty in " cite$ * warning$ }
2961 'skip$
2962 if$
2963 }
2964
2965 FUNCTION {format.thesis.type}
2966 { type empty$
2967 'skip$
2968 { pop$
2969 type "t" change.case$
2970 }
2971 if$
2972 }
2973
2974 FUNCTION {format.tr.number}
2975 { type empty$
2976 { bbl.techrep }
2977 'type
2978 if$
2979 number empty$
2980 { "t" change.case$ }
2981 { number tie.or.space.connect }
2982 if$
2983 }
2984
2985 FUNCTION {format.article.crossref}
2986 {
2987 key empty$
2988 { journal empty$
2989 { "need key or journal for " cite$ * " to crossref " * crossref *
2990 warning$
2991 ""
2992 }
2993 { word.in journal emphasize * }
2994 if$
2995 }
2996 { word.in key * " " *}
2997 if$
2998 " \cite{" * crossref * "}" *
2999 }
3000
3001 FUNCTION {format.crossref.editor}
3002 { editor #1 "{vv~}{ll}" format.name$
3003 editor num.names$ duplicate$
3004 #2 >
3005 { pop$
3006 " " * bbl.etal *
3007 }
3008 { #2 <
3009 'skip$
3010 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
3011 {
3012 " " * bbl.etal *
3013 }
3014 { bbl.and space.word * editor #2 "{vv~}{ll}" format.name$
3015 * }
3016 if$
3017 }
3018 if$
3019 }
3020 if$
3021 }
3022
3023 FUNCTION {format.book.crossref}
3024 { volume empty$
3025 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
3026 word.in
3027 }
3028 { bbl.volume capitalize
3029 volume tie.or.space.connect
3030 bbl.of space.word *
3031 }
3032 if$
3033 editor empty$
3034 editor field.or.null author field.or.null =
3035 or
3036 { key empty$
3037 { series empty$
3038 { "need editor, key, or series for " cite$ * " to crossref " *
3039 crossref * warning$
3040 "" *
3041 }
3042 { series emphasize * }
3043 if$
3044 }
3045 { key * }
3046 if$
3047 }
3048 { format.crossref.editor * }
3049 if$
3050 " \cite{" * crossref * "}" *
3051 }
3052
3053 FUNCTION {format.incoll.inproc.crossref}
3054 {
3055 editor empty$
3056 editor field.or.null author field.or.null =
3057 or
3058 { key empty$
3059 { booktitle empty$
3060 { "need editor, key, or booktitle for " cite$ * " to crossref " *
3061 crossref * warning$
3062 ""
3063 }
3064 { word.in booktitle emphasize * }
3065 if$
3066 }
3067 { word.in key * " " *}
3068 if$
3069 }
3070 { word.in format.crossref.editor * " " *}
3071 if$
3072 " \cite{" * crossref * "}" *
3073 }
3074
3075 FUNCTION {format.org.or.pub}
3076 { 't :=
3077 ""
3078 address empty$ t empty$ and
3079 'skip$
3080 {
3081 t empty$
3082 { address empty$
3083 'skip$
3084 { address * }
3085 if$
3086 }
3087 { t *
3088 address empty$
3089 'skip$
3090 { ", " * address * }
3091 if$
3092 }
3093 if$
3094 }
3095 if$
3096 }
3097
3098 FUNCTION {format.publisher.address}
3099 { publisher empty$
3100 { "empty publisher in " cite$ * warning$
3101 ""
3102 }
3103 { publisher }
3104 if$
3105 format.org.or.pub
3106 }
3107
3108 FUNCTION {format.organization.address}
3109 { organization empty$
3110 { "" }
3111 { organization }
3112 if$
3113 format.org.or.pub
3114 }
3115
3116 STRINGS {oldname}
3117
3118 FUNCTION {name.or.dash}
3119 { 's :=
3120 oldname empty$
3121 { s 'oldname := s }
3122 { s oldname =
3123 { "---" }
3124 { s 'oldname := s }
3125 if$
3126 }
3127 if$
3128 }
3129
3130 FUNCTION {article}
3131 { output.bibitem
3132 format.authors "author" output.check
3133 name.or.dash
3134 new.block
3135 format.title "title" output.check
3136 new.block
3137 crossref missing$
3138 { journal
3139 emphasize
3140 "journal" output.check
3141 format.vol.num.pages output
3142 format.date "year" output.check
3143 }
3144 { format.article.crossref output.nonnull
3145 format.pages output
3146 }
3147 if$
3148 format.issn output
3149 new.block
3150 format.note output
3151 fin.entry
3152 }
3153
3154 FUNCTION {book}
3155 { output.bibitem
3156 author empty$
3157 { format.editors "author and editor" output.check
3158 name.or.dash
3159 }
3160 { format.authors output.nonnull
3161 name.or.dash
3162 crossref missing$
3163 { "author and editor" editor either.or.check }
3164 'skip$
3165 if$
3166 }
3167 if$
3168 new.block
3169 format.btitle "title" output.check
3170 crossref missing$
3171 { format.bvolume output
3172 new.block
3173 format.number.series output
3174 new.sentence
3175 format.publisher.address output
3176 }
3177 {
3178 new.block
3179 format.book.crossref output.nonnull
3180 }
3181 if$
3182 format.edition output
3183 format.date "year" output.check
3184 format.isbn output
3185 new.block
3186 format.note output
3187 fin.entry
3188 }
3189
3190 FUNCTION {booklet}
3191 { output.bibitem
3192 format.authors output
3193 name.or.dash
3194 new.block
3195 format.title "title" output.check
3196 new.block
3197 howpublished output
3198 address output
3199 format.date output
3200 format.isbn output
3201 new.block
3202 format.note output
3203 fin.entry
3204 }
3205
3206 FUNCTION {inbook}
3207 { output.bibitem
3208 author empty$
3209 { format.editors "author and editor" output.check
3210 name.or.dash
3211 }
3212 { format.authors output.nonnull
3213 name.or.dash
3214 crossref missing$
3215 { "author and editor" editor either.or.check }
3216 'skip$
3217 if$
3218 }
3219 if$
3220 new.block
3221 format.btitle "title" output.check
3222 crossref missing$
3223 {
3224 format.bvolume output
3225 format.chapter.pages "chapter and pages" output.check
3226 new.block
3227 format.number.series output
3228 new.sentence
3229 format.publisher.address output
3230 }
3231 {
3232 format.chapter.pages "chapter and pages" output.check
3233 new.block
3234 format.book.crossref output.nonnull
3235 }
3236 if$
3237 format.edition output
3238 format.date "year" output.check
3239 crossref missing$
3240 { format.isbn output }
3241 'skip$
3242 if$
3243 new.block
3244 format.note output
3245 fin.entry
3246 }
3247
3248 FUNCTION {incollection}
3249 { output.bibitem
3250 format.authors "author" output.check
3251 name.or.dash
3252 new.block
3253 format.title "title" output.check
3254 new.block
3255 crossref missing$
3256 { format.in.ed.booktitle "booktitle" output.check
3257 format.bvolume output
3258 format.number.series output
3259 format.chapter.pages output
3260 new.sentence
3261 format.publisher.address output
3262 format.edition output
3263 format.date "year" output.check
3264 format.isbn output
3265 }
3266 { format.incoll.inproc.crossref output.nonnull
3267 format.chapter.pages output
3268 }
3269 if$
3270 new.block
3271 format.note output
3272 fin.entry
3273 }
3274
3275 FUNCTION {inproceedings}
3276 { output.bibitem
3277 format.authors "author" output.check
3278 name.or.dash
3279 new.block
3280 format.title "title" output.check
3281 new.block
3282 crossref missing$
3283 { format.in.ed.booktitle "booktitle" output.check
3284 format.bvolume output
3285 format.number.series output
3286 format.pages output
3287 new.sentence
3288 publisher empty$
3289 { format.organization.address output }
3290 { organization output
3291 format.publisher.address output
3292 }
3293 if$
3294 format.date "year" output.check
3295 format.isbn output
3296 format.issn output
3297 }
3298 { format.incoll.inproc.crossref output.nonnull
3299 format.pages output
3300 }
3301 if$
3302 new.block
3303 format.note output
3304 fin.entry
3305 }
3306
3307 FUNCTION {conference} { inproceedings }
3308
3309 FUNCTION {manual}
3310 { output.bibitem
3311 author empty$
3312 { organization empty$
3313 'skip$
3314 { organization output.nonnull
3315 address output
3316 }
3317 if$
3318 }
3319 { format.authors output.nonnull }
3320 if$
3321 name.or.dash
3322 new.block
3323 format.btitle "title" output.check
3324 author empty$
3325 { organization empty$
3326 {
3327 address new.block.checka
3328 address output
3329 }
3330 'skip$
3331 if$
3332 }
3333 {
3334 organization address new.block.checkb
3335 organization output
3336 address output
3337 }
3338 if$
3339 format.edition output
3340 format.date output
3341 new.block
3342 format.note output
3343 fin.entry
3344 }
3345
3346 FUNCTION {mastersthesis}
3347 { output.bibitem
3348 format.authors "author" output.check
3349 name.or.dash
3350 new.block
3351 format.btitle "title" output.check
3352 new.block
3353 bbl.mthesis format.thesis.type output.nonnull
3354 school "school" output.check
3355 address output
3356 format.date "year" output.check
3357 new.block
3358 format.note output
3359 fin.entry
3360 }
3361
3362 FUNCTION {misc}
3363 { output.bibitem
3364 format.authors output
3365 name.or.dash
3366 title howpublished new.block.checkb
3367 format.title output
3368 howpublished new.block.checka
3369 howpublished output
3370 format.date output
3371 new.block
3372 format.note output
3373 fin.entry
3374 empty.misc.check
3375 }
3376
3377 FUNCTION {phdthesis}
3378 { output.bibitem
3379 format.authors "author" output.check
3380 name.or.dash
3381 new.block
3382 format.btitle "title" output.check
3383 new.block
3384 bbl.phdthesis format.thesis.type output.nonnull
3385 school "school" output.check
3386 address output
3387 format.date "year" output.check
3388 new.block
3389 format.note output
3390 fin.entry
3391 }
3392
3393 FUNCTION {proceedings}
3394 { output.bibitem
3395 editor empty$
3396 { organization output }
3397 { format.editors output.nonnull }
3398 if$
3399 name.or.dash
3400 new.block
3401 format.btitle "title" output.check
3402 format.bvolume output
3403 format.number.series output
3404 editor empty$
3405 { publisher empty$
3406 'skip$
3407 {
3408 new.sentence
3409 format.publisher.address output
3410 }
3411 if$
3412 }
3413 { publisher empty$
3414 {
3415 new.sentence
3416 format.organization.address output }
3417 {
3418 new.sentence
3419 organization output
3420 format.publisher.address output
3421 }
3422 if$
3423 }
3424 if$
3425 format.date "year" output.check
3426 format.isbn output
3427 format.issn output
3428 new.block
3429 format.note output
3430 fin.entry
3431 }
3432
3433 FUNCTION {techreport}
3434 { output.bibitem
3435 format.authors "author" output.check
3436 name.or.dash
3437 new.block
3438 format.title "title" output.check
3439 new.block
3440 format.tr.number output.nonnull
3441 institution "institution" output.check
3442 address output
3443 format.date "year" output.check
3444 new.block
3445 format.note output
3446 fin.entry
3447 }
3448
3449 FUNCTION {unpublished}
3450 { output.bibitem
3451 format.authors "author" output.check
3452 name.or.dash
3453 new.block
3454 format.title "title" output.check
3455 format.date output
3456 new.block
3457 format.note "note" output.check
3458 fin.entry
3459 }
3460
3461 FUNCTION {default.type} { misc }
3462
3463 READ
3464
3465 FUNCTION {sortify}
3466 { purify$
3467 "l" change.case$
3468 }
3469
3470 INTEGERS { len }
3471
3472 FUNCTION {chop.word}
3473 { 's :=
3474 'len :=
3475 s #1 len substring$ =
3476 { s len #1 + global.max$ substring$ }
3477 's
3478 if$
3479 }
3480
3481 FUNCTION {sort.format.names}
3482 { 's :=
3483 #1 'nameptr :=
3484 ""
3485 s num.names$ 'numnames :=
3486 numnames 'namesleft :=
3487 { namesleft #0 > }
3488 { s nameptr
3489 "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}"
3490 format.name$ 't :=
3491 nameptr #1 >
3492 {
3493 nameptr #2
3494 #1 + =
3495 numnames #2
3496 > and
3497 { "others" 't :=
3498 #1 'namesleft := }
3499 'skip$
3500 if$
3501 " " *
3502 namesleft #1 = t "others" = and
3503 { "zzzzz" * }
3504 { t sortify * }
3505 if$
3506 }
3507 { t sortify * }
3508 if$
3509 nameptr #1 + 'nameptr :=
3510 namesleft #1 - 'namesleft :=
3511 }
3512 while$
3513 }
3514
3515 FUNCTION {sort.format.title}
3516 { 't :=
3517 "A " #2
3518 "An " #3
3519 "The " #4 t chop.word
3520 chop.word
3521 chop.word
3522 sortify
3523 #1 global.max$ substring$
3524 }
3525
3526 FUNCTION {author.sort}
3527 { author empty$
3528 { key empty$
3529 { "to sort, need author or key in " cite$ * warning$
3530 ""
3531 }
3532 { key sortify }
3533 if$
3534 }
3535 { author sort.format.names }
3536 if$
3537 }
3538
3539 FUNCTION {author.editor.sort}
3540 { author empty$
3541 { editor empty$
3542 { key empty$
3543 { "to sort, need author, editor, or key in " cite$ * warning$
3544 ""
3545 }
3546 { key sortify }
3547 if$
3548 }
3549 { editor sort.format.names }
3550 if$
3551 }
3552 { author sort.format.names }
3553 if$
3554 }
3555
3556 FUNCTION {author.organization.sort}
3557 { author empty$
3558 { organization empty$
3559 { key empty$
3560 { "to sort, need author, organization, or key in " cite$ * warning$
3561 ""
3562 }
3563 { key sortify }
3564 if$
3565 }
3566 { "The " #4 organization chop.word sortify }
3567 if$
3568 }
3569 { author sort.format.names }
3570 if$
3571 }
3572
3573 FUNCTION {editor.organization.sort}
3574 { editor empty$
3575 { organization empty$
3576 { key empty$
3577 { "to sort, need editor, organization, or key in " cite$ * warning$
3578 ""
3579 }
3580 { key sortify }
3581 if$
3582 }
3583 { "The " #4 organization chop.word sortify }
3584 if$
3585 }
3586 { editor sort.format.names }
3587 if$
3588 }
3589
3590 FUNCTION {presort}
3591 { type$ "book" =
3592 type$ "inbook" =
3593 or
3594 'author.editor.sort
3595 { type$ "proceedings" =
3596 'editor.organization.sort
3597 { type$ "manual" =
3598 'author.organization.sort
3599 'author.sort
3600 if$
3601 }
3602 if$
3603 }
3604 if$
3605 " "
3606 *
3607 year field.or.null sortify
3608 *
3609 " "
3610 *
3611 title field.or.null
3612 sort.format.title
3613 *
3614 #1 entry.max$ substring$
3615 'sort.key$ :=
3616 }
3617
3618 ITERATE {presort}
3619
3620 SORT
3621
3622 STRINGS { longest.label }
3623
3624 INTEGERS { number.label longest.label.width }
3625
3626 FUNCTION {initialize.longest.label}
3627 { "" 'longest.label :=
3628 #1 'number.label :=
3629 #0 'longest.label.width :=
3630 }
3631
3632 FUNCTION {longest.label.pass}
3633 { number.label int.to.str$ 'label :=
3634 number.label #1 + 'number.label :=
3635 label width$ longest.label.width >
3636 { label 'longest.label :=
3637 label width$ 'longest.label.width :=
3638 }
3639 'skip$
3640 if$
3641 }
3642
3643 EXECUTE {initialize.longest.label}
3644
3645 ITERATE {longest.label.pass}
3646
3647 % \end{macrocode}
3648 % \fi
3649 %
3650 % |begin.bib| is the second of two functions modified by hand. The
3651 % modification is to have the function write some additional code to the
3652 % |.bbl| file to define |\savetreesbibnote| as the identity function if
3653 % that macro is not already defined.
3654 % \changes{v2.0}{2011/05/12}{Made \texttt{savetrees.bib} work
3655 % independently of \texttt{savetrees.sty} by having it define
3656 % \texttt{\string\string\string\savetreesbibnote} if not already
3657 % defined}
3658 % \begin{macrocode}
3659 FUNCTION {begin.bib}
3660 { preamble$ empty$
3661 'skip$
3662 { preamble$ write$ newline$ }
3663 if$
3664 "\begin{thebibliography}{" longest.label * "}" *
3665 write$ newline$
3666 "\providecommand*{\selectlanguage}[1]{\relax}%"
3667 write$ newline$
3668 "\providecommand*{\savetreesbibnote}[1]{#1}%"
3669 write$ newline$
3670 }
3671 % \end{macrocode}
3672 %
3673 % \begin{center}
3674 % $\vdots$ \\
3675 % (13 lines of code omitted) \\
3676 % $\vdots$
3677 % \end{center}
3678 %
3679 % \iffalse
3680 % \begin{macrocode}
3681
3682 EXECUTE {begin.bib}
3683
3684 EXECUTE {init.state.consts}
3685
3686 ITERATE {call.type$}
3687
3688 FUNCTION {end.bib}
3689 { newline$
3690 "\end{thebibliography}" write$ newline$
3691 }
3692
3693 EXECUTE {end.bib}
3694 % \end{macrocode}
3695 % \fi
3696 %
3697 % \iffalse
3698 %</bstfile>
3699 % \fi
3700 %
3701 %
3702 % \section{Implementation of the Biblatex style files}
3703 % \label{sec:savetrees-biblatex}
3704 %
3705 % We define an analogue of |savetrees.bst| (\ref{sec:savetrees.bst}) for
3706 % Biblatex. This comprises two files: a bibliography style,
3707 % |savetrees.bbx| (\ref{sec:savetrees.bbx}), and a citation style,
3708 % |savetrees.cbx| (\ref{sec:savetrees.cbx}).
3709 %
3710 % \subsection{Implementation of \texttt{savetrees.bbx}}
3711 % \label{sec:savetrees.bbx}
3712 %
3713 % Biblatex's default |numeric-comp| bibliography style is already fairly
3714 % abbreviated so we begin with that and merely make a few changes to
3715 % reduce the number of authors before ``et~al.''\ kicks in; use initials
3716 % for all given and middle names,; suppress typesetting ISBNs, URLs,
3717 % DOIs, and eprint IDs; and honor \pkgname{savetrees}'s |bibnotes|
3718 % option.
3719 %
3720 % \changes{v2.3}{2014/12/19}{Included style files for Biblatex}
3721 %
3722 % \iffalse
3723 %<*bbxfile>
3724 % \fi
3725 %
3726 % \begin{macrocode}
3727 \RequireBibliographyStyle{numeric-comp}
3728
3729 \ExecuteBibliographyOptions{%
3730 maxnames = 2,
3731 minnames = 2,
3732 firstinits = true,
3733 isbn = false,
3734 url = false,
3735 doi = false,
3736 eprint = false
3737 }
3738
3739 \AtBeginDocument{%
3740 \@ifundefined{if@st@tight@bibnotes}{}{%
3741 \if@st@tight@bibnotes
3742 \DeclareFieldFormat{note}{}%
3743 \fi
3744 }%
3745 }
3746 % \end{macrocode}
3747 %
3748 % \iffalse
3749 %</bbxfile>
3750 % \fi
3751 %
3752 %
3753 % \subsection{Implementation of \texttt{savetrees.cbx}}
3754 % \label{sec:savetrees.cbx}
3755 %
3756 % The corresponding |savetrees.cbx| citation style is even more trivial
3757 % than |savetrees.bbx|. It simply defines itself as an alias for
3758 % Biblatex's standard |numeric-comp| citation style.
3759 %
3760 % \iffalse
3761 %<*cbxfile>
3762 % \fi
3763 %
3764 % \begin{macrocode}
3765 \RequireCitationStyle{numeric-comp}
3766 % \end{macrocode}
3767 %
3768 % \iffalse
3769 %</cbxfile>
3770 % \fi
3771 %
3772 % \Finale
3773 \endinput