Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % This file is part of the MARGBIB package, a package for displaying
4 % bibliography tags in the margins. Copyright (C) 1997 Karsten Tinnefeld.
5 %
6 % This file is NOT part of the LaTeX2e system, but intended for use with it.
7 %
8 % This document is free software; you can redistribute it and/or modify it
9 % under the terms of the GNU Library General Public License as published by
10 % the Free Software Foundation; either version 2 of the License, or (at your
11 % option) any later version.
12 %
13 % This document is distributed in the hope that it will be useful, but WITHOUT
14 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 % more details.
17 %
18 % You should have received a copy of the GNU General Public License somehow;
19 % if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
20 % Cambridge, MA 02139, USA.
21 %
22 % INSTALLATION:
23 %%%%%%%%%%%%%%%
24 %
25 % Install this style by running the file `margbib.ins' thro' TeX. This will
26 % create the file `margbib.sty' and, if your docstrip.cfg is set up the right
27 % way (has a \BaseDirectory{<path to my texmf directory>}, see the
28 % docstrip-documentation), automatically moved to \$TEXMF/tex/latex/misc.
29 %
30 % The documentation is created by running `latex margbib.dtx`.
31 %
32 \NeedsTeXFormat{LaTeX2e}
33 %<*dtx>
34 \ProvidesFile{margbib.dtx}
35 %</dtx>
36 %<!driver>\ProvidesPackage{margbib}
37 %<driver>\ProvidesFile{margbib.drv}
38 % \fi
39 % \ProvidesFile{margbib.dtx}
40 [1997/11/11 1.0c Bib-Items into the margins]
41 %
42 % \iffalse
43 %<*driver>
44 \documentclass{ltxdoc}
45 \usepackage{margbib}
46 \GetFileInfo{margbib.dtx}
47 \def\docdate{1997/11/10}
48 \RecordChanges
49 \begin{document}
50 \DocInput{\filename}
51 \end{document}
52 %</driver>
53 % \fi
54 %
55 % \CheckSum{55}
56 %
57 % {\makeatletter\@ifundefined{AmS}
58 % {\gdef\AmS{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex%
59 % \hbox{$\mathcal M$}\kern-.2em\mathcal S$}}}{}}
60 % \def\KOMAScript{\textsf{KOMA-Script}}
61 % \def\refname{Example}
62 %
63 % \date{printed \today}
64 % \title{The \texttt{margbib} document style\thanks{%
65 % This file has version number \fileversion,
66 % last revised \filedate, documentation dated \docdate.}}
67 % \author{Karsten Tinnefeld\\\texttt{[email protected]}}
68 % \maketitle
69 %
70 % \begin{abstract}
71 % This document describes the \texttt{margbib} document style. This style
72 % redefines the \texttt{thebibliography} environment in order to move the
73 % bibliography labels into the borders.
74 % \end{abstract}
75 %
76 % \section{Introduction}
77 %
78 % Why the |margbib| style? Many typesetters say that text is only readable
79 % when it is not wider than, say, about 70 letters. This limit is very tight,
80 % provided typesetting on one column ISO A4 paper, the usual European
81 % paper size. Thus there is a tradeoff between readability in normal text
82 % paragraphs and the amount of trouble in line breaking especially of
83 % bibliographies, where masses of names and declarative title words
84 % discourage easy hyphenation. Large tags in all ``speaking'' citation styles
85 % such as |alpha| or |abbrv| make it even harder as the books' label sizes
86 % increase.
87 %
88 % Therefore, this style takes the label off the normal paragraph and places
89 % it right beside the text in the margin. Since the normal |\marginpar|
90 % command has problems with its output routine in case |twoside| is
91 % used---first the marginalium is set, then a compound paragraph is possibly
92 % put onto the next page---we employ the |marn.sty| created in 1993 by Donald
93 % Arseneau. It ensures right placing of the marginal note in this case. This
94 % is done utilising the |.aux|-file, but who does not re\TeX\ each
95 % document twice or thrice?
96 %
97 % This document style has been tested with the normal \LaTeXe\ base, the
98 % \AmS\ and the \KOMAScript\ documents. It works---most important---with the
99 % twoside option and the use of normal |\marginpar|s, for problems therewith
100 % cf. the documentation to |marn.sty|. I have found one minor caveat: it does
101 % not print out this famous ``labels have changed, please re\TeX!'' message
102 % in case of modifications, so my AUC \TeX\footnote{AUC \TeX\ is Per
103 % Abrahamsen's famous \TeX\ mode for Emacs.}\ makes wrong proposals about
104 % what to do next. Minor, as I said.
105 %
106 % \section{Remark}
107 %
108 % The \AmS\ bibliography styles make the paragraph text some degrees smaller
109 % than regular. This package keeps this font size in paragraph text, but sets
110 % the margin labels in normal font. This does not look that great, but
111 % whoever wants to combine both is encouraged to fix it.
112 %
113 % \begin{thebibliography}{Knu86}
114 % \bibitem[Knu86]{knuth86:_texbook}
115 % Donald~E. Knuth.
116 % \newblock {\em The \TeX{}book}, volume~A of {\em Computers \&
117 % Typesetting}.
118 % \newblock American Mathematical Society, Reading MA, 1986.
119 %
120 % \bibitem[Mit97]{mittelbach97}
121 % Frank Mittelbach.
122 % \newblock {\em The |doc| and |shortvrb| packages}.
123 % \newblock Gutenbach Universit{\"a}t Mainz, February 5th, 1997.
124 % \end{thebibliography}
125 %
126 % \StopEventually{}
127 %
128 % \section{The Code}
129 %
130 % \changes{v1.0b}{1997/11/10}{Only require |marn.sty| when available.}
131 %
132 % Let us look whether the document style |marn| by Donald Arseneau
133 % exists. This will avoid difficulties in |twoside|-mode. If so, we
134 % load the package, otherwise output a warning and make do with
135 % |\marginpar|.
136 %
137 % \begin{macrocode}
138 \IfFileExists{marn.sty}{%
139 \RequirePackage{marn}
140 }{%
141 \PackageWarning{margbib}{%
142 marn package unavailable -- using \string\marginpar}%
143 \let\marn\marginpar}
144 % \end{macrocode}
145 %
146 % \begin{macro}{\bibitem}
147 % This redefines |\bibitem| and the two subcommands (with and without the
148 % optional tag) to move our label information into the borders. We could
149 % leave out the first line of the following code for all the examined
150 % styles, after all, but since the |@|-commands are not said to persist,
151 % this redundancy may be future's benefit.
152 %
153 % \begin{macrocode}
154 \def\bibitem{\@ifnextchar[\@lbibitem\@bibitem}
155 \def\@lbibitem[#1]#2{\item[]\if@filesw
156 {\makebox{}\marn{\@biblabel{#1}}%
157 \let\protect\noexpand
158 \immediate
159 \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
160 \def\@bibitem#1{\item[]\if@filesw\immediate\write\@auxout
161 {\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces}
162 % \end{macrocode}
163 % \end{macro}
164 %
165 % \begin{environment}{thebibliography}
166 % In order to broaden our text to the whole |\item|less width, we have to
167 % redefine the |thebibliography| environment. For the sake of its
168 % document-dependent facilities, we first steal the code and then
169 % manipulate it: The shape of the paragraph is simply reset.
170 %
171 % Why override the given environment instead of defining a new? For those
172 % who write bibliographies one after the other by themselves, this is no
173 % problem. But \BibTeX\ generates |thebibliography| environments, and
174 % nothing else. Thus it is only a question of working with |margbib.sty| or
175 % without. Whoever wanted to have \emph{different} forms of bibliographies
176 % in one document, e. g. using |chapterbib|, might possibly have cramped
177 % her style.
178 %
179 % \begin{macrocode}
180 \let\m@rgbib=\thebibliography
181 \let\endm@rgbib=\endthebibliography
182 \renewenvironment{thebibliography}[1]{%
183 \begin{m@rgbib}{#1}
184 \parshape=0\relax
185 }{%
186 \end{m@rgbib}
187 }
188 % \end{macrocode}
189 % \end{environment}
190 %
191 %\Finale