1 %%% ====================================================================
2 %%% @BibTeX-style-file{
3 %%% filename = "lematema.bst",
5 %%% date = "2007/11/21",
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
81 % Removed after.sentence, after.block---not needed.
83 INTEGERS { output.state before.all mid.sentence }
85 FUNCTION {init.state.consts}
97 { duplicate$ ":::: `" swap$ * "'" * top$
101 {"STACK====================================================================="
104 "ENDSTACK=================================================================="
126 FUNCTION {field.or.null}
136 { "\emph{" swap$ * "}" * }
140 % n.dashify is used to make sure page ranges get the TeX code
141 % (two hyphens) for en-dashes.
147 { t #1 #1 substring$ "-" =
148 { t #1 #2 substring$ "--" = not
150 t #2 global.max$ substring$ 't :=
152 { { t #1 #1 substring$ "-" = }
154 t #2 global.max$ substring$ 't :=
160 { t #1 #1 substring$ *
161 t #2 global.max$ substring$ 't :=
168 % tie.or.space.connect connects two items with a ~ if the
169 % second item is less than 3 letters long, otherwise it just puts an
172 FUNCTION {tie.or.space.connect}
173 { duplicate$ text.length$ #3 <
180 FUNCTION {add.space.if.necessary}
187 % either.or.check gives a warning if two mutually exclusive fields
188 % were used in the database.
190 FUNCTION {either.or.check}
193 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
197 % output.nonnull is called by output.
199 FUNCTION {output.nonnull}
200 % remove the top item from the stack because it's in the way.
202 output.state mid.sentence =
203 % If we're in mid-sentence, add a comma to the new top item and write it
205 % Otherwise, if we're at the beginning of a bibitem,
206 { output.state before.all =
207 % just write out the top item from the stack;
209 % and the last alternative is that we're at the end of the current
210 % bibitem, so we add a period to the top stack item and write it out.
211 { add.period$ " " * write$ }
213 mid.sentence 'output.state :=
216 % Put the top item back on the stack that we removed earlier.
220 % Output checks to see if the stack top is empty; if not, it
221 % calls output.nonnull to write it out.
230 % Standard warning message for a missing or empty field. For the user
231 % we call any such field `missing' without respect to the distinction
232 % made by BibTeX between missing and empty.
234 FUNCTION {missing.warning}
235 { "missing " swap$ * " in " * cite$ * warning$ }
237 % Output.check is like output except that it gives a warning on-screen
238 % if the given field in the database entry is empty. t is the field
241 FUNCTION {output.check}
244 { pop$ t missing.warning }
249 FUNCTION {output.bibitem}
255 % This empty string is the first thing that will be written
256 % the next time write$ is called. Done this way because each
257 % item is saved on the stack until we find out what punctuation
258 % should be added after it. Therefore we need an empty first item.
260 before.all 'output.state :=
269 % Removed new.block, new.block.checka, new.block.checkb, new.sentence,
270 % new.sentence.checka, and new.sentence.checkb functions here, since they
271 % don't seem to be needed in the AMS style. Also moved some real
272 % basic functions like `and' and 'or' earlier in the file.
274 INTEGERS { nameptr namesleft numnames }
276 % The extra section to write out a language field was added
277 % for AMSPLAIN.BST. Not present in plain.bst.
279 FUNCTION {format.language}
282 { " (" language * ")" * }
286 % This version of format.names puts names in the format
288 % First von Last, Jr.
290 % (i.e., first name first, no abbreviating to initials).
292 FUNCTION {format.names}
295 s num.names$ 'numnames :=
296 numnames 'namesleft :=
298 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
307 nameptr #1 + 'nameptr :=
308 namesleft #1 - 'namesleft :=
313 FUNCTION {format.authors}
318 { author format.names }
324 FUNCTION {format.editors}
327 { editor format.names
328 editor num.names$ #1 >
336 FUNCTION {format.nonauthor.editors}
339 { editor format.names
340 editor num.names$ #1 >
348 FUNCTION {format.title}
355 FUNCTION {format.journal.vol.year}
357 { "journal name" missing.warning ""}
362 { " \textbf{" * volume * "}" * }
365 { "year" missing.warning }
366 { " (" * year * ")" * }
370 % For formatting the issue number for a journal article.
372 FUNCTION {format.number}
379 % For formatting miscellaneous dates
381 FUNCTION {format.date}
385 { "there's a month but no year in " cite$ * warning$
392 { month " " * year * }
398 %% The volume, series and number information is sort of tricky.
399 %% This code handles it as follows:
400 %% If the series is present, and the volume, but not the number,
401 %% then we do "\emph{Book title}, Series Name, vol. 000"
402 %% If the series is present, and the number, but not the volume,
403 %% then we do "\emph{Book title}, Series Name, no. 000"
404 %% If the series is present, and both number and volume,
405 %% then we do "\emph{Book title}, vol. XX, Series Name, no. 000"
406 %% Finally, if the series is absent,
407 %% then we do "\emph{Book title}, vol. XX"
408 %% or "\emph{Book title}, no. 000"
409 %% and if both volume and number are present, give a warning message.
411 FUNCTION {format.bookvolume.series.number}
413 { "" % Push the empty string as a placeholder in case everything else
417 { pop$ series } % if series is not empty put in stack
421 { duplicate$ empty$ % if no preceding material,
422 'skip$ % do nothing, otherwise
423 { ", " * } % add a comma and space to separate.
425 "no." number tie.or.space.connect * % add the number information
429 %% If the volume is NOT EMPTY:
430 { "vol." volume tie.or.space.connect % vol. XX
434 { series ", " * swap$ *} % Series Name, vol. XX
438 { "can't use both volume and number if series info is missing"
440 "in BibTeX entry type `" type$ * "'" * top$
442 { ", " * series * ", no." * number tie.or.space.connect }
449 } % end of format.bookvolume.series.number
451 %% format.inproc.title.where.editors is used by inproceedings entry types
453 %% No case changing or emphasizing for the title. We want initial
455 %% We add parentheses around the address (place where conference
457 %% Likewise we add parentheses around the editors' names.
459 FUNCTION {format.inproc.title.address.editors}
465 { add.space.if.necessary "(" * address * ")" * }
469 { add.space.if.necessary "(" * format.nonauthor.editors * ")" * }
475 %% format.incoll.title.editors is similar to format.inproc... but
476 %% omits the address. For collections that are not proceedings volumes.
478 FUNCTION {format.incoll.title.editors}
484 add.space.if.necessary "(" * format.nonauthor.editors * ")" *
491 FUNCTION {format.edition}
494 { output.state mid.sentence =
495 { edition "l" change.case$ " ed." * }
496 { edition "t" change.case$ " ed." * }
502 INTEGERS { multiresult }
504 FUNCTION {multi.page.check}
513 swap$ duplicate$ "," =
516 { #1 'multiresult := }
517 { t #2 global.max$ substring$ 't := }
524 FUNCTION {format.pages}
531 FUNCTION {format.book.pages}
534 { pages multi.page.check
535 { "pp.~" pages n.dashify * }
542 FUNCTION {format.chapter.pages}
547 { type "l" change.case$ " " * }
552 { ", " * format.book.pages * }
558 FUNCTION {empty.misc.check}
559 { author empty$ title empty$ howpublished empty$
560 month empty$ year empty$ note empty$
563 { "all relevant fields are empty in " cite$ * warning$ }
568 FUNCTION {format.thesis.type}
572 type "t" change.case$
577 FUNCTION {format.tr.number}
584 { number tie.or.space.connect }
588 % The format.crossref functions haven't been paid much attention
589 % at the present time (June 1990) and could probably use some
592 FUNCTION {format.article.crossref}
595 { "need key or journal for " cite$ * " to crossref " * crossref *
604 " \cite{" * crossref * "}" *
607 FUNCTION {format.crossref.editor}
608 { editor #1 "{vv~}{ll}" format.name$
609 editor num.names$ duplicate$
614 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
616 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
624 FUNCTION {format.book.crossref}
626 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
629 { "vol." volume tie.or.space.connect
634 editor field.or.null author field.or.null =
638 { "need editor, key, or series for " cite$ * " to crossref " *
648 { format.crossref.editor * }
650 " \cite{" * crossref * "}" *
653 FUNCTION {format.incoll.inproc.crossref}
655 editor field.or.null author field.or.null =
659 { "need editor, key, or booktitle for " cite$ * " to crossref " *
663 { "in \emph{" booktitle * "}" * }
669 { "in " format.crossref.editor * }
671 " \cite{" * crossref * "}" *
674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
676 % The main functions for each entry type.
678 % journal, vol and year are formatted together because they are
679 % not separated by commas.
683 format.authors "author" output.check
684 format.title "title" output.check
686 { format.journal.vol.year output
688 format.pages "pages" output.check
690 { format.article.crossref output.nonnull
691 format.pages "pages" output.check
702 { format.editors "author and editor" output.check }
703 { format.authors output.nonnull
705 { "author and editor" editor either.or.check }
710 format.title "title" output.check
711 format.edition output
713 { format.bookvolume.series.number output
714 publisher "publisher" output.check
717 { format.book.crossref output.nonnull
720 format.date "year" output.check
728 format.authors output
729 format.title "title" output.check
740 { format.editors "author and editor" output.check }
741 { format.authors output.nonnull
743 { "author and editor" editor either.or.check }
748 format.title "title" output.check
749 format.edition output
751 { format.bookvolume.series.number output
752 format.chapter.pages "chapter and pages" output.check
753 publisher "publisher" output.check
756 { format.chapter.pages "chapter and pages" output.check
757 format.book.crossref output.nonnull
760 format.date "year" output.check
766 FUNCTION {incollection}
768 format.authors "author" output.check
769 format.title "title" output.check
771 { format.incoll.title.editors "booktitle" output.check
772 format.bookvolume.series.number output
773 publisher "publisher" output.check
775 format.edition output
776 format.date "year" output.check
778 { format.incoll.inproc.crossref output.nonnull
782 format.book.pages output
787 FUNCTION {inproceedings}
789 format.authors "author" output.check
790 format.title "title" output.check
792 { format.inproc.title.address.editors "booktitle" output.check
793 format.bookvolume.series.number output
796 format.date "year" output.check
798 { format.incoll.inproc.crossref output.nonnull
802 format.book.pages output
807 FUNCTION {conference} { inproceedings }
812 { organization empty$
814 { organization output.nonnull
819 { format.authors output.nonnull }
821 format.title "title" output.check
823 { organization empty$
828 { organization output
832 format.edition output
838 FUNCTION {mastersthesis}
840 format.authors "author" output.check
841 format.title "title" output.check
842 "Master's thesis" format.thesis.type output.nonnull
843 school "school" output.check
845 format.date "year" output.check
847 format.book.pages output
853 format.authors output
858 format.book.pages output
865 format.authors "author" output.check
866 format.title "title" output.check
867 "Ph.D. thesis" format.thesis.type output.nonnull
868 school "school" output.check
870 format.date "year" output.check
872 format.book.pages output
876 FUNCTION {proceedings}
879 { organization output }
880 { format.editors output.nonnull }
882 format.title "title" output.check
883 format.bookvolume.series.number output
887 { organization output }
890 format.date "year" output.check
892 { address output.nonnull
895 { organization output }
898 format.date "year" output.check
905 FUNCTION {techreport}
907 format.authors "author" output.check
908 format.title "title" output.check
909 format.tr.number output.nonnull
910 institution "institution" output.check
912 format.date "year" output.check
917 FUNCTION {unpublished}
919 format.authors "author" output.check
920 format.title "title" output.check
921 note "note" output.check
926 FUNCTION {default.type} { misc }
928 MACRO {jan} {"January"}
930 MACRO {feb} {"February"}
932 MACRO {mar} {"March"}
934 MACRO {apr} {"April"}
942 MACRO {aug} {"August"}
944 MACRO {sep} {"September"}
946 MACRO {oct} {"October"}
948 MACRO {nov} {"November"}
950 MACRO {dec} {"December"}
964 s #1 len substring$ =
965 { s len #1 + global.max$ substring$ }
970 FUNCTION {sort.format.names}
974 s num.names$ 'numnames :=
975 numnames 'namesleft :=
981 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
982 nameptr numnames = t "others" = and
986 nameptr #1 + 'nameptr :=
987 namesleft #1 - 'namesleft :=
992 FUNCTION {sort.format.title}
996 "The " #4 t chop.word
1000 #1 global.max$ substring$
1003 FUNCTION {author.sort}
1006 { "to sort, need author or key in " cite$ * warning$
1012 { author sort.format.names }
1016 FUNCTION {author.editor.sort}
1020 { "to sort, need author, editor, or key in " cite$ * warning$
1026 { editor sort.format.names }
1029 { author sort.format.names }
1033 FUNCTION {author.organization.sort}
1035 { organization empty$
1037 { "to sort, need author, organization, or key in " cite$ * warning$
1043 { "The " #4 organization chop.word sortify }
1046 { author sort.format.names }
1050 FUNCTION {editor.organization.sort}
1052 { organization empty$
1054 { "to sort, need editor, organization, or key in " cite$ * warning$
1060 { "The " #4 organization chop.word sortify }
1063 { editor sort.format.names }
1072 { type$ "proceedings" =
1073 'editor.organization.sort
1075 'author.organization.sort
1084 year field.or.null sortify
1091 #1 entry.max$ substring$
1099 STRINGS { longest.label prev.author this.author }
1101 INTEGERS { number.label longest.label.width }
1103 FUNCTION {initialize.longest.label}
1104 { "" 'longest.label :=
1106 #0 'longest.label.width :=
1107 "abcxyz" 'prev.author :=
1111 FUNCTION {longest.label.pass}
1112 { number.label int.to.str$ 'label :=
1113 number.label #1 + 'number.label :=
1114 label width$ longest.label.width >
1115 { label 'longest.label :=
1116 label width$ 'longest.label.width :=
1131 EXECUTE {initialize.longest.label}
1133 ITERATE {longest.label.pass}
1135 FUNCTION {write.lines}
1136 { { duplicate$ "." = NOT }
1142 FUNCTION {begin.bib}
1145 { preamble$ write$ newline$ }
1147 "\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
1149 "\providecommand{\MR}{\relax\ifhmode\unskip\space\fi MR }"
1151 "% \MRhref is called by the amsart/book/proc definition of \MR."
1153 "\providecommand{\MRhref}[2]{%"
1155 " \href{http://www.ams.org/mathscinet-getitem?mr=#1}{#2}"
1159 "\providecommand{\href}[2]{#2}"
1161 "\begin{thebibliography}{" longest.label * "}" *
1167 EXECUTE {init.state.consts}
1169 ITERATE {call.type$}
1173 "\end{thebibliography}" write$ newline$
1178 %% {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
1179 %% 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
1180 %% Digits \0\1\2\3\4\5\6\7\8\9
1181 %% Exclamation \! Double quote \" Hash (number) \#
1182 %% Dollar \$ Percent \% Ampersand \&
1183 %% Acute accent \' Left paren \( Right paren \)
1184 %% Asterisk \* Plus \+ Comma \,
1185 %% Minus \- Point \. Solidus \/
1186 %% Colon \: Semicolon \; Less than \<
1187 %% Equals \= Greater than \> Question mark \?
1188 %% Commercial at \@ Left bracket \[ Backslash \\
1189 %% Right bracket \] Circumflex \^ Underscore \_
1190 %% Grave accent \` Left brace \{ Vertical bar \|
1191 %% Right brace \} Tilde \~}