File: bibclean.sty

package info (click to toggle)
bibclean 2.11.4-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 5,212 kB
  • ctags: 1,545
  • sloc: ansic: 10,737; makefile: 817; perl: 66; sh: 40; awk: 27; sed: 6
file content (294 lines) | stat: -rw-r--r-- 12,451 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Nelson H. F. Beebe",
%%%     version         = "1.01",
%%%     date            = "17 November 1993",
%%%     time            = "15:40:32 MST",
%%%     filename        = "bibclean.sty",
%%%     address         = "Center for Scientific Computing
%%%                        Department of Mathematics
%%%                        University of Utah
%%%                        Salt Lake City, UT 84112
%%%                        USA",
%%%     telephone       = "+1 801 581 5254",
%%%     FAX             = "+1 801 581 4148",
%%%     checksum        = "24086 294 1121 12451",
%%%     email           = "beebe@math.utah.edu (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "BibTeX, bibliography, prettyprint, syntax check,
%%%                        LaTeX style",
%%%     supported       = "yes",
%%%     docstring       = "This file contains macros for bibclean.ltx,
%%%                        plus modifications to style macros from
%%%                        ltugboat.sty and latex.tex to repair
%%%                        problems and add features.
%%%
%%%                        Some of these modifications should be
%%%                        incorporated in a future revision of
%%%                        ltugboat.sty.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================

\hyphenation{bib-li-og-ra-phy-style pretty-printer}

