summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/easy/easybib.sty
blob: b7288027b683e3752d53e12d175d874a3ab29bc3 (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
166
167
168
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Enrico Bertolazzi",
%%%     version         = "0.7",
%%%     date            = "16-MAR-99",
%%%     filename        = "easybib.sty",
%%%     address         = "Laboratorio di Matematica Applicata
%%%                        e Meccanica Strutturale,
%%%                        Trento University,
%%%                        Via Mesiano, Trento, Italy",
%%%     FAX             = "+39 (461) 882599",
%%%     email           = "enrico.bertolazzi@ing.unitn.it (Internet)",
%%%     supported       = "yes. Please send comments via E-mail",
%%%     docstring       = "package for easy customization of bibliography."
%%%
%%% INSTALLATION:
%%%   Put this file where your TeX looks for inputs.
%%%
%%% DOCUMENTATION:
%%%   Compile docbib.tex.
%%%
%%%   Copyright  1999 Enrico Bertolazzi
%%%
%%%   This program can be redistributed and/or modified under the terms
%%%   of the LaTeX Project Public License Distributed from CTAN
%%%   archives in directory macros/latex/base/lppl.txt; either
%%%   version 1 of the License, or any later version.
%%%
%%%  }
%%% ====================================================================%%%
%%%       ___    ____  ___   _   _      __    __    ____ ______         %%%
%%%      /   \  /     /   \  \  /      /  \  /  \  /       /            %%%
%%%     /____/ /__   /____/   \/       \    /   / /__     /             %%%
%%%    /   \  /     /  \      /         \  /   / /       /              %%%
%%%   /____/ /____ /    \    /       \__/  \__/ /       /               %%%
%%% ====================================================================%%%
\def\filedate{1999/03/16}
\def\fileversion{v0.7}
\typeout{Document Style `easybib'  \fileversion\space<\filedate>.}
%% BEGIN easybib.sty
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{easy}
\ProvidesPackage{easybib}[\filedate\space\fileversion]

\@ifundefined{refname}{\gdef\refname{References}}{}
\@ifundefined{bibname}{\gdef\refname{Bibliography}}{}

\newif\if@bib@first@item

\def\@bib@init@cmds{\global\@bib@first@itemtrue\global\let\@bib@old@fmtclo\@empty%
\expandafter\@for\expandafter\@name\expandafter:\expandafter=\csname \@bib@act@fmt list\endcsname
\do{\expandafter\let\csname\@name\expandafter\endcsname%
\csname @bib@\@bib@act@fmt @\@name @cmd\endcsname%
\expandafter\global\expandafter\setbox\csname @bib@\@name @box\endcsname=\box\voidb@x}}

\def\@bib@begin{\begingroup\gdef\@bib@first@punct{}\@bib@init@cmds\bgroup\ignorespaces}

\def\@bib@out{\@bib@old@fmtclo\egroup\@killglue%
\expandafter\@for\expandafter\@name\expandafter:\expandafter=\csname \@bib@act@fmt list\endcsname
\do{\@bib@out@if@exist[\@bib@act@fmt,\@name]}}

\def\@bib@end#1{\@bib@out#1\endgroup}

\def\moreref{\@ifnextchar[\@bib@moreref{\@bib@moreref[;]}}%
\def\@bib@moreref[#1]#2{\@bib@out\gdef\@bib@act@fmt{#2}%
\gdef\@bib@first@punct{\@killglue#1\space}%
\@bib@init@cmds\bgroup\ignorespaces}

\def\endref{\@ifnextchar[\@endref{\@endref[;]}}
\def\@endref[#1]{\@bib@end{#1}}

\def\@bib@out@if@exist[#1,#2]{%
\ifdim\wd\@nameuse{@bib@#2@box}>0pt%
\@killglue\unhbox\@nameuse{@bib@#2@box}\@killglue\fi}

\def\bibsetfmt[#1,#2]#3#4#5{%
\@easy@gdef(@bib@#1@#2@punct){\@killglue#3\space}
\@easy@gdef(@bib@#1@#2@fmt){#4}
\@easy@gdef(@bib@#1@#2@fmtclo){\@killglue#5}}

\def\bibdefinestyle#1#2{\bibsetfmt[#1,#2]{,}{\rmfamily}{}%
\@ifundefined{@bib@#2@box}{\expandafter\global\expandafter\newbox\csname @bib@#2@box\endcsname}{}
\expandafter\xdef\csname @bib@#1@#2@cmd\endcsname{\noexpand\@bib@old@fmtclo\egroup
\noexpand\global\noexpand\setbox\csname @bib@#2@box\endcsname\hbox\bgroup
\noexpand\global\noexpand\let\noexpand\@bib@old@fmtclo%
\expandafter\noexpand\csname @bib@#1@#2@fmtclo\expandafter\noexpand\endcsname%
\noexpand\if@bib@first@item\noexpand\@bib@first@punct\noexpand\else%
\expandafter\noexpand\csname @bib@#1@#2@punct\expandafter\noexpand\endcsname\noexpand\fi
\noexpand\global\noexpand\@bib@first@itemfalse%
\expandafter\noexpand\csname @bib@#1@#2@fmt\expandafter\noexpand\endcsname}}

\def\@BIB@lbibitem[#1]#2{\@lbibitem[#1]{#2}\@bib@begin}
\def\@BIB@bibitem#1{\@bibitem{#1}\@bib@begin}

\def\bibdefinestyles#1{%
\@easy@xdef(#1ref){\noexpand\gdef\noexpand\@bib@act@fmt{#1}
\noexpand\@ifnextchar[\noexpand\@BIB@lbibitem\noexpand\@BIB@bibitem}
\expandafter\@for\expandafter\@name\expandafter:\expandafter=\csname#1list\endcsname
\do{\bibdefinestyle{#1}{\@name}}}

\def\paperlist{by,bysame,title,transl,jour,toappear,inbook,publ,eds,publaddr,vol,yr,pages,finalinfo,lang}
\def\booklist{by,bysame,title,bookinfo,publ,publaddr,pages,yr,lang,transl}

\bibdefinestyles{paper}
\bibdefinestyles{book}
% 
\bibsetfmt[paper,by]{}{\bfseries}{}
\bibsetfmt[paper,bysame]{,}{\hbox to3em{\hrulefill\hskip.1em}}{}
\bibsetfmt[paper,title]{,}{\itshape}{}
\bibsetfmt[paper,toappear]{}{(to appear}{)}
\bibsetfmt[paper,yr]{}{(}{)}
\bibsetfmt[paper,lang]{}{(}{)}
\bibsetfmt[paper,vol]{}{\bfseries}{}
\bibsetfmt[paper,eds]{}{(}{\@killglue, eds.)}
\bibsetfmt[paper,transl]{}{}{}
% 
\bibsetfmt[book,by]{}{\bfseries}{}
\bibsetfmt[book,bysame]{}{\hbox to3em{\hrulefill\hskip.1em}}{}
\bibsetfmt[book,title]{,}{\scshape}{}
\bibsetfmt[book,lang]{}{(}{)}

\def\@bib@styleA#1{#1.}
\def\@bib@styleB#1{[#1]}
\def\@bib@styleC#1{}

\def\refstyle#1{\@easy@glet(@biblabel){@bib@style#1}}
\refstyle{A}

\def\@bib@citeA#1#2{[{#1\if@tempswa , #2\fi}]}
\def\@bib@citeB#1#2{\@killglue$^{\hbox{\tiny[{#1\if@tempswa , #2\fi}]}}$}
\def\@bib@citeC#1#2{\@killglue$^{\hbox{\tiny#1\if@tempswa , #2\fi}}$}

\def\citestyle#1{\@easy@glet(@cite){@bib@cite#1}}
\citestyle{A}


\DeclareOption{definethebibliography}{%
   \def\bibindent{1.5em}
   \def\thebibliography{\@ifnextchar[{\@bib@init}{\@bib@init[\refname]}}
   \def\@bib@init[#1]{\@ifnextchar({\@bib@inita[#1]}{\@bib@inita[#1](\section*,\z@)}}
   \def\@bib@inita[#1](#2,#3)#4{%
      #2{#1\@mkboth{\MakeUppercase#1}{\MakeUppercase#1}}%
      \kern#3
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#4}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
   \def\endthebibliography{%
      \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
}

      
\ProcessOptions

\endinput
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%