1 %%% ====================================================================
2 %%% @BibTeX-style-file{
3 %%% filename = "lematema.bst",
5 %%% date = "2007/11/19",
6 %%% abstract = "BibTeX bibliography style `lematema' for BibTeX
7 %%% versions 0.99a or later and LaTeX version 2e.
8 %%% Produces numeric-label bibliography items in
9 %%% a form typical for the Le Matematiche.
10 %%% Based on amsplain.bst"
12 %%% ====================================================================
14 % This defines the types of fields that can occur in a database entry
15 % for this particular bibliography style. Except for `language',
16 % this is the standard list from plain.bst.
18 %% Types of entries currently allowed in a BibTeX file:
20 %% ARTICLE -- An article from a journal or magazine.
22 %% BOOK -- A book with an explicit publisher.
24 %% BOOKLET -- A work that is printed and bound,
25 %% but without a named publisher or sponsoring institution.
27 %% CONFERENCE -- The same as INPROCEEDINGS,
28 %% included for Scribe compatibility.
30 %% INBOOK -- A part of a book,
31 %% which may be a chapter (or section or whatever) and/or a range of pages.
33 %% INCOLLECTION -- A part of a book having its own title.
35 %% INPROCEEDINGS -- An article in a conference proceedings.
37 %% MANUAL -- Technical documentation.
39 %% MASTERSTHESIS -- A Master's thesis.
41 %% MISC -- Use this type when nothing else fits.
43 %% PHDTHESIS -- A PhD thesis.
45 %% PROCEEDINGS -- The proceedings of a conference.
47 %% TECHREPORT -- A report published by a school or other institution,
48 %% usually numbered within a series.
50 %% UNPUBLISHED -- A document having an author and title, but not formally
82 % Removed after.sentence, after.block---not needed.
84 INTEGERS { output.state before.all mid.sentence }
86 FUNCTION {init.state.consts}
98 { duplicate$ ":::: `" swap$ * "'" * top$
102 {"STACK====================================================================="
105 "ENDSTACK=================================================================="
127 FUNCTION {field.or.null}
137 { "\emph{" swap$ * "}" * }
141 % n.dashify is used to make sure page ranges get the TeX code
142 % (two hyphens) for en-dashes.
148 { t #1 #1 substring$ "-" =
149 { t #1 #2 substring$ "--" = not
151 t #2 global.max$ substring$ 't :=
153 { { t #1 #1 substring$ "-" = }
155 t #2 global.max$ substring$ 't :=
161 { t #1 #1 substring$ *
162 t #2 global.max$ substring$ 't :=
169 % tie.or.space.connect connects two items with a ~ if the
170 % second item is less than 3 letters long, otherwise it just puts an
173 FUNCTION {tie.or.space.connect}
174 { duplicate$ text.length$ #3 <
181 FUNCTION {add.space.if.necessary}
188 % either.or.check gives a warning if two mutually exclusive fields
189 % were used in the database.
191 FUNCTION {either.or.check}
194 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
198 % output.nonnull is called by output.
200 FUNCTION {output.nonnull}
201 % remove the top item from the stack because it's in the way.
203 output.state mid.sentence =
204 % If we're in mid-sentence, add a comma to the new top item and write it
206 % Otherwise, if we're at the beginning of a bibitem,
207 { output.state before.all =
208 % just write out the top item from the stack;
210 % and the last alternative is that we're at the end of the current
211 % bibitem, so we add a period to the top stack item and write it out.
212 { add.period$ " " * write$ }
214 mid.sentence 'output.state :=
217 % Put the top item back on the stack that we removed earlier.
221 % Output checks to see if the stack top is empty; if not, it
222 % calls output.nonnull to write it out.
231 % Standard warning message for a missing or empty field. For the user
232 % we call any such field `missing' without respect to the distinction
233 % made by BibTeX between missing and empty.
235 FUNCTION {missing.warning}
236 { "missing " swap$ * " in " * cite$ * warning$ }
238 % Output.check is like output except that it gives a warning on-screen
239 % if the given field in the database entry is empty. t is the field
242 FUNCTION {output.check}
245 { pop$ t missing.warning }
250 FUNCTION {output.bibitem}
256 % This empty string is the first thing that will be written
257 % the next time write$ is called. Done this way because each
258 % item is saved on the stack until we find out what punctuation
259 % should be added after it. Therefore we need an empty first item.
261 before.all 'output.state :=
264 FUNCTION {output.nonempty.mrnumber}
265 { duplicate$ missing$
271 { " \MR{" swap$ * "}" * write$ }
278 mrnumber output.nonempty.mrnumber
282 % Removed new.block, new.block.checka, new.block.checkb, new.sentence,
283 % new.sentence.checka, and new.sentence.checkb functions here, since they
284 % don't seem to be needed in the AMS style. Also moved some real
285 % basic functions like `and' and 'or' earlier in the file.
287 INTEGERS { nameptr namesleft numnames }
289 % The extra section to write out a language field was added
290 % for AMSPLAIN.BST. Not present in plain.bst.
292 FUNCTION {format.language}
295 { " (" language * ")" * }
299 % This version of format.names puts names in the format
301 % First von Last, Jr.
303 % (i.e., first name first, no abbreviating to initials).
305 FUNCTION {format.names}
308 s num.names$ 'numnames :=
309 numnames 'namesleft :=
311 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
320 nameptr #1 + 'nameptr :=
321 namesleft #1 - 'namesleft :=
326 FUNCTION {format.authors}
331 { author format.names }
337 FUNCTION {format.editors}
340 { editor format.names
341 editor num.names$ #1 >
349 FUNCTION {format.nonauthor.editors}
352 { editor format.names
353 editor num.names$ #1 >
361 FUNCTION {format.title}
364 { title "t" change.case$ emphasize }
368 FUNCTION {format.journal.vol.year}
370 { "journal name" missing.warning ""}
375 { " \textbf{" * volume * "}" * }
378 { "year" missing.warning }
379 { " (" * year * ")" * }
383 % For formatting the issue number for a journal article.
385 FUNCTION {format.number}
392 % For formatting miscellaneous dates
394 FUNCTION {format.date}
398 { "there's a month but no year in " cite$ * warning$
405 { month " " * year * }
411 %% The volume, series and number information is sort of tricky.
412 %% This code handles it as follows:
413 %% If the series is present, and the volume, but not the number,
414 %% then we do "\emph{Book title}, Series Name, vol. 000"
415 %% If the series is present, and the number, but not the volume,
416 %% then we do "\emph{Book title}, Series Name, no. 000"
417 %% If the series is present, and both number and volume,
418 %% then we do "\emph{Book title}, vol. XX, Series Name, no. 000"
419 %% Finally, if the series is absent,
420 %% then we do "\emph{Book title}, vol. XX"
421 %% or "\emph{Book title}, no. 000"
422 %% and if both volume and number are present, give a warning message.
424 FUNCTION {format.bookvolume.series.number}
426 { "" % Push the empty string as a placeholder in case everything else
430 { pop$ series } % if series is not empty put in stack
434 { duplicate$ empty$ % if no preceding material,
435 'skip$ % do nothing, otherwise
436 { ", " * } % add a comma and space to separate.
438 "no." number tie.or.space.connect * % add the number information
442 %% If the volume is NOT EMPTY:
443 { "vol." volume tie.or.space.connect % vol. XX
447 { series ", " * swap$ *} % Series Name, vol. XX
451 { "can't use both volume and number if series info is missing"
453 "in BibTeX entry type `" type$ * "'" * top$
455 { ", " * series * ", no." * number tie.or.space.connect }
462 } % end of format.bookvolume.series.number
464 %% format.inproc.title.where.editors is used by inproceedings entry types
466 %% No case changing or emphasizing for the title. We want initial
468 %% We add parentheses around the address (place where conference
470 %% Likewise we add parentheses around the editors' names.
472 FUNCTION {format.inproc.title.address.editors}
478 { add.space.if.necessary "(" * address * ")" * }
482 { add.space.if.necessary "(" * format.nonauthor.editors * ")" * }
488 %% format.incoll.title.editors is similar to format.inproc... but
489 %% omits the address. For collections that are not proceedings volumes.
491 FUNCTION {format.incoll.title.editors}
497 add.space.if.necessary "(" * format.nonauthor.editors * ")" *
504 FUNCTION {format.edition}
507 { output.state mid.sentence =
508 { edition "l" change.case$ " ed." * }
509 { edition "t" change.case$ " ed." * }
515 INTEGERS { multiresult }
517 FUNCTION {multi.page.check}
526 swap$ duplicate$ "," =
529 { #1 'multiresult := }
530 { t #2 global.max$ substring$ 't := }
537 FUNCTION {format.pages}
544 FUNCTION {format.book.pages}
547 { pages multi.page.check
548 { "pp.~" pages n.dashify * }
555 FUNCTION {format.chapter.pages}
560 { type "l" change.case$ " " * }
565 { ", " * format.book.pages * }
571 FUNCTION {empty.misc.check}
572 { author empty$ title empty$ howpublished empty$
573 month empty$ year empty$ note empty$
576 { "all relevant fields are empty in " cite$ * warning$ }
581 FUNCTION {format.thesis.type}
585 type "t" change.case$
590 FUNCTION {format.tr.number}
597 { number tie.or.space.connect }
601 % The format.crossref functions haven't been paid much attention
602 % at the present time (June 1990) and could probably use some
605 FUNCTION {format.article.crossref}
608 { "need key or journal for " cite$ * " to crossref " * crossref *
617 " \cite{" * crossref * "}" *
620 FUNCTION {format.crossref.editor}
621 { editor #1 "{vv~}{ll}" format.name$
622 editor num.names$ duplicate$
627 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
629 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
637 FUNCTION {format.book.crossref}
639 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
642 { "vol." volume tie.or.space.connect
647 editor field.or.null author field.or.null =
651 { "need editor, key, or series for " cite$ * " to crossref " *
661 { format.crossref.editor * }
663 " \cite{" * crossref * "}" *
666 FUNCTION {format.incoll.inproc.crossref}
668 editor field.or.null author field.or.null =
672 { "need editor, key, or booktitle for " cite$ * " to crossref " *
676 { "in \emph{" booktitle * "}" * }
682 { "in " format.crossref.editor * }
684 " \cite{" * crossref * "}" *
687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689 % The main functions for each entry type.
691 % journal, vol and year are formatted together because they are
692 % not separated by commas.
696 format.authors "author" output.check
697 format.title "title" output.check
699 { format.journal.vol.year output
701 format.pages "pages" output.check
703 { format.article.crossref output.nonnull
704 format.pages "pages" output.check
715 { format.editors "author and editor" output.check }
716 { format.authors output.nonnull
718 { "author and editor" editor either.or.check }
723 format.title "title" output.check
724 format.edition output
726 { format.bookvolume.series.number output
727 publisher "publisher" output.check
730 { format.book.crossref output.nonnull
733 format.date "year" output.check
741 format.authors output
742 format.title "title" output.check
753 { format.editors "author and editor" output.check }
754 { format.authors output.nonnull
756 { "author and editor" editor either.or.check }
761 format.title "title" output.check
762 format.edition output
764 { format.bookvolume.series.number output
765 format.chapter.pages "chapter and pages" output.check
766 publisher "publisher" output.check
769 { format.chapter.pages "chapter and pages" output.check
770 format.book.crossref output.nonnull
773 format.date "year" output.check
779 FUNCTION {incollection}
781 format.authors "author" output.check
782 format.title "title" output.check
784 { format.incoll.title.editors "booktitle" output.check
785 format.bookvolume.series.number output
786 publisher "publisher" output.check
788 format.edition output
789 format.date "year" output.check
791 { format.incoll.inproc.crossref output.nonnull
795 format.book.pages output
800 FUNCTION {inproceedings}
802 format.authors "author" output.check
803 format.title "title" output.check
805 { format.inproc.title.address.editors "booktitle" output.check
806 format.bookvolume.series.number output
809 format.date "year" output.check
811 { format.incoll.inproc.crossref output.nonnull
815 format.book.pages output
820 FUNCTION {conference} { inproceedings }
825 { organization empty$
827 { organization output.nonnull
832 { format.authors output.nonnull }
834 format.title "title" output.check
836 { organization empty$
841 { organization output
845 format.edition output
851 FUNCTION {mastersthesis}
853 format.authors "author" output.check
854 format.title "title" output.check
855 "Master's thesis" format.thesis.type output.nonnull
856 school "school" output.check
858 format.date "year" output.check
860 format.book.pages output
866 format.authors output
871 format.book.pages output
878 format.authors "author" output.check
879 format.title "title" output.check
880 "Ph.D. thesis" format.thesis.type output.nonnull
881 school "school" output.check
883 format.date "year" output.check
885 format.book.pages output
889 FUNCTION {proceedings}
892 { organization output }
893 { format.editors output.nonnull }
895 format.title "title" output.check
896 format.bookvolume.series.number output
900 { organization output }
903 format.date "year" output.check
905 { address output.nonnull
908 { organization output }
911 format.date "year" output.check
918 FUNCTION {techreport}
920 format.authors "author" output.check
921 format.title "title" output.check
922 format.tr.number output.nonnull
923 institution "institution" output.check
925 format.date "year" output.check
930 FUNCTION {unpublished}
932 format.authors "author" output.check
933 format.title "title" output.check
934 note "note" output.check
939 FUNCTION {default.type} { misc }
941 MACRO {jan} {"January"}
943 MACRO {feb} {"February"}
945 MACRO {mar} {"March"}
947 MACRO {apr} {"April"}
955 MACRO {aug} {"August"}
957 MACRO {sep} {"September"}
959 MACRO {oct} {"October"}
961 MACRO {nov} {"November"}
963 MACRO {dec} {"December"}
977 s #1 len substring$ =
978 { s len #1 + global.max$ substring$ }
983 FUNCTION {sort.format.names}
987 s num.names$ 'numnames :=
988 numnames 'namesleft :=
994 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
995 nameptr numnames = t "others" = and
999 nameptr #1 + 'nameptr :=
1000 namesleft #1 - 'namesleft :=
1005 FUNCTION {sort.format.title}
1009 "The " #4 t chop.word
1013 #1 global.max$ substring$
1016 FUNCTION {author.sort}
1019 { "to sort, need author or key in " cite$ * warning$
1025 { author sort.format.names }
1029 FUNCTION {author.editor.sort}
1033 { "to sort, need author, editor, or key in " cite$ * warning$
1039 { editor sort.format.names }
1042 { author sort.format.names }
1046 FUNCTION {author.organization.sort}
1048 { organization empty$
1050 { "to sort, need author, organization, or key in " cite$ * warning$
1056 { "The " #4 organization chop.word sortify }
1059 { author sort.format.names }
1063 FUNCTION {editor.organization.sort}
1065 { organization empty$
1067 { "to sort, need editor, organization, or key in " cite$ * warning$
1073 { "The " #4 organization chop.word sortify }
1076 { editor sort.format.names }
1085 { type$ "proceedings" =
1086 'editor.organization.sort
1088 'author.organization.sort
1097 year field.or.null sortify
1104 #1 entry.max$ substring$
1112 STRINGS { longest.label prev.author this.author }
1114 INTEGERS { number.label longest.label.width }
1116 FUNCTION {initialize.longest.label}
1117 { "" 'longest.label :=
1119 #0 'longest.label.width :=
1120 "abcxyz" 'prev.author :=
1124 FUNCTION {longest.label.pass}
1125 { number.label int.to.str$ 'label :=
1126 number.label #1 + 'number.label :=
1127 label width$ longest.label.width >
1128 { label 'longest.label :=
1129 label width$ 'longest.label.width :=
1144 EXECUTE {initialize.longest.label}
1146 ITERATE {longest.label.pass}
1148 FUNCTION {write.lines}
1149 { { duplicate$ "." = NOT }
1155 FUNCTION {begin.bib}
1158 { preamble$ write$ newline$ }
1160 "\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
1162 "\providecommand{\MR}{\relax\ifhmode\unskip\space\fi MR }"
1164 "% \MRhref is called by the amsart/book/proc definition of \MR."
1166 "\providecommand{\MRhref}[2]{%"
1168 " \href{http://www.ams.org/mathscinet-getitem?mr=#1}{#2}"
1172 "\providecommand{\href}[2]{#2}"
1174 "\begin{thebibliography}{" longest.label * "}" *
1180 EXECUTE {init.state.consts}
1182 ITERATE {call.type$}
1186 "\end{thebibliography}" write$ newline$
1191 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
1192 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
1193 %% Digits \0\1\2\3\4\5\6\7\8\9
1194 %% Exclamation \! Double quote \" Hash (number) \#
1195 %% Dollar \$ Percent \% Ampersand \&
1196 %% Acute accent \' Left paren \( Right paren \)
1197 %% Asterisk \* Plus \+ Comma \,
1198 %% Minus \- Point \. Solidus \/
1199 %% Colon \: Semicolon \; Less than \<
1200 %% Equals \= Greater than \> Question mark \?
1201 %% Commercial at \@ Left bracket \[ Backslash \\
1202 %% Right bracket \] Circumflex \^ Underscore \_
1203 %% Grave accent \` Left brace \{ Vertical bar \|
1204 %% Right brace \} Tilde \~}