%%======================================================================
%% Definitions of macros used in writing bibclean.ltx.
%%
%% NOTE TO THE EDITOR:
%% Small cap names in macros are given in upper-case letters, because
%% they look too small if entirely in lower-case.  We change TUGboat's
%% \UNIX to match the others.  Several of these macros automatically
%% generate index entries, and some get discretionary hyphens added.
%
\catcode`\_=11                  % underscore is a letter in this document
%
\renewcommand{\BibTeX}{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
            \-T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}%
\newcommand{\BIBCLEAN}{{\tt bib\-clean}\index{bibclean@{\protect\tt bibclean}}}
\newcommand{\CS}[1]{{\tt\char92\relax#1}%
                    \index{control sequence!#1@{\protect\tt\char92\relax#1}}%
                    \index{#1@{\protect\tt\char92\relax#1}}}
\newcommand{\ESCAPE}[1]{{\tt\char92\relax#1}%
                    \index{#1@{\protect\tt\char92\relax#1}}}
\newcommand{\FORMAT}[1]{{\tt \%#1}%
                        \index{\%#1@{\protect\tt \%#1}}%
                        \index{format!item!\%#1@{\protect\tt \%#1}}%
}
\newcommand{\FUNCTION}[1]{{\tt #1()}%
                        \index{#1@{\protect\tt #1()}}%
                        \index{function!#1@{\protect\tt #1()}}%
}
\newcommand{\FUNCTIONINDEX}[1]{%
                        \index{#1@{\protect\tt #1()}}%
                        \index{function!#1@{\protect\tt #1()}}%
}
\newcommand{\MACRO}[1]{{\tt #1}\index{#1@{\protect\tt #1}}%
                               \index{macro!#1@{\protect\tt #1}}}
\newcommand{\MACROINDEX}[1]{\index{#1@{\protect\tt #1}}%
                            \index{macro!#1@{\protect\tt #1}}}

% Here is some fancy work.  We want \OPTION{foobar} to generate a
% foobar index entry, and \OPTION{[no-]foobar} to generate both
% no-foobar and foobar entries.  The TeX macro \gobbleno gobbles the
% [no-] prefix (actually, all text up to a right bracket).  The \if
% tests inside \OPTION and \OPTIONITEM check for the cases of foobar
% and [no-]foobar.

\def\gobbleno#1]{}              % gobble [no-] prefix

\newcommand{\OPTION}[1]{{\tt -#1}%
           \def\@firstchar##1##2\end@firstchar{##1}%
	   \if[\@firstchar#1\end@firstchar % ] for bracket balance
               \index{\gobbleno#1@{\protect\tt -\gobbleno#1}}%
               \index{option!\gobbleno#1@{\protect\tt -\gobbleno#1}}%
               \index{no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
               \index{option!no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
           \else
               \index{#1@{\protect\tt -#1}}%
               \index{option!#1@{\protect\tt -#1}}%
	   \fi
}
\newcommand{\OPTIONITEM}[1]{\item[{\tt -#1}]%
           \hskip 0pt plus 12pt% for better line breaking
           \def\@firstchar##1##2\end@firstchar{##1}%
	   \if[\@firstchar#1\end@firstchar % ] for bracket balance
               \index{\gobbleno#1@{\protect\tt -\gobbleno#1}}%
               \index{option!\gobbleno#1@{\protect\tt -\gobbleno#1}}%
               \index{no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
               \index{option!no-\gobbleno#1@{\protect\tt -no-\gobbleno#1}}%
           \else
               \index{#1@{\protect\tt -#1}}%
               \index{option!#1@{\protect\tt -#1}}%
	   \fi
}

\newcommand{\OSTWO}{{\sc OS/2}\index{OS/2@{\protect\sc OS/2}}}
\newcommand{\PATHINDEX}[1]{\index{#1@{\protect\tt #1}}%
                           \index{file!#1@{\protect\tt #1}}}
\newcommand{\PCDOS}{{\sc PC-DOS}\index{PC-DOS@{\protect\sc PC-DOS}}}
\newcommand{\PROGRAM}[1]{{\tt #1}\index{#1@{\protect\tt #1}}}
\newcommand{\RULE}[1]{{\tt #1}\index{#1@{\protect\tt #1} rule}%
                            \index{non-terminal!#1@{\protect\tt #1}}}
\newcommand{\RULEINDEX}[1]{\index{#1@{\protect\tt #1} rule}%
                            \index{non-terminal!#1@{\protect\tt #1}}}
\newcommand{\SCRIBE}{{\sc Scribe}\index{Scribe@{\protect\sc Scribe}}}
\newcommand{\seealso}[2]{{\em see also\/} #1}
% \SGML was added to tugboat.cmn 1.11c [29-Nov-1992], but we want
% our private version to index the name as well as typeset it, so
% we change \newcommand to \renewcommand.
\renewcommand{\SGML}{{\sc SGML}\index{SGML@{\protect\sc SGML}}}
\newcommand{\TOKEN}[1]{{\tt #1}\index{#1@{\protect\tt #1}}%
                            \index{terminal!#1@{\protect\tt #1}}}
\newcommand{\TOKENINDEX}[1]{\index{#1@{\protect\tt #1}}%
                            \index{terminal!#1@{\protect\tt #1}}}
\newcommand{\TOS}{{\sc TOS}\index{TOS@{\protect\sc TOS}}}
\newcommand{\TT}[1]{{\tt #1}\index{#1@{\protect\tt #1}}}
\newcommand{\TTINDEX}[1]{\index{#1@{\protect\tt #1}}}
\renewcommand{\UNIX}{{\sc UNIX}\index{UNIX@{\protect\sc UNIX}}}
\newcommand{\VARIABLE}[1]{{\tt #1}%
                        \index{#1@{\protect\tt #1}}%
                        \index{variable!#1@{\protect\tt #1}}%
}
\newcommand{\VARIABLEINDEX}[1]{%
                        \index{#1@{\protect\tt #1}}%
                        \index{variable!#1@{\protect\tt #1}}%
}
\renewcommand{\VAX}{{\sc VAX}\index{VAX@{\protect\sc VAX}}}
\newcommand{\VMS}{{\sc VMS}\index{VMS@{\protect\sc VMS}}}
\renewcommand{\WEB}{{\tt WEB}\index{WEB@{\protect\tt WEB}}}
%
%%======================================================================
%% Parameter adjustments to reduce the number of overfull and
%% underfull boxes in the narrow TUGboat columns
%
\newcommand{\optbreak}{\penalty 0}% optional hyphenless line break point
\emergencystretch = 1pt         % a little bit of extra stretch helps
\exhyphenpenalty = 25           % hyphenations are okay
\hbadness = 3000                % be quiet unless badness exceeds this
\hfuzz = 2pt                    % allow slightly overfull boxes
\hyphenchar\nintt = `-          % allow hyphenation in \tt font sizes
\hyphenchar\tentt = `-
\hyphenchar\elvtt = `-
\hyphenchar\twltt = `-
\hyphenpenalty = 25             % hyphenations are okay
\tolerance = 2000               % extra white space is expected
%
%%======================================================================
%% Bug fixes.
%%
%% Repair some problems in latex.tex.
%%
%% LaTeX's default tolerance of 10000 in sloppy and sloppypar is
%% unsatisfactory in two-column mode; \emergencystretch saves the day.
%%
%% OLD: \def\sloppy{\tolerance 10000 \hfuzz .5\p@ \vfuzz .5\p@}
\renewcommand{\sloppy}{\emergencystretch=10pt
                       \tolerance 9000 \hfuzz 0.5pt \vfuzz 0.5pt}
%
%%======================================================================
%% Bug fixes.
%%
%% Repair some problems in ltugboat.sty.  I believe that these changes
%% should be made permanently to ltugboat.sty.
%%
%% Revise ltugboat.sty's \l@section which typesets a section heading
%% table of contents entry.  The original version sets long headings
%% flush right, which gives spaced out text which looks awful.  We
%% change it to typeset headings in \raggedright instead, and indent
%% the macro to make it more readable.
%% \l@section{TOC-ENTRY}{PAGE-NUMBER}
\def\l@section#1#2%
{%
    \addpenalty{\@secpenalty}%
    \addvspace{1.0em plus 1pt}%
    \@tempdima 1.5em
    \begingroup
        \parindent \z@
        \rightskip \z@  % article style makes \rightskip > 0
        \parfillskip \z@
        \bf
        \leavevmode
        \advance\leftskip\@tempdima% indent text by width of \numberline
        \hskip -\leftskip       % move left for section number on first line
        \raggedright            % NEW: no flushright text in tocs
        #1% toc-entry text
        \unskip                 % NEW: discard intervening space
        \nobreak
        \hfill                  % was \hfil, but need stronger version
        \nobreak
        \hbox to \@pnumwidth {\hss #2}% page number
        \par
    \endgroup
}
%
%% OLD: \def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\l@figure{\@dottedtocline{1}{0em}{1.5em}}
\let\l@table=\l@figure
%
%% Increase \@pnumwidth by 0.45em (4.5pt) to avoid overfull box
%% from bad default setting.
%% OLD: \def\@pnumwidth{1.55em}
\def\@pnumwidth{2em}
%
%% Modification of \@dottedtocline from latex.tex to produce ragged right
%% entries instead of   very   spaced    out     entries.
\def\@dottedtocline#1#2#3#4#5{%
 \ifnum #1>\c@tocdepth
 \else
    \vskip \z@ plus .2pt
    {%
      \leftskip #2\relax
      \rightskip \@tocrmarg
      \parfillskip -\rightskip
      \parindent #2\relax
      \@afterindenttrue
      \interlinepenalty\@M
      \leavevmode
      \@tempdima #3\relax       % tempdima := NUMWIDTH
      \advance\leftskip \@tempdima % leftskip := INDENT + NUMWIDTH
      \hbox{}%
      \hskip -\leftskip
      {%
          \raggedright
          #4
          \unskip
          \nobreak
          \hfill
          \nobreak
          \hbox to\@pnumwidth{\hfil\rm #5}%
          \par
      }%
      \par
    }%
  \fi
}
%
%%======================================================================
%% Stylistic changes.
%%
%% Modifications to get toc entries for bibliography and index
%% sections and to avoid loss of section headings in index.  Both of
%% these should be merged into ltugboat.sty.
%
\def\thebibliography#1{%
  \section*{References\@mkboth
  {REFERENCES}{REFERENCES}}\list
  {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumi}}%
    \def\newblock{\hskip .11em plus .33em minus .07em}%
    \tolerance 8000 \hfuzz .5\p@ \vfuzz .5\p@
    \clubpenalty4000\widowpenalty4000
    \addcontentsline{toc}{section}{\numberline {}References}%
    \sfcode`\.=1000\relax
}
%
% Change \theindex to not fiddle page style, typeset in ragged right,
% and use a \small font to shorten the article.  For bibclean.ltx,
% this only reduces the index size from 8 pages to 7 pages.  A \tiny
% font (5 pt) reduces it to 4, but standard LaTeX lacks \sc and \tt in
% that size, and we need both of them.
\renewcommand{\theindex}{%
    \section*{Index}%
    \@mkboth{INDEX}{INDEX}%
%% OLD:   \thispagestyle{plain}    %leave pagestyle alone
    \parindent\z@
    \parskip\z@ plus .3pt\relax\let\item\@idxitem
    \addcontentsline{toc}{section}{\numberline {}Index}%
    \raggedright                % index entries are sometimes long
    \small                      % small font to compress index
}
%
% Change \endtheindex to not do a page eject, so signature display can
% fall on index page, and reset type size to \normalsize.
\def\endtheindex{\if@restonecol\onecolumn\else\fi\par\normalsize}

%=======================================================================
\endinput