Debian Codegraph @

doc/bibclean.sty

raw
1 %%% ====================================================================
2 %%% @LaTeX-style-file{
3 %%% author = "Nelson H. F. Beebe",
4 %%% version = "1.01",
5 %%% date = "17 November 1993",
6 %%% time = "15:40:32 MST",
7 %%% filename = "bibclean.sty",
8 %%% address = "Center for Scientific Computing
9 %%% Department of Mathematics
10 %%% University of Utah
11 %%% Salt Lake City, UT 84112
12 %%% USA",
13 %%% telephone = "+1 801 581 5254",
14 %%% FAX = "+1 801 581 4148",
15 %%% checksum = "24086 294 1121 12451",
16 %%% email = "[email protected] (Internet)",
17 %%% codetable = "ISO/ASCII",
18 %%% keywords = "BibTeX, bibliography, prettyprint, syntax check,
19 %%% LaTeX style",
20 %%% supported = "yes",
21 %%% docstring = "This file contains macros for bibclean.ltx,
22 %%% plus modifications to style macros from
23 %%% ltugboat.sty and latex.tex to repair
24 %%% problems and add features.
25 %%%
26 %%% Some of these modifications should be
27 %%% incorporated in a future revision of
28 %%% ltugboat.sty.
29 %%%
30 %%% The checksum field above contains a CRC-16
31 %%% checksum as the first value, followed by the
32 %%% equivalent of the standard UNIX wc (word
33 %%% count) utility output of lines, words, and
34 %%% characters. This is produced by Robert
35 %%% Solovay's checksum utility.",
36 %%% }
37 %%% ====================================================================
38
39 \hyphenation{bib-li-og-ra-phy-style pretty-printer}
40
41 %%======================================================================
42 %% Definitions of macros used in writing bibclean.ltx.
43 %%
44 %% NOTE TO THE EDITOR:
45 %% Small cap names in macros are given in upper-case letters, because
46 %% they look too small if entirely in lower-case. We change TUGboat's
47 %% \UNIX to match the others. Several of these macros automatically
48 %% generate index entries, and some get discretionary hyphens added.
49 %
50 \catcode`\_=11 % underscore is a letter in this document
51 %
52 \renewcommand{\BibTeX}{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
53 \-T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}%
54 \newcommand{\BIBCLEAN}{{\tt bib\-clean}\index{bibclean@{\protect\tt bibclean}}}
55 \newcommand{\CS}[1]{{\tt\char92\relax#1}%
56 \index{control sequence!#1@{\protect\tt\char92\relax#1}}%
57 \index{#1@{\protect\tt\char92\relax#1}}}
58 \newcommand{\ESCAPE}[1]{{\tt\char92\relax#1}%
59 \index{#1@{\protect\tt\char92\relax#1}}}
60 \newcommand{\FORMAT}[1]{{\tt \%#1}%
61 \index{\%#1@{\protect\tt \%#1}}%
62 \index{format!item!\%#1@{\protect\tt \%#1}}%
63 }
64 \newcommand{\FUNCTION}[1]{{\tt #1()}%
65 \index{#1@{\protect\tt #1()}}%
66 \index{function!#1@{\protect\tt #1()}}%
67 }
68 \newcommand{\FUNCTIONINDEX}[1]{%
69 \index{#1@{\protect\tt #1()}}%
70 \index{function!#1@{\protect\tt #1()}}%
71 }
72 \newcommand{\MACRO}[1]{{\tt #1}\index{#1@{\protect\tt #1}}%
73 \index{macro!#1@{\protect\tt #1}}}
74 \newcommand{\MACROINDEX}[1]{\index{#1@{\protect\tt #1}}%
75 \index{macro!#1@{\protect\tt #1}}}
76
77 % Here is some fancy work. We want \OPTION{foobar} to generate a
78 % foobar index entry, and \OPTION{[no-]foobar} to generate both
79 % no-foobar and foobar entries. The TeX macro \gobbleno gobbles the
80 % [no-] prefix (actually, all text up to a right bracket). The \if
81 % tests inside \OPTION and \OPTIONITEM check for the cases of foobar
82 % and [no-]foobar.
83
84 \def\gobbleno#1]{} % gobble [no-] prefix
85
86 \newcommand{\OPTION}[1]{{\tt -#1}%
87 \def\@firstchar##1##2\end@firstchar{##1}%
88 \if[\@firstchar#1\end@firstchar % ] for bracket balance
89 \index{\gobbleno#1@{\protect\tt -\gobbleno#1}}%
90 \index{option!\gobbleno#1@{\protect\tt -\gobbleno#1}}%
91 \index{no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
92 \index{option!no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
93 \else
94 \index{#1@{\protect\tt -#1}}%
95 \index{option!#1@{\protect\tt -#1}}%
96 \fi
97 }
98 \newcommand{\OPTIONITEM}[1]{\item[{\tt -#1}]%
99 \hskip 0pt plus 12pt% for better line breaking
100 \def\@firstchar##1##2\end@firstchar{##1}%
101 \if[\@firstchar#1\end@firstchar % ] for bracket balance
102 \index{\gobbleno#1@{\protect\tt -\gobbleno#1}}%
103 \index{option!\gobbleno#1@{\protect\tt -\gobbleno#1}}%
104 \index{no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
105 \index{option!no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
106 \else
107 \index{#1@{\protect\tt -#1}}%
108 \index{option!#1@{\protect\tt -#1}}%
109 \fi
110 }
111
112 \newcommand{\OSTWO}{{\sc OS/2}\index{OS/2@{\protect\sc OS/2}}}
113 \newcommand{\PATHINDEX}[1]{\index{#1@{\protect\tt #1}}%
114 \index{file!#1@{\protect\tt #1}}}
115 \newcommand{\PCDOS}{{\sc PC-DOS}\index{PC-DOS@{\protect\sc PC-DOS}}}
116 \newcommand{\PROGRAM}[1]{{\tt #1}\index{#1@{\protect\tt #1}}}
117 \newcommand{\RULE}[1]{{\tt #1}\index{#1@{\protect\tt #1} rule}%
118 \index{non-terminal!#1@{\protect\tt #1}}}
119 \newcommand{\RULEINDEX}[1]{\index{#1@{\protect\tt #1} rule}%
120 \index{non-terminal!#1@{\protect\tt #1}}}
121 \newcommand{\SCRIBE}{{\sc Scribe}\index{Scribe@{\protect\sc Scribe}}}
122 \newcommand{\seealso}[2]{{\em see also\/} #1}
123 % \SGML was added to tugboat.cmn 1.11c [29-Nov-1992], but we want
124 % our private version to index the name as well as typeset it, so
125 % we change \newcommand to \renewcommand.
126 \renewcommand{\SGML}{{\sc SGML}\index{SGML@{\protect\sc SGML}}}
127 \newcommand{\TOKEN}[1]{{\tt #1}\index{#1@{\protect\tt #1}}%
128 \index{terminal!#1@{\protect\tt #1}}}
129 \newcommand{\TOKENINDEX}[1]{\index{#1@{\protect\tt #1}}%
130 \index{terminal!#1@{\protect\tt #1}}}
131 \newcommand{\TOS}{{\sc TOS}\index{TOS@{\protect\sc TOS}}}
132 \newcommand{\TT}[1]{{\tt #1}\index{#1@{\protect\tt #1}}}
133 \newcommand{\TTINDEX}[1]{\index{#1@{\protect\tt #1}}}
134 \renewcommand{\UNIX}{{\sc UNIX}\index{UNIX@{\protect\sc UNIX}}}
135 \newcommand{\VARIABLE}[1]{{\tt #1}%
136 \index{#1@{\protect\tt #1}}%
137 \index{variable!#1@{\protect\tt #1}}%
138 }
139 \newcommand{\VARIABLEINDEX}[1]{%
140 \index{#1@{\protect\tt #1}}%
141 \index{variable!#1@{\protect\tt #1}}%
142 }
143 \renewcommand{\VAX}{{\sc VAX}\index{VAX@{\protect\sc VAX}}}
144 \newcommand{\VMS}{{\sc VMS}\index{VMS@{\protect\sc VMS}}}
145 \renewcommand{\WEB}{{\tt WEB}\index{WEB@{\protect\tt WEB}}}
146 %
147 %%======================================================================
148 %% Parameter adjustments to reduce the number of overfull and
149 %% underfull boxes in the narrow TUGboat columns
150 %
151 \newcommand{\optbreak}{\penalty 0}% optional hyphenless line break point
152 \emergencystretch = 1pt % a little bit of extra stretch helps
153 \exhyphenpenalty = 25 % hyphenations are okay
154 \hbadness = 3000 % be quiet unless badness exceeds this
155 \hfuzz = 2pt % allow slightly overfull boxes
156 \hyphenchar\nintt = `- % allow hyphenation in \tt font sizes
157 \hyphenchar\tentt = `-
158 \hyphenchar\elvtt = `-
159 \hyphenchar\twltt = `-
160 \hyphenpenalty = 25 % hyphenations are okay
161 \tolerance = 2000 % extra white space is expected
162 %
163 %%======================================================================
164 %% Bug fixes.
165 %%
166 %% Repair some problems in latex.tex.
167 %%
168 %% LaTeX's default tolerance of 10000 in sloppy and sloppypar is
169 %% unsatisfactory in two-column mode; \emergencystretch saves the day.
170 %%
171 %% OLD: \def\sloppy{\tolerance 10000 \hfuzz .5\p@ \vfuzz .5\p@}
172 \renewcommand{\sloppy}{\emergencystretch=10pt
173 \tolerance 9000 \hfuzz 0.5pt \vfuzz 0.5pt}
174 %
175 %%======================================================================
176 %% Bug fixes.
177 %%
178 %% Repair some problems in ltugboat.sty. I believe that these changes
179 %% should be made permanently to ltugboat.sty.
180 %%
181 %% Revise ltugboat.sty's \l@section which typesets a section heading
182 %% table of contents entry. The original version sets long headings
183 %% flush right, which gives spaced out text which looks awful. We
184 %% change it to typeset headings in \raggedright instead, and indent
185 %% the macro to make it more readable.
186 %% \l@section{TOC-ENTRY}{PAGE-NUMBER}
187 \def\l@section#1#2%
188 {%
189 \addpenalty{\@secpenalty}%
190 \addvspace{1.0em plus 1pt}%
191 \@tempdima 1.5em
192 \begingroup
193 \parindent \z@
194 \rightskip \z@ % article style makes \rightskip > 0
195 \parfillskip \z@
196 \bf
197 \leavevmode
198 \advance\leftskip\@tempdima% indent text by width of \numberline
199 \hskip -\leftskip % move left for section number on first line
200 \raggedright % NEW: no flushright text in tocs
201 #1% toc-entry text
202 \unskip % NEW: discard intervening space
203 \nobreak
204 \hfill % was \hfil, but need stronger version
205 \nobreak
206 \hbox to \@pnumwidth {\hss #2}% page number
207 \par
208 \endgroup
209 }
210 %
211 %% OLD: \def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
212 \def\l@figure{\@dottedtocline{1}{0em}{1.5em}}
213 \let\l@table=\l@figure
214 %
215 %% Increase \@pnumwidth by 0.45em (4.5pt) to avoid overfull box
216 %% from bad default setting.
217 %% OLD: \def\@pnumwidth{1.55em}
218 \def\@pnumwidth{2em}
219 %
220 %% Modification of \@dottedtocline from latex.tex to produce ragged right
221 %% entries instead of very spaced out entries.
222 \def\@dottedtocline#1#2#3#4#5{%
223 \ifnum #1>\c@tocdepth
224 \else
225 \vskip \z@ plus .2pt
226 {%
227 \leftskip #2\relax
228 \rightskip \@tocrmarg
229 \parfillskip -\rightskip
230 \parindent #2\relax
231 \@afterindenttrue
232 \interlinepenalty\@M
233 \leavevmode
234 \@tempdima #3\relax % tempdima := NUMWIDTH
235 \advance\leftskip \@tempdima % leftskip := INDENT + NUMWIDTH
236 \hbox{}%
237 \hskip -\leftskip
238 {%
239 \raggedright
240 #4
241 \unskip
242 \nobreak
243 \hfill
244 \nobreak
245 \hbox to\@pnumwidth{\hfil\rm #5}%
246 \par
247 }%
248 \par
249 }%
250 \fi
251 }
252 %
253 %%======================================================================
254 %% Stylistic changes.
255 %%
256 %% Modifications to get toc entries for bibliography and index
257 %% sections and to avoid loss of section headings in index. Both of
258 %% these should be merged into ltugboat.sty.
259 %
260 \def\thebibliography#1{%
261 \section*{References\@mkboth
262 {REFERENCES}{REFERENCES}}\list
263 {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
264 \advance\leftmargin\labelsep
265 \usecounter{enumi}}%
266 \def\newblock{\hskip .11em plus .33em minus .07em}%
267 \tolerance 8000 \hfuzz .5\p@ \vfuzz .5\p@
268 \clubpenalty4000\widowpenalty4000
269 \addcontentsline{toc}{section}{\numberline {}References}%
270 \sfcode`\.=1000\relax
271 }
272 %
273 % Change \theindex to not fiddle page style, typeset in ragged right,
274 % and use a \small font to shorten the article. For bibclean.ltx,
275 % this only reduces the index size from 8 pages to 7 pages. A \tiny
276 % font (5 pt) reduces it to 4, but standard LaTeX lacks \sc and \tt in
277 % that size, and we need both of them.
278 \renewcommand{\theindex}{%
279 \section*{Index}%
280 \@mkboth{INDEX}{INDEX}%
281 %% OLD: \thispagestyle{plain} %leave pagestyle alone
282 \parindent\z@
283 \parskip\z@ plus .3pt\relax\let\item\@idxitem
284 \addcontentsline{toc}{section}{\numberline {}Index}%
285 \raggedright % index entries are sometimes long
286 \small % small font to compress index
287 }
288 %
289 % Change \endtheindex to not do a page eject, so signature display can
290 % fall on index page, and reset type size to \normalsize.
291 \def\endtheindex{\if@restonecol\onecolumn\else\fi\par\normalsize}
292
293 %=======================================================================
294 \endinput