summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/compactbib/compactbib.sty
blob: d26a0f5fd3e47888b970a6df0ea0e1e6cbeb2dd8 (plain)
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
%%% compactbib.sty
%%% compact bibliography, 
%%% allowing many "thebibliography" environments with continuous numbering
%%% Furthermore, the vertical space between the entries is slighty smaller. 
%%% This package may be useful for curriculum vitaes.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% version 1.0, November 2001
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Antoine LEJAY [lejay@maths.ox.ac.uk]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% adaptation from code in latex.ltx and article.cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% usage 
%%% \begin{thebibliography}[Articles]{00}
%%% \bibitem ...
%%% \end{thebibliography}
%%% writes "Articles" instead of "References" and start 
%%% a list of entries.
%%% \bibitem ...
%%% \end{thebibliographyonly}
%%% writes nothing
%%%
%%% Remark : this package is not interfaced with BibTeX, 
%%%	     except when one uses "cut and past"ing functionalities...
%%%
%%% option: noname 
%%% 		the environment "thebibliography" acts 
%%%		in fact like "thebibliographyonly" for all 
%%%		its usage (no optional argument allowed).
%%% additional commands: bibliowidth (gives a unique width 
%%%		for all the labels)
%%%	ex: \bibliowidth{000}
%%% typography of \refname. To override the standard setting :
%%%	\renewcommand{\bibliorefname}[1]{\section{#1}} for example
%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Interseting related packages: paralist.sty, multibib.sty, bibtopic.sty...
%%% todo: a lot (adding some flexibility, as in paralist.sty).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LICENCE:
% This file may be distributed under the terms of the LaTeX Project Public
% License, as described in lppl.txt in the base LaTeX distribution.
% Either version 1 or, at your option, any later version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{1.0}
\def\filedate{2000/11/01}
\ProvidesPackage{compactbib}[\filedate\space\fileversion]


\newcounter{compactbib@continuated}
\setcounter{compactbib@continuated}{0}

\newif\ifbiblioname
\biblionametrue

\DeclareOption{noname}{\biblionamefalse}
%% the option noname does not give a name for the bibliographic list
\ProcessOptions

\newcommand{\bibliowidth}[1]{\gdef\compactbib@globalwidth{#1}}
%% overrides the local definition of the width of a label 
%% for all the thebibliography environment

%% The way \refname or the name of the list of entries is
%% typesetted using this command.
\newcommand{\bibliorefname}[1]{\noindent\textsc{#1}}

\ifbiblioname
\renewenvironment{thebibliography}[2][\refname]{
\medskip
\bibliorefname{#1}
\@ifundefined{compactbib@globalwidth}{%
\def\compactbib@width{#2}}{\let\compactbib@width\compactbib@globalwidth}
\begin{thebibliographyonly}{\compactbib@width}}{\end{thebibliographyonly}}
\else
\renewenvironment{thebibliography}[1]{%
\@ifundefined{compactbib@globalwidth}{%
\def\compactbib@width{#1}}{\let\compactbib@width\compactbib@globalwidth}
\begin{thebibliographyonly}{\compactbib@width}}{\end{thebibliographyonly}}
\fi

\newenvironment{thebibliographyonly}[1]
     {\list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \setlength{\itemsep}{0pt}
            \setlength{\parsep}{0pt}
            \@openbib@code
            \usecounter{enumiv}%
            \setcounter{enumiv}{\arabic{compactbib@continuated}}
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
 {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
       \setcounter{compactbib@continuated}{\@arabic\c@enumiv}
      \endlist}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% End of the file compactbib.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%