summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/inlinebib/inlinebib.sty
blob: b631dd226057d195dddd053a6d9f52de1a83a913 (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
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
%% Copyright (C) 1994, 1995 René Seindal (rene@seindal.dk)

% This files may be distributed under the terms of the LaTeX Project Public
% License as distributed from CTAN archives in macros/latex/base/lppl.txt;
% either version 1.0 or, at your option, any later version.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{inlinebib}[1994/12/06\space Inline bibliography style]
\ProcessOptions

  %% No labels in the final list of litterature.

\let\@biblabel\@gobble


  %% This is called for each bibitem without option in the bbl file.
  %% The inlinebib style does not use bibitems with optional
  %% arguments.  The arguments are: #1 = key, #2 = basic entry, #3 =
  %% notes for last reference list only, #4 = short entry for successive
  %% citations.  The period that ends an entry in the list is never
  %% present in the inline reference.   Punctuations should be added
  %% manually. 

\long\def\@bibitem#1 #2 \note #3 \short #4 \end{\par\if@filesw
	{\def\protect##1{\string ##1\space}%
	 \let\newblock\@empty
	 \immediate\write\@auxout{\string
		\bibcite{#1}{\string\@bibcall{#1}{#2}{#4}}}}\fi
	{\let\cite\shortcite #2#3}}
%	{\let\cite\shortcite #2}}



  %% This is called from the aux file at the start of the job.

\long\def\bibcite#1#2{\global\@namedef{b@#1}{#2}}




  %% Set globally true iff an immediate following period should be
  %% gobbled, because the citation ends in a period, e.g., from a
  %% trailing "cit." or "ibid." and there is no optional part.

\newif\if@gobbleperiod
\newif\if@withpages


  %% Separate the first and the following citations of a reference, and
  %% handle successive identical citations of the same reference.  Each
  %% macro b@LABEL is defined as \@bibcall{LABEL}{FULLCITE}{SHORTCITE}.
  %% The actual definition of b@LABELis not changed after the first
  %% citation, since it provokes messages of "Labels may have changed"
  %% from LaTeX.

\def\@lastcite{}
\def\noibid{\gdef\@lastcite{}}

\long\def\@bibcall#1#2#3{\global\@gobbleperiodfalse
	\@ifundefined{B@#1}%
		{{#2}\global\@namedef{B@#1}{}}%
		{\@bibsecond{#1}{#3}}%
	\gdef\@lastcite{#1}%
}

\long\def\@bibsecond#1#2{%
	\def\@tempa{#1}%
	\ifx\@tempa\@lastcite {\em ibid.}\else {#2} cit.\fi
	\if@withpages \else \global\@gobbleperiodtrue \fi
}

  %% Called for each normal \cite call.  This version does not allow
  %% multiple citations in one call, as it makes little sense.  The
  %% labels are much too long.

\def\cite{\protect\@pcite}
\def\@pcite{\@ifnextchar [{\@withpagestrue\@citex}{\@withpagesfalse\@citex[]}}

\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
	\@ifundefined{b@#2}%
		{{\reset@font\bf ?}\@warning
			{Citation `#2' on page \thepage \space undefined}}%
		{\@cite{\@nameuse{b@#2}}{#1}}%
	\let\next\relax
	\if@gobbleperiod \let\next\check@period \fi
	\next
}


  %% Produces the actual inline citation, no bracketes around it.

\def\@cite#1#2{{#1\if@withpages , #2\fi}}


  %% Remove a following period.

\def\check@period{\futurelet\next\check@peri@d}
\def\check@peri@d{\ifx\next .\let\next\eat@period
	\else \let\next\relax \fi \next}
\def\eat@period.{}





  %% Forced full citation

\def\fullycite{\protect\@pfcite}
\def\@pfcite{\@ifnextchar [{\@withpagestrue\@fcitex}{\@withpagesfalse\@fcitex[]}}
 
\def\@fcitex[#1]#2{\expandafter\let\csname B@#2\endcsname\undefined
  \@citex[#1]{#2}}

  %% Forced short citation, with no "cit." suffix or "ibid."
  %% substitutions.

\def\shortcite{\protect\@pscite}
\def\@pscite{\@ifnextchar [{\@withpagestrue\@scitex}{\@withpagesfalse\@scitex[]}}
 
\def\@scitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \@ifundefined{b@#2}{{\reset@font\bf ?}\@warning
       {Citation `#2' on page \thepage \space undefined}}%
  {\long\def\@bibcall##1##2##3{##3}%
   \@cite{\@nameuse{b@#2}}{#1}}}



  %% Force full citations of the specified list of references.

\def\fullcitenext#1{{\@tfor
	\@tempa :=#1\do{\expandafter\global\expandafter
		\let\csname B@\@tempa\endcsname\undefined}}}

  %% Force short citations of the specified list of references.

\def\shortcitenext#1{{\@for
	\@tempa :=#1\do{\expandafter\global\expandafter
		\let\csname B@\@tempa\endcsname\@empty}}}




  %% This is to allow for an introduction to the bibliography

\let\bibc@mment\@empty
\long\def\bibliographycomment#1{%
	\def\bibc@mment{\let\bibc@mment\@empty #1\par\bigskip}%
}



  %% Copied from report.sty, changed to avoid unwanted left margin and
  %% add bibliography comment.

\def\thebibliography#1{\chapter*{\bibname\@mkboth
  {\uppercase{\bibname}}{\uppercase{\bibname}}}\bibc@mment
  \small
  \def\newblock{\hskip .11em plus.33em minus.07em}%
  \sloppy\clubpenalty4000\widowpenalty4000
  \sfcode`\.=\@m
  \parindent\z@\relax
  \parskip\medskipamount
}

\def\endthebibliography{\par\medskip}