diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/opcit/opcit.bst | 725 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/opcit/README | 33 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/opcit/opcit.dvi | bin | 59868 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/opcit/opcit.pdf | bin | 0 -> 303867 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/opcit/opcit.dtx | 1679 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/opcit/opcit.ins | 48 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/opcit/opcit.sty | 236 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/opcit.tpm | 11 |
8 files changed, 1926 insertions, 806 deletions
diff --git a/Master/texmf-dist/bibtex/bst/opcit/opcit.bst b/Master/texmf-dist/bibtex/bst/opcit/opcit.bst index 3135c3faa1a..3d25aa82db6 100644 --- a/Master/texmf-dist/bibtex/bst/opcit/opcit.bst +++ b/Master/texmf-dist/bibtex/bst/opcit/opcit.bst @@ -7,7 +7,7 @@ %% opcit.dtx (with options: `bst') %% Part of the `opcit' project: bibliographical references as footnotes. %% -%% Copyright 2002 Federico Garcia +%% Copyright 2006 Federico Garcia %% ENTRY { address @@ -16,6 +16,7 @@ ENTRY chapter edition editor + hereafter howpublished institution journal @@ -30,73 +31,24 @@ ENTRY series title type + url + urldate volume year - hereafter } {} { label } -INTEGERS { output.state before.all mid.sentence after.sentence after.block quoted.state } +INTEGERS { output.state before.all mid.sentence after.sentence + after.block quoted.state period.state } -STRINGS { s t last.authors } +STRINGS { s t last.authors quotes } FUNCTION {init.state.consts} -{ #0 'before.all := - #1 'mid.sentence := - #2 'after.sentence := - #3 'after.block := - #0 'quoted.state := +{ #0 'period.state := + #0 'before.all := "" 'last.authors := -} -FUNCTION {output.nonnull} -{ 's := - output.state mid.sentence = - { " " * write$ } - { output.state after.block = - { "\bibpunctuation" * - quoted.state #1 = - { #2 'quoted.state := } - { quoted.state #2 = - { "''" * #0 'quoted.state := } - 'skip$ - if$ - } - if$ - write$ - newline$ - "\newblock " write$ - } - { output.state before.all = - 'write$ - { "\bibpunctuation" * write$ } - if$ - } - if$ - mid.sentence 'output.state := - } - if$ - s -} - -FUNCTION {output} -{ duplicate$ empty$ - 'pop$ - 'output.nonnull - if$ -} - -FUNCTION {output.check} -{ 't := - duplicate$ empty$ - { pop$ "empty " t * " in " * cite$ * warning$ } - 'output.nonnull - if$ -} - -FUNCTION {fin.entry} -{ "\opcitend%" * write$ - newline$ + "" 'quotes := } FUNCTION {new.block} @@ -123,22 +75,6 @@ FUNCTION {or} if$ } -FUNCTION {new.block.checka} -{ empty$ - 'skip$ - 'new.block - if$ -} - -FUNCTION {new.block.checkb} -{ empty$ - swap$ empty$ - and - 'skip$ - 'new.block - if$ -} - FUNCTION {field.or.null} { duplicate$ empty$ { pop$ "" } @@ -155,45 +91,83 @@ FUNCTION {emphasize} INTEGERS { nameptr namesleft numnames } -FUNCTION {format.names} +FUNCTION{format.names} { 's := #1 'nameptr := s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } - { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + { s nameptr "{ff }{vv~}{ll}{,~jj}" format.name$ 't := nameptr #1 > - { namesleft #1 > - { ", " * t * } - { numnames #2 > - { "," * } - 'skip$ - if$ - t "others" = - { " et~al." * } - { " and " * t * } + { namesleft #1 > + { ", " * t * } + { numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.swap.names} +{ 's := + s num.names$ 'numnames := + "\SwapNames{" s #1 "{ff}" format.name$ + duplicate$ #-1 #1 substring$ + "." = + { #1 'period.state := } + 'skip$ + if$ + * "}{" * + s #1 "{vv~}{ll}" format.name$ * "}" * + s #1 "{, jj}" format.name$ * + numnames #3 > + { " et~al." * #1 'period.state := } + { numnames #1 > + { #2 'nameptr := + numnames #1 - 'namesleft := + { namesleft #0 > } + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + namesleft #1 > + { ", " * t * } + { " and " * t * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + 'skip$ if$ } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ + if$ } FUNCTION {format.authors} -{ author empty$ +{ author empty$ { "" "" 'last.authors := } - { author last.authors = + { author format.names + last.authors = { "\sameauthors" } - { author format.names } + { before.all output.state = + { author format.swap.names } + { author format.names } + if$ } if$ - author 'last.authors := + author format.names 'last.authors := } if$ } @@ -201,21 +175,27 @@ FUNCTION {format.authors} FUNCTION {format.editors} { editor empty$ { "" } - { editor format.names } + { before.all output.state = + { editor format.swap.names } + { editor format.names } + if$ + } if$ } FUNCTION {format.editors.ed} { editor empty$ { "" } - { editor format.names " (ed.)" * } - if$ -} - -FUNCTION {format.title} -{ title empty$ - { "" } - { title } + { before.all output.state = + { editor format.swap.names } + { editor format.names } + if$ + editor num.names$ #1 > + { " (eds.)" * } + { " (ed.)" * } + if$ + #0 'period.state := + } if$ } @@ -247,24 +227,20 @@ FUNCTION {n.dashify} FUNCTION {format.date} { year empty$ { month empty$ - { "" } - { "there's a month but no year in " cite$ * warning$ - month - } + { "" } + { "there's a month but no year in " cite$ * warning$ + "\toomit[month]{" month * " }" * + } if$ } { month empty$ - 'year - { month " " * year * } + 'year + { "\toomit[month]{" month * " }" * year * } if$ } if$ } -FUNCTION {format.btitle} -{ title emphasize -} - FUNCTION {tie.or.space.connect} { duplicate$ text.length$ #3 < { "~" } @@ -273,22 +249,21 @@ FUNCTION {tie.or.space.connect} swap$ * * } -FUNCTION {either.or.check} -{ empty$ - 'pop$ - { "can't use both " swap$ * " fields in " * cite$ * warning$ } - if$ +FUNCTION{either.warning} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ } - FUNCTION {format.bvolume} { volume empty$ { "" } - { "volume" volume tie.or.space.connect + { "\bibcase volume" volume tie.or.space.connect series empty$ - 'skip$ - { " of " * series emphasize * } + 'skip$ + { " of " * series emphasize * } if$ - "volume and number" number either.or.check + "volume and number" number either.warning } if$ } @@ -296,38 +271,25 @@ FUNCTION {format.bvolume} FUNCTION {format.number.series} { volume empty$ { number empty$ - { series empty$ - { "" } - { ", series " * series * "" } - if$ } - { output.state mid.sentence = - { "number" } - { "Number" } - if$ - number tie.or.space.connect - series empty$ - { "there's a number but no series in " cite$ * warning$ } - { " in " * series * } - if$ - } + { series empty$ + { "" } + { ", series " * series * "" } + if$ + } + { "\bibcase number" + number tie.or.space.connect + series empty$ + { "there's a number but no series in " cite$ * warning$ } + { " in " * series * } + if$ + } if$ } { "" } if$ } -FUNCTION {format.edition} -{ edition empty$ - { "" } - { output.state mid.sentence = - { edition "l" change.case$ " edition" * } - { edition "t" change.case$ " edition" * } - if$ - } - if$ -} - -INTEGERS { multiresult } +INTEGERS { multiresult} FUNCTION {multi.page.check} { 't := @@ -353,8 +315,8 @@ FUNCTION {format.pages} { pages empty$ { "" } { pages multi.page.check - { "pages" pages n.dashify tie.or.space.connect } - { "page" pages tie.or.space.connect } + { "\toomit[pages]{\bibcase " swap$ * pages n.dashify tie.or.space.connect "}" * } + { "\toomit[pages]{\bibcase " swap$ * pages tie.or.space.connect "}" * } if$ } if$ @@ -364,13 +326,13 @@ FUNCTION {format.vol.num.date.pages} { volume empty$ 'skip$ { volume } - if$ - number empty$ + if$ + number empty$ 'skip$ - { "/" number * * + { "/" number * volume empty$ - { "there's a number but no volume in " cite$ * warning$ } - 'skip$ + { "there's a number but no volume in " cite$ * warning$ } + { * } if$ } if$ @@ -378,8 +340,8 @@ FUNCTION {format.vol.num.date.pages} pages empty$ 'skip$ { duplicate$ empty$ - { pop$ format.pages } - { ": " * pages n.dashify * } + { pop$ "" format.pages * } + { ": " format.pages * } if$ } if$ @@ -387,90 +349,86 @@ FUNCTION {format.vol.num.date.pages} FUNCTION {format.chapter.pages} { chapter empty$ - 'format.pages - { type empty$ - { "chapter" } - { type "l" change.case$ } + { pages empty$ + { "" } + { ": " format.pages } + if$ + } + { "\newblock\bibpunctuation " + type empty$ + { "\bibcase chapter" * } + { type "l" change.case$ * } if$ chapter tie.or.space.connect pages empty$ 'skip$ - { ", " * format.pages * } - if$ - } - if$ -} - -FUNCTION {format.in.ed.booktitle} -{ booktitle empty$ - { "" } - { "\bibIn \ " booktitle emphasize * - editor empty$ - 'skip$ - { ", ed.~" * format.editors * } + { ", pages " * format.pages * } if$ } if$ } -FUNCTION {empty.misc.check} -{ author empty$ title empty$ howpublished empty$ - month empty$ year empty$ note empty$ - and and and and and - key empty$ not and - { "all relevant fields are empty in " cite$ * warning$ } - 'skip$ - if$ -} FUNCTION{get.lastnames} { 's := - #1 'nameptr := s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr "{vv~}{ll}" format.name$ 't := - nameptr #1 > - { namesleft #1 > - { ", " * t * } - { numnames #2 > - { "," * } - 'skip$ - if$ - t "others" = - { " et~al." * } - { " and " * t * } - if$ + s #1 "{vv~}{ll}" format.name$ + numnames #3 > + { " et~al." * } + { numnames #1 > + { #2 'nameptr := + numnames #1 - 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + namesleft #1 > + { ", " * t * } + { " and " * t * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ } + 'skip$ if$ } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ + if$ } FUNCTION {make.address.publisher.year} -{ "\unskip\bibparenthesis{" +{ "" address empty$ 'skip$ - { address * ": " * } - if$ + { address * } + if$ publisher empty$ 'skip$ - { publisher * ", " * } + { address empty$ + { publisher * } + { ": " * publisher * } if$ - format.date * "}" * + } + if$ + format.date duplicate$ "" = + 'pop$ + { swap$ duplicate$ "" = + { * } + { swap$ ", " swap$ * * } + if$} + if$ + duplicate$ "" = + 'skip$ + { "\bibparenthesis{" swap$ * "}" * } + if$ } -FUNCTION{format.title.quoted} -{ title empty$ - { "" } - { "``" title * } - if$ - #1 'quoted.state := +FUNCTION {make.url} +{ "\url{" url * "}" * + urldate empty$ + { "there is url but no urldate in " cite$ * warning$ } + { " (accessed " * urldate * ")" * } + if$ } + FUNCTION {output.bibitem} { newline$ "\bibitem{" write$ @@ -479,80 +437,293 @@ FUNCTION {output.bibitem} newline$ "\biblastnames{" write$ author empty$ - { editor get.lastnames } + { editor empty$ + { organization empty$ + { "no last names in " cite$ * warning$ } + { organization } + if$ + } + { editor get.lastnames + editor num.names$ #1 > + { " (eds.)" * } + { " (ed.)" * } + if$ + } + if$ + } { author get.lastnames } if$ "}" * write$ - hereafter empty$ - 'skip$ - { "\bibhereafter{" write$ hereafter "}" * write$ } - if$ - newline$ - "\opcitstart " write$ before.all 'output.state := - #0 'quoted.state := } -FUNCTION {article} + +FUNCTION{output.start} +{ hereafter empty$ + 'skip$ + { "\bibhereafter{{\noexpand\em " write$ hereafter "}}" * write$ } + if$ + newline$ + "\opcitstart " write$ +} + +FUNCTION{output.as.block} +{ duplicate$ "" = + 'pop$ + { period.state #1 = + { "\GobbleOrNot" #0 'period.state := } + { "" } + if$ + "\bibpunctuation" * quotes * write$ newline$ "\newblock " swap$ * write$ + #1 'output.state := + } + if$ + "" 'quotes := +} + +FUNCTION{output.omitted} +{ 't := + duplicate$ "" = + { pop$ } + { "\toomit[" t * "]{\bibpunctuation\bibcase " * swap$ * "}" * write$ } + if$ +} + +FUNCTION {fin.entry} +{ write$ + note empty$ {""} {note} if$ "note" output.omitted + "\opcitend" write$ + newline$ +} + +FUNCTION{empty.warning} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ ""} + 'skip$ + if$ +} + +FUNCTION{empty.chapter.and.pages.warning} +{ 't := + chapter empty$ + { pages empty$ + { pop$ "empty " t * " in " * cite$ * warning$ "" } + 'skip$ + if$ + } + 'skip$ + if$ + +} + +FUNCTION{book} +{ output.bibitem + output.start + author empty$ + { format.editors.ed "author and editor" empty.warning write$ } + { format.authors "author and editor" editor either.warning write$ } + if$ + title emphasize "title" empty.warning output.as.block + edition empty$ + 'skip$ + { "\bibcase " edition * " edition" * output.as.block } + if$ + howpublished missing$ + 'skip$ + { "\bibcase " howpublished * output.as.block } + if$ + format.bvolume "volume" output.omitted + format.number.series "number" output.omitted + make.address.publisher.year write$ + url empty$ + 'skip$ + { make.url output.as.block } + if$ + fin.entry +} + +FUNCTION{article} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + howpublished empty$ + 'skip$ + { "\bibpunctuation'' \newblock\toomit[howpublished]{\bibcase + " howpublished * write$ + "}" 'quotes := + } + if$ + journal emphasize "journal" empty.warning + " " * format.vol.num.date.pages "year" empty.warning * output.as.block + url empty$ + 'skip$ + { make.url output.as.block } + if$ + fin.entry +} + +FUNCTION {incollection} { output.bibitem - format.authors "author" output.check - new.block - format.title.quoted "title" output.check - new.block - journal emphasize "journal" output.check - format.vol.num.date.pages "year" output.check - new.block - note output + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + "\bibcase in " output.as.block + crossref empty$ + 'skip$ + { "\bibincite{" crossref * "}" * write$ } + if$ + "{" write$ + editor empty$ + 'skip$ + { format.editors.ed ", " * write$ } + if$ + booktitle emphasize "booktitle" empty.warning write$ + edition empty$ + 'skip$ + { "\bibcase " edition * " edition" * output.as.block } + if$ + make.address.publisher.year write$ + url empty$ + 'skip$ + { make.url output.as.block } + if$ + "}" write$ + format.chapter.pages write$ fin.entry } -FUNCTION {book} +FUNCTION {inbook} { output.bibitem + output.start author empty$ - { format.editors.ed "author and editor" output.check } - { format.authors output.nonnull - "author and editor" editor either.or.check - } - if$ - new.block - format.btitle "title" output.check - edition new.block.checka - format.edition output - format.bvolume output - format.number.series output - make.address.publisher.year output - new.block - note output + { format.editors.ed "author and editor" empty.warning write$ } + { format.authors "author and editor" editor either.warning write$ } + if$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + chapter empty$ + 'skip$ + { type empty$ + { "\bibcase chapter " chapter * } + { "\bibcase " type * " " * chapter * } + if$ + } + if$ + pages empty$ + 'skip$ + { chapter empty$ + { "\bibcase pages" pages n.dashify tie.or.space.connect } + { "\toomit[pages]{ (pages" * pages n.dashify tie.or.space.connect ")}" * } + if$ + } + if$ + "chapter and pages" empty.warning + " of " * + crossref empty$ + { booktitle emphasize * "booktitle" empty.warning + edition empty$ + 'skip$ + { ", " * edition "l" change.case$ * " edition" * } + if$ + howpublished missing$ + 'skip$ + { ", " * howpublished * } + if$ + output.as.block + make.address.publisher.year write$ + } + { "\bibincitestar{" * crossref * "}{" * booktitle emphasize * "}" * output.as.block } + if$ fin.entry } -FUNCTION {incollection} +FUNCTION{phdthesis} { output.bibitem - format.authors "author" output.check - new.block - format.title.quoted "title" output.check - new.block - format.in.ed.booktitle "booktitle" output.check - format.bvolume output - format.number.series output - make.address.publisher.year output - format.chapter.pages output - new.block - note output + output.start + format.authors "author" empty.warning write$ + title emphasize "title" empty.warning + "\bibparenthesis{Ph.\,D.\ diss\GobbleOrNot.}" * output.as.block + address empty$ + { "" } + { address ": " * } + if$ + school "school" empty.warning * output.as.block + month empty$ + { "" } + { month " " * } + if$ + year "year" empty.warning * output.as.block + fin.entry +} + +FUNCTION{mastersthesis} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + title emphasize "title" empty.warning + "\bibparenthesis{M.\,A.\ thesis}" * output.as.block + address empty$ + { "" } + { address ": " * } + if$ + school "school" empty.warning * output.as.block + month empty$ + { "" } + { month " " * } + if$ + year "year" empty.warning * output.as.block + fin.entry +} + +FUNCTION{proceedings} +{ output.bibitem + output.start + editor empty$ + { organization "editor and organization" empty.warning write$ } + { format.editors.ed "editor" empty.warning write$ } + if$ + title emphasize "title" empty.warning output.as.block + format.bvolume "volume" output.omitted + format.number.series "number" output.omitted + make.address.publisher.year write$ + fin.entry +} + +FUNCTION {booklet} +{ book } + +FUNCTION {inproceedings} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + "\bibcase in " output.as.block + crossref empty$ + 'skip$ + { "\bibincite{" crossref * "}" * write$ } + if$ + "{" booktitle emphasize * "booktitle" empty.warning write$ + editor empty$ + { organization "editor and organization" empty.warning output.as.block } + { ", edited by " format.editors * write$ } + if$ + make.address.publisher.year write$ + "}" write$ + format.chapter.pages write$ fin.entry } FUNCTION {misc} { output.bibitem - format.authors "author" output.check - new.block - format.title output - howpublished new.block.checka - howpublished output - format.date output - new.block - note output + output.start + format.authors "author" empty.warning write$ + title output.as.block + howpublished missing$ + 'skip$ + { howpublished output.as.block } + if$ + format.date output.as.block fin.entry - empty.misc.check } FUNCTION {default.type} { misc } @@ -648,13 +819,13 @@ FUNCTION {sort.format.names} numnames 'namesleft := { namesleft #0 > } { nameptr #1 > - { " " * } - 'skip$ + { " " * } + 'skip$ if$ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := nameptr numnames = t "others" = and - { "et al" * } - { t sortify * } + { "et al" * } + { t sortify * } if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := @@ -769,6 +940,12 @@ FUNCTION {begin.bib} 'skip$ { preamble$ write$ newline$ } if$ + "\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}" write$ newline$ + "\newBibCommand{\bibincite[2]}{\recover@last\@nameuse{@#1}}{#2}" write$ newline$ + "\newBibCommand{\bibincitestar[2]}{\recover@last " write$ newline$ + " \@nameuse{#1@star}}{#2}" write$ newline$ + "\newBibCommand{\SwapNames[2]}{#1 #2}{#2, #1}" write$ newline$ + "\newBibCommand{\GobbleOrNot}{\relax}{\newblock\@gobble}" write$ newline$ "\begin{thebibliography}{}" write$ newline$ } ITERATE {presort} diff --git a/Master/texmf-dist/doc/latex/opcit/README b/Master/texmf-dist/doc/latex/opcit/README new file mode 100644 index 00000000000..7077704e030 --- /dev/null +++ b/Master/texmf-dist/doc/latex/opcit/README @@ -0,0 +1,33 @@ +Contents
+--------
+
+opcit.dtx Source file (LaTeX on it produces the full documentation)
+opcit.ins Installation driver (TeX on it produces the files of the package)
+opcit.sty Package
+opcit.bst BibTeX style
+opcit.pdf Manual (not including code)
+readme.txt
+
+
+Description
+----------
+
+This is a fully reworked and completed release of opcit, the package for footnote-style bibliography.
+
+The package keeps track of what works have already been cited, so that a further citation produces "Idem" or "op. cit." (both of which are customizable, both globally and locally).
+
+New features include a complete bst file; corrections or improvements suggested by users of the first version; cross references between entries and between footnotes; and more.
+
+
+Installation
+----------
+
+The sty file should go in tex\latex\opcit
+The bst file should go in bibtex\bst\opcit (or any other subdirectory of bst, such as public)
+
+
+Documentation
+-------------
+
+The user's manual is the pdf file. Running LaTeX on opcit.dtx produces this plus commented code.
+
diff --git a/Master/texmf-dist/doc/latex/opcit/opcit.dvi b/Master/texmf-dist/doc/latex/opcit/opcit.dvi Binary files differdeleted file mode 100644 index 4cb3d167520..00000000000 --- a/Master/texmf-dist/doc/latex/opcit/opcit.dvi +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/opcit/opcit.pdf b/Master/texmf-dist/doc/latex/opcit/opcit.pdf Binary files differnew file mode 100644 index 00000000000..22b9962aec8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/opcit/opcit.pdf diff --git a/Master/texmf-dist/source/latex/opcit/opcit.dtx b/Master/texmf-dist/source/latex/opcit/opcit.dtx index 003eaafa15f..72c04927bf8 100644 --- a/Master/texmf-dist/source/latex/opcit/opcit.dtx +++ b/Master/texmf-dist/source/latex/opcit/opcit.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% todo - package for to-do lists. +% opcit - bibliographical references as footnotes. % Copyright 2002 Federico Garcia (feg8@pitt.edu, fedegarcia@hotmail.com) % ------------------------------------------- % @@ -17,7 +17,7 @@ % \iffalse \documentclass{ltxdoc} \GetFileInfo{opcit.dtx} -\title{A package for footnote-style bibliographical references} +\title{\texttt{opcit} (version 2.0)\\a package for footnote-style bibliographical references} \date{\filedate{}} \author{Federico Garcia\\\texttt{feg8@pitt.edu}} \begin{document} @@ -26,240 +26,891 @@ \end{document} %</driver> % \fi +% +%\tableofcontents +% +%\section{New features in version 2} +% +%Users of |opcit| that are familiar with the package will be interested in the following new features: +% +%\begin{itemize} +%\item The bug that used to forbid constructions like |\cite[pp| has been fixed, so you no longer need to type |\cite[p{}p| or |\cite[p\relax p|. +%\item The bibliography style has been fully recoded, and it is more complete now. +%\item Cross-referencing has been implemented, both between bibliographical entries (so that an article in a book makes reference to the book) and between footnotes (so that `\emph{op.~cit.}' is a hyperlink to the footnote where the work was first cited, or alternatively a reference can be made to the footnote number). +%\item A way to omit information in the footnotes (but still list it in the final list) is now available. Using this you can avoid the annoying repetition potential to |@INCOLLECTION| entries, like `\dots\ pages 1--20, p.~13'. +%\item |opcit| now checks whether the optional argument to an \emph{Idem}-citation is identical to the last one, in whose case omits it. This prevents things like two consecutive footnotes both saying `\emph{Idem}, p.~13'. Also, appearance of `\emph{Idem}' only happens if it was the immediately previous footnote that referred to the work. +%\item Global and local mechanisms are provided for turning off either or both `\emph{Idem}' or `\emph{op.~cit.}'\ (substituting |hereafter|'s). +%\end{itemize} +% +%These new features are implemented as options to the package. This means that the previous way to load the package, with a custom \textsc{Bib}\TeX\ style as an option, has changed. See section~\ref{loading} below. +% +%\bigskip +%\noindent This second release of |opcit| owes its existence to both the encouragement and the suggestions I got from John~Scott, the first |opcit| user I knew of (that wasn't an acquaintance of mine). +% %\section{Introduction} % -%The basic bibliography styles of \LaTeXe\ and \textsc{Bib}\TeX, with labels between [~and~], are very foreign to the common uses of humanities-writing. In recent times, the category of bibliographical styles known as `author-date' seem to be gaining acceptance and becoming the most usual way to refer to a final list of references and have been successfully implemented in \LaTeX\ and \textsc{Bib}\TeX, for example in packages such as |achicago| and |harvard|. +%The basic bibliography styles of \LaTeXe\ and \textsc{Bib}\TeX, with labels between [~and~], are very foreign to the common uses of humanities-writing. In recent times, the category of bibliographical styles known as `author-date' seems to have gained acceptance and become the standard way to refer to a final list of references. This category of styles has been successfully implemented in \LaTeX\ and \textsc{Bib}\TeX, for example in formidable packages such as |natbib|, |achicago|, and |harvard|. % -%But certain disciplines---I have in mind musicology---still use, almost exclusively, the `old way' of footnote-referencing, above all in journal articles, which do not have a final list of `References' to which any key can refer. Author-year styles have the significant drawback that the labels interfere with the reading; and, as Susan~King and Oren~Patashnik point out in their `Editorial note' in the |apalike.bst| file, the main reason to use them (that changes to the bibliography does not mean ``changing numbers in both references and text") is rendered weakest by computerized typography. As far as I know, the `footnote category' of bibliographical styles has not been particularly addressed by package-writers. This is what |opcit| intends to do. +%However, certain disciplines still use the `old way' of footnote-referencing, above all in journal articles, which do not have a final list of `References' to which a key can refer. Author-year styles have the significant drawback that the labels interfere with the flow of the discourse, both in writing and in reading; and, as Susan~King and Oren~Patashnik point out in their `Editorial note' in the |apalike.bst| file, the main reason to use them (that changes to the bibliography does not mean ``changing numbers in both references and text") is rendered meaningless by computerized typography. The `footnote category' of bibliographical styles has not been directly addressed by \LaTeX\ package-writers before |opcit|. % -%Actually, there \emph{is} a package intended to place the bibliography as footnotes, namely |footbib|.\footnote{By Eric Domenjoud, 1995.} In this package, the labels appear as superscripts---$^{[1]}$---and the information about the source is appended to the bottom of the page. It is not, however, \emph{really} a footnote, for their numbering is independent, and if other footnotes (not reference-ones) appear, they appear separated from the reference-ones. In this way, the whole approach is a kind of `hybrid' between label-oriented and footnote-oriented bibliographical styles. +%Actually, there \emph{is} a package intended to place the bibliography as footnotes, namely |footbib|.\footnote{By Eric Domenjoud, 1995.} In this package, the labels appear as superscripts---$^{[1]}$---and the information about the source is appended to the bottom of the page. This style is a kind of `hybrid' between footnote and label styles: the numbering of the citations is independent from the footnotes, and if other footnotes (not bibliography ones) appear, they appear separated from the citations. % -%The system I provide with |opcit| makes the references footnotes in every sense. On the other hand, as is usual in this kind of style, it keeps track of what sources have already been cited, in order to avoid multiple copies of the same, potencially long, footnote. So it makes automatic use of usual (and beautiful) conventions such as \emph{Op.~Cit.}---which fives the package its name---and \emph{Idem}, or allows the user to set `hereafters' to repeatedly refer to the same publication. +%The system provided by |opcit| makes the references footnotes in the full sense. As is customary in this kind of style, it keeps track of the sources already been cited, in order to avoid multiple copies of the same, potentially long, footnote. So, for `post-citations' (a later citation of a work already cited), it makes automatic use of conventions such as \emph{Idem} and \emph{op.~cit.}---which gives the package its name---or allows the user to set `hereafters' to repeatedly refer to the same publication. % -%What I regret most about this package is that I was not able to make it `|bst|-independent,' i.e., able to run with any \textsc{Bib}\TeX\ style that the user could want to use. (This, for example, is one of the good things about |footbib|.) The main reason why this was not possible is that |bst| files are designed to print the information in a list, not as footnotes, inserting, for example, periods instead of commas, and giving the author names with last-name first. +%\bigskip +%\noindent What I regret most about this package is that I was not able to make it `|bst|-independent,' i.e., able to run with any \textsc{Bib}\TeX\ style that the user could possibly want to use. (This, for example, is one of the good things about |footbib|.) The main reason why this was not possible is that |bst| files are designed to print the information in a list, not as footnotes, inserting, for example, periods instead of commas, and giving the author names with last-name first. % -%Since I do not want to fix the \textsc{Bib}\TeX\ style to use with |opcit| (and, OK, also because of lack of time), I have made one with support for just four kinds of entry (the ones I have needed and tested): \texttt{ARTICLE}, \texttt{BOOK}, \texttt{INCOLLECTION}, and \texttt{MISC}. In this documentation I will try to make clear what is needed for new entries to be appended by the users.\footnote{Changing, as usual, the name of the file.} Eventually, I will add more of them, as well as implement the cross-referencing mechanisms. +%The \textsc{Bib}\TeX\ style I provide in this version is much more complete than that in the first one. However, I have maintained the premise that new styles can be created by the users. To that end, I have greatly expanded the comments to the code of |opcit.bst| below, so its adaptation is easier. As usual, any modification is welcome as long as the file name is changed. Also, if you are creating a new style, I would like to (collaborate and) consider it for inclusion in the |opcit| distribution. % %\section{Use} % -%\DescribeMacro{\cite} -%The user keeps citing bibliographical references with |\cite|. Thus, |\cite{texbook}| will produce the footnote `\footnote{Donald E. Knuth, \emph{The \TeX book} (Reading, Mass.: Addison Wesley, 1986).}'. The optional argument has the usual meaning, so |\cite[p.~100]{taruskin}| creates `\footnote{Richard Taruskin, \emph{Defining Russia musically: Historical and Hermeneutical Essays} (Princeton: Princeton University Press, 1997), p.~100.}'. +%\subsection{Loading the package}\label{loading} +% +%As usual, you have to load the package with % -%Note that |opcit| adds a period at the end of the footnotes; however, if the user adds it (for example, in |\cite[Introduction.]{gellner}|), it will refrain from adding it: `\footnote{Ernest Gellner, \emph{Thought and change} (Chicago: University of Chicago Press, 1964), introduction.}'. It will also avoid it after `?' or `!'; in general, after any character with a |\sfcode| equal to the one of the period. (I am afraid this is lost in |\frenchspacing| and similar situations, where |opcit| has no way to `see' the period, and will \emph{always} add one.) +%|\usepackage[|\meta{options}|]{opcit}| % -%\textbf{Warning!} I have no clue as to why, but there is a problem when the optional argument to |\cite| starts with two identical symbols (which is unfortunately very often in expressions such as |\cite[pp.~10ff.]|!). A |\relax| should be put between them (|\cite[p\relax p~10.ff]|) to ensure proper behavior. +%\noindent The \meta{options}, all new to the second version, are: +%\begin{center}\begin{tabular}{lp{9cm}}\hline +%|custombst| & Allows the user to issue a \verb"\bibliographystyle" command to change the \textsc{Bib}\TeX used by default.\\ +%|nocustombst| & To use the default style. This is of course the default option.\\\hline +%|hyperref| & Makes the expression `\emph{op.~cit.}' (or the one set by the user) a hyperlink to the first citation of the reference. Default if the \texttt{hyperref} package has been loaded before |opcit|; otherwise, it is not default.\\ +%|nohyperref| & No hyperlinks. Default when package \texttt{hyperref} is not loaded.\\\hline +%|omitting| & Omits certain information, such as pages, volume, series, etc., from the footnotes (you can of course control what is omitted and what is not). Selected by default.\\ +%|noomitting| & Turns off the omission mechanism altogether.\\\hline +%|idemcheck| & Checks for identical \emph{Idem}-citations, omitting the optional argument. Selected by default.\\ +%|noidemcheck| & Turns off the check.\\\hline +%\end{tabular}\end{center} +% +%See below for detailed information on the effects of these options. +% +%\subsection{Citations} +%\DescribeMacro{\cite} +%The user keeps citing with |\cite|. Thus, |\cite{texbook}| will produce the footnote `\footnote{Donald E. Knuth, \emph{The \TeX book} (Reading, Mass.: Addison Wesley, 1986).}'. The optional argument has the usual meaning, so for example, |\cite[p.~100]{taruskin}| creates `\footnote{Richard Taruskin, \emph{Defining Russia musically: Historical and Hermeneutical Essays} (Princeton: Princeton University Press, 1997), p.~100.}'. +% +%Note that |opcit| adds a period at the end of the footnotes; however, if the user adds it (for example, in |\cite[Introduction.]{gellner}|), it will not: `\footnote{Ernest Gellner, \emph{Thought and change} (Chicago: University of Chicago Press, 1964), introduction.}'. It will also avoid it after `?' or `!'; in general, after any character with a |\sfcode| equal to the one of the period. (This is lost in |\frenchspacing| and similar situations, where |opcit| has no way to `see' the period, and will \emph{always} add one.) % %A |\cite| command can also occur within the argument of a |\footnote|. In that case, the information on the source is added to the text of the footnote, with \emph{no} period added.\footnote{This is because it is assumed that the user will always `close' the footnote with a final period. Issuing here \texttt{\textbackslash cite\{martinb\}}, which produces Jes\'us Mart\'{\i}n-Barbero, \emph{Communication, culture, and hegemony: From media to mediations} (London: SAGE Publications, 1993), I do not want |opcit| to add a period.} % -%A later citation of the \TeX book through |\cite{texbook}| will not render the whole footnote text again, but rather `\footnote{Knuth, \emph{Op.~cit.}}'. The author name has been reduced to the last-name, and the rest of the information is replaced by `\emph{Op.~cit.}' Again, the period is appropriately handled: no period is added to the one at the end of this expression. But in the case of |\cite[p.~101]{taruskin}|, it is added: `\footnote{Taruskin, \emph{Op.~cit.}, p.~101.}'. +%The starred \DescribeMacro{\cite*}version of |\cite| omits the author's name from the footnote. So: Gellner expanded one of the ideas presented from his mentioned book in a later study.|\cite*{gellner2}|\footnote{\emph{Nations and Nationalism} (Ithaca: Cornell University Press, 1983).} +% +%\subsection{Post-citations} +%Post-citations---later citations of an already cited work---behave differently. For example, a new citation of the \TeX book through |\cite{texbook}| will not render the whole footnote text again, but rather `\footnote{Knuth, \emph{op.~cit.}}'. The author name has been reduced to the last-name, and the rest of the information is replaced by `\emph{op.~cit.}' Again, the period is appropriately handled: no period is added to the one at the end of this expression. But in the case of |\cite[p.~101]{taruskin}|, it is added: `\footnote{Taruskin, \emph{op.~cit.}, p.~101.}'. You can also use |\cite*| to hide the author's name for \emph{op.~cit.}-citations. % -%A similar feature is that of `\emph{Idem}.' If a reference is cited twice or more times consecutively, the second footnote (and after) will contain only `\emph{Idem},' followed by the optional argument, if any (and by a period if necessary). Thus, a further citation of Taruskin's book here, through |\cite{taruskin}|, renders `\footnote{\emph{Idem.}}'. +%This is not good when there are several works by the same author, in whose case |opcit| has no way to know which one is meant at each point. This is handled with the `hereafter' mechanism (section~\ref{hereafter}). % -%\DescribeMacro{\opcittext}\DescribeMacro{\idemtext} -%The user can change the expressions `\emph{Op.~Cit.}' and `\emph{Idem}' by |\renewcommand|'ing the |\opcittext| and |\idemtext| commands, respectively. +%\bigskip +%\noindent Another kind of situation arises when the same work is cited \emph{consecutively}. In that case, the corresponding footnote(s) will say `\emph{Idem}'. In principle, this will be followed by the optional argument, if any. \marginpar{\raggedleft\textsf{New Feature}}However, if two \emph{Idem}-citations have the same optional argument, the second time it will \emph{not} be typeset. \DescribeMacro{nocheckidem}(This can be turned off with the |nocheckidem| option.) In any case, a final period will be added if needed. % -%\DescribeMacro{\cite*} -%A starred version of |\cite| is provided, by which the author's name is omitted from the reference. So we can say that Gellner expanded one of the ideas presented from his mentioned book in a later study.|\cite*{gellner2}|\footnote{\emph{Nations and Nationalism} (Ithaca: Cornell University Press, 1983).} +%Thus, a further citation here of Taruskin's book (the one that was cited last in the previous paragraph), through |\cite[p.~xxi]{taruskin}|, renders `\footnote{\emph{Idem}, p.~xxi.}'. If the same command (|\cite[p.~xxi]{taruskin}|) is issued again, the footnote will be `\footnote{\emph{Idem}.}', with no `p.~xxi' in it. +% +%Since an \emph{Idem}-citation will always hide the author's name, use of |\cite*| in those situations has has no special effect. +% +%\bigskip +%\noindent As a reader,\marginpar{\raggedleft\textsf{New feature}} I have had the annoying experience of needing to find a reference for which the footnote to the page says only `Barto\v s: \emph{op.~cit.}' You are forced carefully to look through all the previous footnotes in search of the whole information. It was thus very nice to come across a book\footnote{Jamie C. Kassler: \emph{Music, Science, Philosophy: Models in the Universe of Thought} (Aldershot, Burlington, Singapore and Sydney: Ashgate, 2001).} with footnote references, but in which any post-citations indicated the footnote in which the work was first cited---something like `(note 14).' I then decided to implement this in |opcit|. +% +%\DescribeMacro{\bibref}So, command |\bibref{|\meta{key}|}| produces the number in which the \meta{key} reference was |\cite|'d for the first time. (If the reference has not been |\cite|'d before, however, there will be an error message.) You can use |\bibref| anywhere, in the main text, as the optional argument to a |\cite|, or in a footnote. For example, you can post-cite the \TeX Book with |\cite[note~\bibref]{texbook}|, or |\footnote{\cite{texbook} (see footnote \bibref above).}|, etc. In the first case you would get `\footnote{Knuth, \emph{op.~cit.}, note 2.}'. +% +%\DescribeMacro{hyperref}The footnote number printed by |\bibref| (either a manual or an automatic one) will be a hyperlink if the |hyperref| option is in place. In fact, this option provides satisfactory cross-referencing with hyperlinks: the `\emph{op.~cit.}' expression itself will be a hyperlink if this option is chosen. +% +%The |hyperref| option is in force by default if the |hyperref| package has been loaded (before |opcit|). If the package is loaded, but hyperlinks for citations are not desired, they can be turned off with the |nohyperref| option to |opcit|. +% +%\subsubsection{Extra control}\label{extra} +% +%\DescribeMacro{\resetcites}In long documents, for example books with chapters, it might be desirable to reset the citations so that they are again fully cited in the footnotes (even if they were already cited, say, in a previous chapter). This is done with the command |\resetcites|. It affects all the entries in the bibliography database. +% +%\DescribeMacro{\cited}The contrary procedure---to make the next citation of a work a post-citation, with \emph{op.~cit.} instead of the full information---is possible for individual entries: |\cited{|\meta{key1}|,|\meta{key2}|,|\dots|}| will make |opcit| pretend that the entries in the argument were already cited. This is particularly useful with cross references among entries (see section~\ref{crossrefs}). +% +%\subsection{Customization} +%The user can change \DescribeMacro{\opcittext}\DescribeMacro{\idemtext}the expressions `\emph{op.~cit.}' and `\emph{Idem}' by |\renewcommand|'ing the |\opcittext| and |\idemtext| commands, respectively. % %\subsection{The `herafter' mechanism}\label{hereafter} % -%\DescribeMacro{hereafter = ""}When two or more works by the same author are |\cite|'d, the \emph{Op.~Cit.}\ mechanism is not reliable (there are many `\emph{oOpera~citat\ae}'). The user should then provide, in the \texttt{bib} file and for all the works of that author, a value for the new entry \texttt{hereafter}. Then, |opcit| will use the value of this entry in the place of \emph{Op.~Cit.} +%\DescribeMacro{hereafter = ""}When two or more works by the same author are |\cite|'d, the \emph{op.~cit.}\ mechanism is not reliable. The user should then provide a `\texttt{hereafter}' value for each work by the same author in the \texttt{bib} file. Then, |opcit| will use the value of this entry in the place of \emph{op.~cit.} +% +%For example, if Gellner's mentioned books had \texttt{hereafter} entries of |"T{\&}C"| and |"N{\&}N"|, respectively, the commands |\cite{gellner}| and |\cite{gellner2}| would produce `\footnote{Gellner: \emph{T\&C}.}' and `\footnote{Gellner: \emph{N\&N}.}' (of course, from the second time these works are cited on). Note that the strings were emphasized. The starred version |\cite*| still hides the author's name, and the `\emph{Idem}' mechanism will apply if any of the works is |\cite|'d for the second time in a row. % -%For example, if Gellner's mentioned books had \texttt{hereafter} entries of |"T{\&}C"| and |"N{\&}N"|, respectively, the commands |\cite{gellner}| and |\cite{gellner2}| will produce `\footnote{Gellner: \emph{T\&C}.}' and `\footnote{Gellner: \emph{N\&N}.}' (of course, from the second time these works are cited on). Note that the strings were emphasized. Still, the starred version |\cite*| hides the author's name, and the `\emph{Idem}' mechanism will apply if any of the works is |\cite|'d for the second time in a row. +%If no \texttt{hereafter} entry is found (and there are several references by the same author), a warning will be issued, and the deliberately unacceptable expression \emph{?Op.?Cit.?} substituted. % -%In case no \texttt{hereafter} entry is found, a warning will be issued, and the deliberately unacceptable expression \emph{?Op.?Cit.?} substituted. +%The value of \texttt{hereafter}, that replaces `\emph{op.~cit.},' will be a hyperlink if the |hyperref| option is on. % %\DescribeMacro{\hereafter} -%The |\hereafter| command typesets the \texttt{hereafter} string of the last work |\cite|'d, so that we can say something like +%The |\hereafter| command typesets the \texttt{hereafter} string of the last |\cite|'d work, so that we can say something like % %\begin{verbatim} %\footnote{See \cite{gellner}; hereafter I will refer to this text as %\hereafter.} %\end{verbatim} % +%This mechanism can be used also for single works of a particular author. The result of |\hereafter| is \emph{not} a hyperlink. +% +%\subsection{Omitting text from the footnotes}\label{omits} +% +%Sometimes\marginpar{\raggedleft\textsf{New Feature}} it is desirable to omit some part of the bibliographical information from the footnotes, keeping it on the final references list. \DescribeMacro{\toomit}This is now allowed by |opcit| through the command |\toomit|. You use it in the |.bib| file, like this: +% +%\begin{verbatim} +%address = "Aldershot\toomit{, Burlington, Singapore and Sydney}", +%\end{verbatim} +% +%\noindent The effect is that the argument of |\toomit| will be typeset in the final references list, but not in the footnotes. +% +%Typical cases when this is useful are: +%\begin{itemize} +%\item Long addresses (example above). +%\item Long titles: {\ttfamily title = "The Prisoner of Zenda|\toomit{|: being the story of three months in the life of an English gentleman|}|"}. +%\item Some translated titles: {\ttfamily title = "Music and Discourse|\toomit{| [Musicologie g|{\'e}|n|{\'e}|rale et s|{\'e}|miologie]|}|"}. +%\end{itemize} +% +%A special case of omission concerns page numbers for articles in journals or books. Since the page numbers for articles usually go at the end of the reference, they could clash with the optional argument to |\cite| (something like a `pages~1--20, p.~13'). This cannot be fixed with |\toomit|, because the particle `pages' is added by \textsc{Bib}\TeX, so it's not susceptible of |\toomit|. The same is true of the \texttt{volume}, the \texttt{series}, and \texttt{number} of a |@BOOK| entry, among others. +% +%The solution is that |opcit| omits these fields altogether from the footnotes (they still appear in the final bibliography list). +% +%This is the default behavior, but it can be overriden. \DescribeMacro{\with}The |\with{|\meta{field}|}| command forces the \meta{field} of the next reference to appear, even if it would by default be omitted. So, for example, to get a footnote that does include the pages of an article, you type |\with{pages}\cite{foo}|. Similarly, the \texttt{volume} of a book can be `de-omitted' by typing |\with{volume}\cite{foobook}|. +% +%Several |\with| commands can go in succession. For example, if you want the page numbers of the article from a collected edition, \emph{and} the volume of the book that contains, you can say |\with{pages}\with{volume}\cite{book}|. +% +%The scope of |\with| is only the next |\cite| (each |\cite| sets all default omissions back on). On the other hand, nothing happens if a |\cite| does not have the \meta{field} that was requested with |\with|. +% +% +%A more sophisticated version of |\toomit| allows the user to use |\with| in connection with it. |\toomit[|\meta{category}|]{|\meta{text}|}| will by default omit the \meta{text} (from the footnotes), but it could be forced typing |\with[|\meta{category}|]|. Note that the \meta{category} is not a \textsc{Bib}\TeX\ field. +% +%For example, +%\begin{verbatim} +%title = "Music and discourse: Toward a semiology of +% music\toomit[translation]{\ [Musicologie +% g{\'e}n{\'e}ral et s{\'e}miologie]}" +%\end{verbatim} +% +%\noindent the translation will by default be omitted in the footnote, but there will be a |\with{translation}| that will include it. +% +%\DescribeMacro{noomitting}You can turn off the omissions by specifying the |noomitting| option to the package. In that case, the commands |\toomit| and |\with| have no effect. +% +% %\subsection{The final references list} % %The command |\bibliography| has the usual effect of producing a final section (or chapter) for `References.' According to the \textsc{Bib}\TeX\ style used, the format of the entries is different in the references list from the footnotes. % -%Frequently, a document with bibliographical references in footnote style does not include a final references list. However, it is the |\bibliography| command that tells \textsc{Bib}\TeX\ what database file to look at, so |opcit| needs it to be present. If the final list is not wanted, the user should include this command (and the list) at least once, so that the file \texttt{\jobname.bbl} is created, and then comment it out. In this way, |opcit| will have a file to read, but no reference list will be actually typeset. +%\marginpar{\raggedleft\textsf{New Feature}}Frequently, a document with bibliographical references in footnote style does not include a final references list. \DescribeMacro{\nobibliography}But the user has to tell |opcit| where to find the \textsc{Bib}\TeX\ database, which is done by the |\bibliography| command. So there is now a |\nobibliography| that works just like |\bibliography| but produces no list. The command takes the file name(s) of the database(s) as its argument. % -%\subsection{Modifying the bibliography style}\label{bsts} +%Bear in mind that if you use |\nobibliography| instead of |\bibliography|, some information that is by default omitted from the footnotes (see section~\ref{omits}) might be completely lost. |opcit| emits a warning of this in the \texttt{log} file. +% +%\section{The \textsc{Bib}\TeX\ style}\label{bstyle} +% +%The \textsc{Bib}\TeX\ style (|opcit.bst|) that comes with this version~2 of |opcit| is fairly complete, but this does not mean that it can handle every conceivable combination of different pieces of information in any bibliographical reference. I have provided the standard entry types, and the fields are also about the same as in standard styles (with the notable addition of |hereafter|, discussed in section~\ref{hereafter}). So I repeat the \emph{caveat} of Oren~Patashnik: be creative in the use of entries and fields, and you will be able to achieve pretty much anything.\footnote{It is never a bad idea to read Patashnik's ``\textsc{Bib}\TeX ing'' (February 8, 1988), file \texttt{btxdoc.dvi} in \LaTeX\ standard distribution.} % -%This distribution of |opcit| includes a \textsc{Bib}\TeX\ style file, |opcit.bst|, designed to fulfill the package's conventions. This style is far from being (and from pretending to be) complete. It supports only four generic entry-types: \\ -%|@ARTICLE|\\ -%|@BOOK|\\ -%|@INCOLLECTION|\\ -%|@MISC| +%For example: rather than providing a field for |translation|, which would imply provision of a host of additional fields---|datetranslated|, |original|, |translator|, \dots---and would not be used very often, I have relied on the user's judicious use of fields like |note| and |howpublished|. The following conventions are true of all entry types without exception: +%\begin{itemize} +%\item \texttt{howpublished} is printed \emph{immediately after} \texttt{edition}. +%\item \texttt{note} is printed \emph{at the end of an entry}. It is also omitted from the footnotes (but can be retrieved with |\with{note}|). +%\end{itemize} +% +%\subsection{Cross referencing}\label{crossrefs} +% +%\DescribeMacro{crossref = ""}Cross referencing through the |crossref| field has been fully implemented in version~2. Its exact behavior depends on whether a reference is being cited in a footnote, or it appears in the final list. +% +%Consider, for example, the entry +% +%\begin{verbatim} +%@INCOLLECTION{derrida, +% title = "Deconstruction and actuality", +% author = "Jacques Derrida", +% crossref = "postmodern", +% pages="75--78" +% } +%\end{verbatim} % -%These entries take the usual fields of the |plain.bst| style, just adding one more, namely |hereafter| (see section~\ref{hereafter}). Cross-reference, moreover, has been turned off.\footnote{In part, because a footnote-oriented style does not naturally lend itself to cross reference, for there are no `labels' to refer to.} +%If there is a |\cite{derrida}| in the document, the result will be equivalent to having typed: {\ttfamily|\footnote{|Jacques Derrida, ``Deconstruction and actuality,'' in |\cite{postmodern}.}|} % -%This style has been, in general, sufficient for my own needs (I have made |@INBOOK| entries as |@INCOLLECTION|). But I regard it mainly as a model for new, more specific (but also less versatile) bibliography styles that use the features of the package. This section states clearly what is needed from such a style. +%The last |\cite| is added automatically by \texttt{opcit}, as a result of the \texttt{crossref} field. Its output will be either a full citation of the book, or an `\emph{op.~cit.}'\ expression, depending on whether the book has already been cited or not. % -%If a style is created to work with |opcit|, the user has to indicate it as an option to the package, with the usual \TeX\ conventions for file names, and with no extension, for example |\usepackage[c:/texmf/bibtex/bst/modopcit]{opcit}|. If no style is specified, |opcit.bst| will be used. +%The citation that results from the |crossref| field will by default \emph{not} count as the first citation of that entry (``\texttt{postmodern}'' in the example). This means that a later citation of this same entry (be it by itself or within another cross reference) will expand the full information again. The command |\cited| (section~\ref{extra}) can be used to override this and make future citations of the cross reference be of the \emph{op.~cit.} type. % -%Many details of formatting differ between a footnote-style and a list-style reference. The most visible one is that in footnotes commas are used when periods are preferred in a list. Also, while in the list address and publisher form a block independent from year, in the footnotes the three things are grouped by parentheses. And so on. +% In addition, \emph{Idem} is disabled for it. However, post-citations of the main reference (``\texttt{derrida}'') are not affected at all by the cross~reference mechanism, and will use the regular `\emph{op.~cit.}' or `\emph{Idem}' expressions. % -%Because of all this, a way has to be available for |opcit| the package to communicate with the \textsc{Bib}\TeX-sylte. To properly find out and assign the information of each |\bibitem|, |opcit| has to know what exactly is the author's name, what the last-name (for second and later citations of the same work, in which the first name is omitted), etc. +%\bigskip\noindent +%In the final references list, the effect of the |crossref| field is more familiar: the entry will get the information for the missing fields from the entry that is being cross-referenced, just as in a standard \textsc{Bib}\TeX\ style. % -%The convention chosen is that the \textsc{Bib}\TeX-style writes out every |\bibitem| in the form +%\subsection{Other tools} +% +%The new field |hereafter| has already been explained (section~\ref{hereafter}), as well as the use of |\toomit| (section~\ref{omits}). Other features will be introduced in this section. +% +%\DescribeMacro{\bibpunctuation}The |\bibpunctuation| command expands into a comma in the footnotes, but into a period in the final references list. It is internally used by |opcit.bst| to separate the different pieces of information within an entry, and the user can use it just as well. +% +%Use of |\bibpunctuation| is likely to need complement for the capitalization of what follows. After a comma, things should start lowercase; after a period, uppercase. This ambiguous case has been conceived for |opcit| as the `bibliography-case,' and implemented in the command \marginpar{\raggedleft\textsf{New Feature}}\DescribeMacro{\bibcase}|\bibcase|. You can insert it anywhere and it will make the first letter of the following word either lower- or uppercase. For example, |opcit.bst| inserts |\bibcase| before the particle `in' of an |@INCOLLECTION| entry. Applying braces, like in |\bibcase{paideia}|, would capitalize or de-capitalize the whole argument. +% +%\DescribeMacro{\bibcite}If you have to know it all, the implementation of |crossref| described in the previous section is made through the |\bibcite| command. It takes two arguments: the label to cite within the citation, and the whole information to be typeset in the final list. You can directly use this command in any field. +% +%\subsection{The entry types} +% +%The |opcit| \textsc{Bib}\TeX\ style accepts the same entry types as the standard styles. Below you find examples of each of the entry types in both footnote and final-list layout, as well as explicit lists of omitted fields (see section~\ref{omits}). +% +%\subsubsection{Book} +%Omitted fields: \texttt{volume} and \texttt{series} (recovered by |\with{volume}|); \texttt{number} and \texttt{series} (|\with{number}|); \texttt{note} (|\with{note}|). +% +%\noindent\hrulefill\ 1\ \hrulefill +% +%\begin{verbatim} +%@BOOK{berlinsky, +% author="David Berlinsky", +% title="Newton's Gift\toomit{: How Sir Isaac Newton +% Unlocked the System of the World}", +% publisher="Simon {\&} Schuster", +% address="New~York and London", +% year="2000"} +%\end{verbatim} +%The first footnote for this entry would read: +%\begin{quotation}\small\noindent +%David Berlinsky, \emph{Newton's Gift} (New York and London: Simon \& Schuster, 2000). +%\end{quotation} +%In the final reference list, the entry looks like: +%\begin{quotation}\noindent +%\makebox[2.5em][r]{Berlinsky}, David. \emph{Newton's Gift: How Sir Isaac Newton Unlocked the System of the World}. New York and London: Simon \& Schuster, 2000. +%\end{quotation} +% +%\noindent\hrulefill\ 2\ \hrulefill +% +%\begin{verbatim} +%@BOOK{tac, +% author="Ernest Gellner", +% title="Thought and Change", +% series="``The Nature of Human Society'' Series (ed.\ +% Julian Pitt-Rivers and Ernest Gellner) Press", +% number="1", +% year="1964", +% address="Chicago", +% publisher="University of Chicago"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent +%Ernest Gellner, \emph{Thought and Change} (Chicago: University of Chicago Press, 1964). +%\end{quotation} +%For the final-list of this and the rest of the examples see page~\pageref{examples} (footnote-layout is illustrated in the main text). +% +%\noindent\hrulefill\ 3\ \hrulefill +% +%\begin{verbatim} +%@BOOK{walker, +% title="The Final Years 1861--1886", +% volume="3", +% series="Franz Liszt", +% author="Alan Walker", +% publisher="Alfred A. Knopf", +% address="New York", +% year="1996"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent +%Alan Walker, \emph{The Final Years 1861--1886} (New York: Alfred A. Kopf, 1996). +%\end{quotation} +%\noindent This is a case in which you might prefer typing |\with{volume}\cite{walker}|, with the following effect: +%\begin{quotation}\small\noindent +%Alan Walker, \emph{The Final Years 1861--1886}, volume 3 of \emph{Franz Liszt} (New York: Alfred A. Kopf, 1996). +%\end{quotation} +% +%\subsubsection{Article} +% +%Omitted fields: \texttt{pages}, \texttt{month}, \texttt{note}. +% +%\noindent\hrulefill\ 1\ \hrulefill +% +%\begin{verbatim} +%@ARTICLE{sheldon, +% author="David A. Sheldon", +% title="The Galant Style Revisited and Re-Evaluated", +% journal="Acta Musicologica", +% volume="47", +% number="2", +% year="1975", +% pages="240--70"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent David A. Sheldon, ``The Galant Style Revisited and Re-Evaluated,'' \emph{Acta Musicologica} 47/2 (1975).\end{quotation} +% +%\noindent\hrulefill\ 2\ \hrulefill +% +%\begin{verbatim} +%@ARTICLE{nattiez, +% author="{Jean-Jacques} Nattiez and Isabelle Schulte-Technoff", +% title="L'etnomusicologia: strutturalismo o culturalismo?\toomit{ +% Intervista con Jean-Jacques Nattiez di Isabelle Schulte-Technoff}", +% journal="Musica/Realt{\`a}", +% volume="61", +% pages="109--131", +% year="2000", +% month="March"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent Jean-Jacques Nattiez and Isabelle Schulte-Technoff, ``L'etnomusicologia: strutturalismo o culturalismo?,'' \emph{Musica/Realt\`a} 61 (2000).\end{quotation} +% +%\noindent Or, alternatively, |\with{month}\with{pages}\cite{nattiez}| produces: +%\begin{quotation}\small\noindent Jean-Jacques Nattiez and Isabelle Schulte-Technoff, ``L'etnomusicologia: strutturalismo o culturalismo?,'' \emph{Musica/Realt\`a} 61 (March 2000): 109--131.\end{quotation} +% +%\subsubsection{Incollection} +%For articles in an edited book. For use with \textsc{Bib}\TeX\ cross-reference (\texttt{crossref}) see examples 2ff. +% +%Omitted fields: \texttt{pages}, \texttt{chapter}, \texttt{note}. +% +%\noindent\hrulefill\ 1\ \hrulefill +% +%\begin{verbatim} +%@INCOLLECTION{laudan, +% title="Explaining the Success of Science\toomit{: Beyond +% Epistemic Realism and Relativism}", +% author="Larry Laudan", +% booktitle="Science and the Quest for Reality", +% editor="Alfred I. Tauber", +% address="London", +% publisher="MacMillan Press Ltd.", +% pages="137--161", +% year="1997"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent Larry Laudan, ``Explaining the Success of Science,'' in Alfred I. Tauber (ed.), \emph{Science and the Quest for Reality} (London: MacMillan Press Ltd., 1997).\end{quotation} +% +%\bigskip\noindent\hrulefill\ 2\ \hrulefill +% +%Given the following entry: +%\begin{verbatim} +%@BOOK{grove, +% booktitle="Grove Music Online", +% editor="L. Macy", +% url="http://www.grovemusic.com/"} +%\end{verbatim} +%another entry can make reference to it: +%\begin{verbatim} +%@INCOLLECTION{weber, +% title="Weber, Gottfried", +% author="Janna K. Saslaw", +% crossref="grove", +% urldate="October 5, 2005"} +%\end{verbatim} +%Then, citation of the latter in the footnotes will |\cite| the former. The layout of this `nested' |\cite| will depend on the kind of entry it is (usually a book), and might also be \emph{op.~cit.}, if it has already been cited. In this case the result is: +%\begin{quotation}\small\noindent Janna K. Saslaw, ``Weber, Gottfried,'' in L. Macy (ed.), \emph{Grove Music Online}, +%\texttt{http://www.grovemusic.com/} (accessed October 5, 2005).\end{quotation} +% +%\subsubsection{Inbook} +%For individual chapters or articles from books by a single author. +% +%Omitted fields: \texttt{pages}, \texttt{chapter}, \texttt{note}. +% +%\noindent\hrulefill\ 1\ \hrulefill +%\begin{verbatim} +%@INBOOK{stuff, +% title="The Stuff of Change", +% booktitle="Thought and Change", +% pages="126--146", +% chapter="6", +% crossref="tac"} +%\end{verbatim} +%This entry makes reference to the first example of \texttt{@BOOK} to create the following footnote: +%\begin{quotation}\small\noindent Ernest Gellner, ``The Stuff of Change,'' chapter 6 of \emph{op.~cit.}\end{quotation} +%This would work best if the book entry had a field for \texttt{hereafter}, creating something like ``chapter 6 of \emph{Thought and Change}.'' On the other hand, |\with{pages}| adds ``\dots chapter 6 (pages 126--146) of\dots'' +% +%\bigskip\noindent\hrulefill\ 2\ \hrulefill +% +%\begin{verbatim} +%@INBOOK{attemborough, +% author="David Attenborough", +% title="The Infinite Variety", +% type="Episode", +% chapter="1", +% booktitle="Life on Earth\toomit{ \upshape (videorecording)}", +% publisher="BBC", +% year="1979"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent David Attemborough, ``The Infinite Variety,'' episode~1 of \emph{Life on Earth} (BBC, 1979).\end{quotation} +%\subsubsection{PHDthesis} +% +%Omitted fields: \texttt{note}. +% +%\begin{verbatim} +%@PHDTHESIS{saslaw, +% author="Janna K. Saslaw", +% title="Gottfried Weber and the Concept of Mehrdeutigkeit", +% school="Columbia University", +% year="1992"} +%\end{verbatim} +%Footnote layout: +%\begin{quotation}\small\noindent Janna K. Saslaw, \emph{Gottfried Weber and the Concept of Mehrdeutigkeit} (Ph.\,D.\ diss.), Columbia University, 1992.\end{quotation} +% +%\subsubsection{Mastersthesis} +% +%Analogous to \texttt{phdthesis}, but with `M.\,A. thesis' instead of `Ph.\,D. diss.' +% +%\subsubsection{Proceedings} +% +%Essentially equivalent to |@BOOK|. One difference is the possible presence of |organization| (which only gets typeset if |editor| is missing); another is that there is no |edition|. +% +%\subsubsection{Booklet} +% +%This entry type behaves exactly as |@BOOK|. +% +%\subsubsection{Inproceedings} +% +%|@INPROCEEDINGS| is to |@PROCEEDINGS| what |@INCOLLECTION| is to |@BOOK|: there is no |edition|, and |organization| can replace |editor|. Otherwise the behavior is similar. +% +%\subsection{Modifying the bibliography style}\label{bsts} +% +%This section makes explicit the conventions that a \textsc{Bib}\TeX\ style (a \texttt{bst} file) should follow in order to support and be supported by |opcit|. +% +%The basic form of a |opcit|-supported |\bibitem| is: % %|\bibitem{|\meta{label}|}| % -%|\biblastnames{|\meta{last name(s)}|}|\meta{\dots additional declarations\dots} +%|\biblastnames{|\meta{last name(s)}|}| +% +%\meta{\dots additional declarations\dots} % -%|\opcitstart |\meta{Name(s)}|\bibpunctuation \newblock| +%|\opcitstart |\meta{name(s)}|\bibpunctuation \newblock| % -%\meta{remaining info}|\opcitends| +%\meta{remaining info} +% +%|\opcitends| % %\smallskip -%As long as this scheme is strictly followed, |opcit| will run.\footnote{This can be easily achieved in the style by suitably modifying the |bibstart| and |fin.entry| functions.} Other conventions are needed but not required, for example that instead of periods or commas, the style appends |\bibpunctuation| commands (this command is converted into commas in the footnotes, into periods in the references list). Similarly, |\bibIn| will decide if the particle `in' for \texttt{@INCOLLECTION} and similar entries is capitalized or not, and |\bibparenthesis| does or does not parenthesize its argument according to the situation. +%As long as this scheme is strictly followed, |opcit| will run.\footnote{This can be easily achieved in the style by suitably modifying the |{bibstart}| and |{fin.entry}| functions.} % -%\DescribeMacro{\sameauthors} -% If the style substitutes a line for the author(s)' name(s), |opcit| needs a way to know the `real' author. This is achieved by the style not typesetting the line by itslef, but rather appending a |\sameauthors| command, which is defined by |opcit| as a 23pt-rule for the references list. +%The style has therefore to have a method of finding out only the last name(s) of author/editor, to be passed to |opcit| as the argument to |\biblastname|. This is independent from the actual formatting of the names (that happens right before the first |\bibpunctuation|). % -%Also, |opcit| requires the style to provide the author's last name as the argument to the command |\biblastnames|. Another command of this kind is |\hereafter|, which gives as its argument the abbreviation that the user chose in the |hereafter| field. This kind of commands is what is represented by \meta{\dots additional declarations\dots}. +%Other conventions are probably always needed, but not syntactically required: +%\begin{itemize} +%\item Instead of periods or commas, the style should append |\bibpunctuation| commands (this command is converted into commas in the footnotes, into periods in the references list). +%\item |\bibcase| commands should be added at strategic points (the particle `in' for \texttt{@INCOLLECTION}s, and in general everything that comes after a |\bibpunctuation|). +%\item \DescribeMacro{\sameauthors}If the style substitutes a line for repeated author(s)' name(s), |opcit| needs a way to know the `real' author. This is achieved by the style not typesetting the line by itself, but rather appending a |\sameauthors| command (defined by |opcit| as a rule of length |\sameauthorsrule|). +%\item \DescribeMacro{\bibhereafter}The style should provide for handling of the |hereafter| field: its contents (if any) should be passed on to |opcit| as the argument to |\bibhereafter|, as part of the \meta{additional declarations}. +%\end{itemize} % -%\DescribeMacro{\newBibCommand} The `communication commands' mentioned are those that I have already implemented in |opcit.bst|. Others can be created with the macro +%Another kind of tools are those that are not hard-wired in |opcit|, but whose use is more or less mandatory with footnote-style referencing. For example, it is customary that the author's name appears, in the footnotes, as first-last name (`Ernest~Gellner'), and as last-first (`Gellner, Ernest') in the final list. This is more a feature of the |bst| than of |opcit| itself, so it is supposed to be implemented there. As a result, it should be implemented in any \textsc{Bib}\TeX\ intended for use with |opcit|. % -%|\newBibCommand{|\meta{command}|}{|\meta{footnote-style}|{|\meta{list-style}|}| +%This is done by making the |bst| itself define and use its own commands, advisably at the beginning of the |bbl| file, usually in the |{begin.bib}| function. % -%This macro is used in |opcit.sty| to define |\bibpunctuation|, |\bibIn| and |\bibparenthesis|. As a complementary example, let's suppose the style will support videocassettes. The particle `videocassette' is to be appended at the end of the item. In a footnote, it comes after a comma (the current meaning of |\bibpunctuation|), but in the references list it comes after a period. The command +%Typically, these definitions will make use of |opcit|'s \DescribeMacro{\newBibCommand}|\newBibCommand|: % -%|\newBibCommand{\videocassette}{(videocassette)}{Videocassette.}| +%|\newBibCommand{|\meta{command name}|}{|\meta{footnote-style}|{|\meta{list-style}|}| % -%\noindent will manage this properly. If a new communication command needs arguments, the |[|$n$|]| part has to be inside the first argument of |\newBibCommand| (see the definition of |\bibparenthesis| below, code line~21). +%This means that the new command will expand to the first meaning when encountered in footnotes, and to the second when in the final list. Use of arguments with |\newBibCommand| is surprisingly intuitive, and is illustrated in the items below. % -%When to issue the |\newBibCommand|'s? A good place to do it is the style itself, when it appends the |\begin{thebibliography}| command (usually the |begin.bib| function). Since |\newBibCommand| does not typeset anything, it causes no problem either in the preamble nor at the start of the list. +%|opcit.bst| defines five tools in this way: +%\begin{itemize} +%\item|\bibparenthesis| should parenthesize its argument when in footnotes, but typeset it (after a period) in the final list. This is used for the publisher and the year of books: `(London: Penguin, 1989)' but `. London: Penguin, 1989'. This command is defined with % +%\hfill|\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}|. +% +%Later, the |{make.address.publisher.year}| function of the |bst| makes use of this command. +%\item |\newBibCommand{\SwapNames[2]}{#1 #2}{#2, #1}| implements the ordering of names. The author/editor name then is issued as, for example, |\SwapNames{Ernest}{Gellner}|. +%\item |\bibincite| and |\bibincitestar| are the commands used by the |bst| file to implement cross references between entries. In their definition, they use internal |opcit| commands. I would recommend to copy them from |opcit.bst|, and in any case simply to \emph{add} stuff to them. Leave the |\recover@last| alone, unless you know what you are doing! +% +%\item |\GobbleOrNot| is used to gobble (or not) the punctuation mark when a period ends the previous text. For example, the middle initial in `Donald E. Knuth' would clash with |\bibpunctuation| in the final reference list: `Knuth, Donald~E..\ \emph{The \TeX book}.' But the period has to be included in the footnote (Donald E. Knuth, \emph{The \TeX book}'). Similarly, the particle `Ph.\,D.\ diss.' has to gobble the following period in the final list, but not the closing parenthesis in the footnotes. Thus, |\GobbleOrNot| is defined as +% +%\hfill|\newBibCommand{\GobbleOrNot}{\relax}{\newblock\@gobble}| +%\end{itemize} +% +%\newcommand\bibparenthesis[1]{. \newblock #1} +%\newcommand\bibincite[2]{#2} +%\newcommand\bibincitestar[2]{#2} +%\newcommand\SwapNames[2]{#2, #1} +%\newcommand\GobbleOrNot{\newblock\@gobble} +%\def\biblastnames#1{}\let\opcitstart\relax\def\bibpunctuation{.}\def\bibcase#1{\uppercase{#1}}\let\toomit\relax +%\makeatletter +%\renewenvironment{thebibliography}[1] +% {\section*{The final list (examples)} +% \list{}% +% {\setlength\labelwidth{\z@}% +% \leftmargin\bibindent +% \itemindent -\bibindent +% \parsep \z@ +% \@openbib@code +% \usecounter{enumiv}% +% \let\p@enumiv\@empty +% \renewcommand\theenumiv{\@arabic\c@enumiv}}% +% \sloppy +% \clubpenalty4000 +% \@clubpenalty \clubpenalty +% \widowpenalty4000% +% \sfcode`\.\@m} +% {\def\@noitemerr +% {\@latex@warning{Empty `thebibliography' environment}}% +% \endlist} +%\makeatother +%\let\opcitend\relax\def\sameauthors{\rule{23pt}{0.4pt}} +%\begin{thebibliography}{}\label{examples} +% +%\bibitem{attemborough} +%\biblastnames{Attenborough} +%\opcitstart \SwapNames{David}{Attenborough}\bibpunctuation +%\newblock ``The Infinite Variety\bibpunctuation'' +%\newblock \bibcase Episode 1 of {\em Life on Earth\toomit{ \upshape +% (videorecording)}}\bibparenthesis{BBC, 1979}\opcitend +% +%\bibitem{berlinsky} +%\biblastnames{Berlinsky} +%\opcitstart \SwapNames{David}{Berlinsky}\bibpunctuation +%\newblock {\em Newton's Gift\toomit{: How Sir Isaac Newton Unlocked the System +% of the World}}\bibparenthesis{New~York and London: Simon {\&} Schuster, +% 2000}\opcitend +% +%\bibitem{stuff} +%\biblastnames{Gellner} +%\opcitstart \SwapNames{Ernest}{Gellner}\bibpunctuation +%\newblock ``The Stuff of Change\bibpunctuation'' +%\newblock \bibcase chapter 6\toomit[pages]{ (pages 126--146)} of +% \bibincitestar{tac}{{\em Thought and Change}}\opcitend +% +%\bibitem{tac} +%\biblastnames{Gellner} +%\opcitstart \sameauthors\bibpunctuation +%\newblock {\em Thought and Change}\toomit[number]{\bibpunctuation\bibcase +% \bibcase number~1 in ``The Nature of Human Society'' Series (ed.\ Julian +% Pitt-Rivers and Ernest Gellner) Press}\bibparenthesis{Chicago: University of +% Chicago, 1964}\opcitend +% +%\bibitem{laudan} +%\biblastnames{Laudan} +%\opcitstart \SwapNames{Larry}{Laudan}\bibpunctuation +%\newblock ``Explaining the Success of Science\toomit{: Beyond Epistemic Realism +% and Relativism}\bibpunctuation'' +%\newblock \bibcase in {Alfred~I. Tauber (ed.), {\em Science and the Quest for +% Reality}\bibparenthesis{London: MacMillan Press Ltd., +% 1997}}\toomit[pages]{\bibcase : 137--161}\opcitend +% +%\bibitem{nattiez} +%\biblastnames{Nattiez and Schulte-Technoff} +%\opcitstart \SwapNames{{Jean-Jacques}}{Nattiez} and Isabelle +% Schulte-Technoff\bibpunctuation +%\newblock ``L'etnomusicologia: strutturalismo o culturalismo?\toomit{ +% Intervista con Jean-Jacques Nattiez di Isabelle +% Schulte-Technoff}\bibpunctuation'' +%\newblock {\em Musica/Realt{\`a}} 61 (\toomit[month]{March +% }2000)\toomit[pages]{\bibcase : 109--131}\opcitend +% +%\bibitem{weber} +%\biblastnames{Saslaw} +%\opcitstart \SwapNames{Janna~K.}{Saslaw}\GobbleOrNot\bibpunctuation +%\newblock ``Weber, Gottfried\bibpunctuation'' +%\newblock \bibcase in \bibincite{grove}{L. Macy (ed.), {\em Grove Music +% Online}\bibpunctuation +%\newblock \texttt{http://www.grovemusic.com/} (accessed October 5, 2005)}\opcitend +% +%\bibitem{saslaw} +%\biblastnames{Saslaw} +%\opcitstart \sameauthors\bibpunctuation +%\newblock {\em Gottfried Weber and the Concept of +% Mehrdeutigkeit}\bibparenthesis{Ph.\,D.\ diss\GobbleOrNot.}\bibpunctuation +%\newblock Columbia University\bibpunctuation +%\newblock 1992\opcitend +% +%\bibitem{sheldon} +%\biblastnames{Sheldon} +%\opcitstart \SwapNames{David~A.}{Sheldon}\GobbleOrNot\bibpunctuation +%\newblock ``The Galant Style Revisited and Re-Evaluated\bibpunctuation'' +%\newblock {\em Acta Musicologica} 47/2 (1975)\toomit[pages]{\bibcase : +% 240--70}\opcitend +% +%\bibitem{walker} +%\biblastnames{Walker} +%\opcitstart \SwapNames{Alan}{Walker}\bibpunctuation +%\newblock {\em The Final Years +% 1861--1886}\toomit[volume]{\bibpunctuation\bibcase \bibcase volume~3 of {\em +% Franz Liszt}}\bibparenthesis{New York: Alfred A. Knopf, 1996}\opcitend +% +%\end{thebibliography} +% +%\clearpage %\section{Implementation} % +%\subsection*{Identification} % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{opcit}[2002/12/25 Footnote references (Federico Garcia)] +\ProvidesPackage{opcit}[2006/09/20 Footnote references (Federico Garcia) Version 2] \RequirePackage{xspace} -\newcommand{\opcit@bst}{opcit} -\DeclareOption*{\PackageInfo{opcit}{% - `\CurrentOption' used as bibliography style}% - \let\opcit@bst\CurrentOption} -\ProcessOptions % \end{macrocode} % -%\subsection{Basic idea} -% -%The basic idea behind the working of |opcit| is that the \texttt{bbl} file produced by \textsc{Bib}\TeX\ is read at the beginning of the document. Each reference item starts in this file with the |\bibitem| command (used in the |thebibliography| environment to crete the different items). But when reading the file at the beginning, |\bibitem| is redefined so that, instead of appending an item to a list, it defines the control sequences that will produce the footnotes. -% -%Thus, for each work |\cite|'d there will be a set of newly defined control sequences, identified by the label by which the user refers to it in |\cite| commands. For example, there will be a set for the label \texttt{texbook} used above: the commands |\texbook|, |\texbook@star|, |\texbook@author|, and so on. These commands (of whose existence the user does not need to know) contain the actual text to be written in the footnotes. -% -%The |\cite| command itself is redefined here to execute the appropriate control sequence each time. In this way, |\cite{texbook}| means basically |\footnote{\texbook}|. But it also redefines |\texbook| so that the next time it is used it will expand to `Knuth, \emph{Op.~Cit.}' -% -%\subsection{The macros} -%Three conditionals are needed: one to check if there is a \texttt{bbl} file to read from; another to check if |\cite| occurs inside or outside the argument of |\footnote|; and one more to check whether the last character was a period. The rule for repeated authors is also set here to 23pt. +%\subsection*{Declarations} % \begin{macrocode} \newif\ifopcit@bbl\opcit@bblfalse \newif\ifopcit@footnote\opcit@footnotefalse \newif\ifperi@d\peri@dfalse +\newif\ifhyper@opcit +\newif\if@omitting +\newif\if@idem +\newif\ifcheck@idem +\newif\ifcheck@@idem +\newif\if@opcit +\newif\ifcustom@bst +\newcount\@lastcite \newlength{\sameauthorsrule}\setlength{\sameauthorsrule}{23pt} +\newtoks\opcit@redefs +\newtoks\opcit@defs +\newcommand*{\last@cited}{)OpcitFirst(} +\newcommand*{\opcittext}{\textit{op.\,cit.}} +\newcommand*{\idemtext}{\textit{Idem}} +\newcommand*{\sameauthors}{\rule{\sameauthorsrule}{.4pt}} +\newcommand*\opcitwarning[1]{\PackageWarning{noopcit option is called for, + but `#1' has no hereafter.}} +\newcommand*\opcit@noreferror[1]{\PackageError{key `#1' has not been cited.} + {\string\bibref can be used only after the first citation of a work. + (You might also have mistyped the key.) Go on, but there won't be a + cross reference here.}\textbf{??}} +\let\@quoteornot\relax % \end{macrocode} % -%The following section sets up the `communication commands.' Note that the commands that add a punctuation mark do so only if the last character was not period, question, or exclamation marks (all of which have a |\sfcode| different from other characters). Within the |thebibliography| environment, however, the period is set to |\sfcode| of 1000 (as letters), so it is not good for the test. |\last@cited| is initialized to a value unlikely to occur. +%\subsection*{Options} +% +% \begin{macrocode} +\DeclareOption{hyperref}{\hyper@opcittrue} +\DeclareOption{nohyperref}{\hyper@opcitfalse} +\DeclareOption{omitting}{\@omittingtrue} +\DeclareOption{noomitting}{\@omittingfalse} +\DeclareOption{noidem}{\@idemfalse} +\DeclareOption{idem}{\@idemtrue} +\DeclareOption{checkidem}{\check@idemtrue} +\DeclareOption{nocheckidem}{\check@idemfalse} +\DeclareOption{opcit}{\@opcittrue} +\DeclareOption{noopcit}{\@opcitfalse} +\DeclareOption{nocustombst}{\newcommand\opcit@bst{\bibliographystyle{opcit}}} +\DeclareOption{custombst}{\let\opcit@bst\relax} +\@ifpackageloaded{hyperref} + {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit,hyperref}} + {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit}} +\ProcessOptions +\ifhyper@opcit\RequirePackage{hyperref}\fi +\opcit@bst +% \end{macrocode} +% +%\subsection{The macros} +% +%The basic idea behind the working of |opcit| is that the \texttt{bbl} file produced by \textsc{Bib}\TeX\ is read at the beginning of the document, not to produce the list of references, but to define the (internal) commands that will expand into the footnote references. For example, the entry \texttt{texbook} defines the commands |\@texbook|, |\texbook@star|, |\texbook@author|, and so on. These commands contain the actual text to be written in the footnotes. +% +%The |\cite| command itself is redefined, based on circumstances, to execute the appropriate control sequence each time. At the beginning, |\cite{texbook}| means basically |\footnote{\@texbook}|. But it also redefines |\@texbook| so that the next time it is used it will expand to `Knuth, \emph{op.~cit.}' +% +%Before reading the |bbl| file, however, we have to define the `communication commands' that enable the latter to pass information on to |opcit|. +% +%\subsubsection{Communication commands} +%Punctuation marks are to be added only if the last character was not a period, a question or an exclamation mark (which have a |\sfcode| of 2000). % % \begin{macrocode} -\newtoks\opcit@redefs \newcommand{\newBibCommand}[3]{% \newcommand#1{#2}% \opcit@redefs\expandafter{\the\opcit@redefs% \renewcommand#1{#3}}} -\newcommand{\opcitstart}{\relax} -\newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else.\fi} -\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1} -\newBibCommand{\bibIn}{in}{In} -\newBibCommand{\bibpunctuation}{% - \ifnum\spacefactor=\sfcode`.\else,\fi\xspace}{% - \ifnum\spacefactor=\sfcode`?\else.\fi\xspace} -\newcommand{\sameauthors}{\rule{\sameauthorsrule}{.4pt}} +\let\opcitstart\relax +\newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else\unskip.\fi} +\newBibCommand{\bibpunctuation}{,\xspace}{% + \ifnum\spacefactor=\sfcode`?\else\unskip.\fi\xspace} \newBibCommand{\biblastnames[1]}{% \global\@namedef{\@curr@bibitem @authors}{#1}}{\relax} \newBibCommand{\bibhereafter[1]}{% - \global\@namedef{\@curr@bibitem @hereafter}{#1}}{\relax} -\newcommand{\last@cited}{)OpcitFirst(} -\newcommand{\opcittext}{Op.~Cit.} -\newcommand{\idemtext}{Idem} + \global\expandafter\edef\csname\@curr@bibitem @hereafter\endcsname{% + \ifhyper@opcit + \noexpand\hyperlink{\@curr@bibitem @key}{#1}\else#1\fi}}{\relax} +\newBibCommand{\bibcase[1]}{\lowercase{#1}}{\uppercase{#1}} +\newBibCommand\QuoteOrNot{\gdef\@quoteornot{''\global\let\@quoteornot\relax}}{\relax} % \end{macrocode} -%After having set up the communication, the bibliography style is called, and the \texttt{bbl} file is read, if exists. This is done within a group, for |thebibliography| and |\bibitem| are redefined (the former as nothing). Recall that, by now, the communication commands have their `footnote meaning,' the first part of their definition (the second part has been stored in |\opcit@redefs|, to be redeemed later on). % -%In |\bibitem|, |#1| is the label for the |\cite| command; |#2| is a series of declarations written out to the |bbl| file by the \textsc{Bib}\TeX\ style (one of them, required, is the command |\biblastnames|, whose argument contains only the last name(s) of the author(s); another is |\hereafter|, if any). |#3| is the full author(s)' name(s), that appears the first time the work is |\cite|'d. Finally, |#4| is the rest of the information for the entry. +%\subsubsection{Omitting mechanism} +% +%Here we use a feature of |\@nameuse|: an undefined command called by this method will not be an error, but a |\relax|. Thus, when a |\with{|\meta{field}|}| redefines |\omit@field| to be |\@gobble|, the result of |\toomit| (in the footnotes) will be either |\@gobble\@gobble| or |\relax\@gobble|. In either case, |\with| has to take care of re-omitting (adding its argument to a list, eventually gone over by |\finalize@cite|). +% \begin{macrocode} +\if@omitting + \newBibCommand{\toomit[2][omitted]}{% + \@nameuse{omit@#1}\@gobble{#2}}{#2}% + \newcommand\with[1]{% + \global\expandafter\let\csname omit@#1\endcsname\@gobble + \edef\@reomit{\@reomit,#1}} + \newcommand\@reomit{omitted}% +\else + \newcommand\toomit[2][omitted]{#2} + \let\with\@gobble +\fi +% \end{macrocode} +% +%\subsubsection{Reading the \texttt{bbl}} +% +%After having set up the communication, the \texttt{bbl} file is read (if it exists). This is done within a group, for |thebibliography| and |\bibitem| are redefined (the former as nothing). At the moment, the communication commands have their `footnote meaning,' the first part of their definition (the second part has been stored in |\opcit@redefs|, to be redeemed later on). +% +%In |\bibitem|, |#1| is the label for the |\cite| command; |#2| is a series of declarations written out to the |bbl| file by the \textsc{Bib}\TeX\ style (one of them, required, is the command |\biblastnames|, whose argument contains only the last name(s) of the author(s)). |#3| is the full author(s)' name(s), that appears the first time the work is |\cite|'d. Finally, |#4| is the rest of the information for the entry. % % \begin{macrocode} -\bibliographystyle{\opcit@bst} \bgroup + \renewcommand{\newBibCommand}[3]{% + \newcommand#1{#2}% + \global\opcit@defs\expandafter{\the\opcit@defs + \newBibCommand{#1}{#2}{#3}}} \renewenvironment{thebibliography}[1]{\relax}{\relax} - \def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{% + \def\toomit{\noexpand\toomit}% + \def\QuoteOrNot{\noexpand\QuoteOrNot}% + \long\def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{% \ifx#3\sameauthors\else\def\@lastauthors{#3}\fi \global\expandafter\edef\csname#1@author\endcsname{\@lastauthors}% \global\def\@curr@bibitem{#1}% - \global\expandafter\def\csname#1\endcsname{\@nameuse{#1@author}, #4}% - \global\@namedef{#1@star}{#4}% - \bibhereafter{\opcittext}% + \global\expandafter\edef\csname #1@first\endcsname{% + \noexpand\opcit@noreferror{#1}}% + \global\@namedef{#1@star}{% + \global\expandafter\edef\csname #1@first\endcsname{\thefootnote}% + \ifhyper@opcit\hypertarget{#1@key}{}\fi + #4}% + \global\def\hereafter{\@nameuse{#1@hereafter}}% + \global\expandafter\def\csname @#1\endcsname{% + \@nameuse{#1@author}, \@nameuse{#1@star}}% + \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{#1}\fi}% #2} \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}% {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{% - No information found about bibliographical references.}} + No \jobname.bbl file. There will be no footnote references}} \egroup +\the\opcit@defs +\ifopcit@bbl + \renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}% +\fi % \end{macrocode} % -% The effect of all this, if |\jobname.bbl| exists, is that for each entry \texttt{foo} the following commands are defined: |\foo@author| as \meta{author} (avoiding the rule for a repeated author); |\foo|, as `|\foo@author|, \meta{info}'; and |\foo@star| as `\meta{info}'. Also, |\bibhereafter| is applied, so the command |\foo@hereafter| is defined as |\opcittext| (=`Op.~Cit.'). If the user provided a value for the |hereafter| field, the \textsc{Bib}\TeX\ style will issue a |\bibhereafter| command as part of \meta{\dots additional declarations\dots}, which will override the one just applied when |#2| is executed. +%The last construction ensures that if a |bbl| was not found, \LaTeX\ will still understand |\cite|. +% +%This reading of the |bbl| happens at the beginning of the job, but it can also happen by the user's request (to reset the cites to the full information), with |\resetcites|. Here goes that. I can't remember why exactly---it has something to do with argument expansion---but this cannot be done by defining a common command for both macros. % -%And now for the |\cite| and |\cite*| commands. They check if they are in a footnote (note that this requires |\interfootnotelinepenalty| to be different from |\interlinepenalty| in the main text); if not, they call a |\footnote|, and append a period at the end, if necessary. After that, they execute one of the commands defined by |\bibitem| above. Then they call the redefinition routine |\renew@cites|, which will redefine those very commands to produce different things the next time the work is |\cite|'d. They are redefined only if there was a \texttt{bbl} from which those commands were initially defined. % \begin{macrocode} -\ifopcit@bbl -\renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}% -\newcommand{\opcit@cite}[2][.]{\nocite{#2}% - \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue% - \else\opcit@footnotefalse\expandafter\footnote\fi% - {\@nameuse{#2}\ifx#1.\check@for@period{\@nameuse{#2}}% - \else\check@for@period{#1}% - {, #1}\fi% - \ifopcit@footnote\peri@dtrue\fi% - \ifperi@d\else.\fi}% - \renew@cites{#2}} -\newcommand{\opcit@cite@star}[2][.]{\nocite{#2}% - \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue% - \else\opcit@footnotefalse\expandafter\footnote\fi% - {\@nameuse{#2star}\ifx#1.\check@for@period{\@nameuse{#2}}% - \else\check@for@period{#1}% - {, #1}\fi% - \ifopcit@footnote\peri@dtrue\fi% - \ifperi@d\else.\fi}% - \renew@cites{#2}} -\fi +\newcommand*\resetcites{% + \bgroup + \renewcommand{\newBibCommand}[3]{% + \newcommand##1{##2}% + \global\opcit@defs\expandafter{\the\opcit@defs + \newBibCommand{##1}{##2}{##3}}} + \renewenvironment{thebibliography}[1]{\relax}{\relax} + \def\toomit{\noexpand\toomit}% + \def\QuoteOrNot{\noexpand\QuoteOrNot}% + \long\def\bibitem##1##2\opcitstart ##3\bibpunctuation \newblock##4\opcitend{% + \ifx##3\sameauthors\else\def\@lastauthors{##3}\fi + \global\expandafter\edef\csname##1@author\endcsname{\@lastauthors}% + \global\def\@curr@bibitem{##1}% + \global\expandafter\edef\csname ##1@first\endcsname{% + \noexpand\opcit@noreferror{##1}}% + \global\@namedef{##1@star}{% + \global\expandafter\edef\csname ##1@first\endcsname{\thefootnote}% + \ifhyper@opcit\hypertarget{##1@key}{}\fi + ##4}% + \global\def\hereafter{\@nameuse{##1@hereafter}}% + \global\expandafter\def\csname @##1\endcsname{% + \@nameuse{##1@author}, \@nameuse{##1@star}}% + \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{##1}\fi}% + ##2} + \let\newcommand\renewcommand + \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}% + {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{% + No \jobname.bbl file. There will be no footnote references}} + \egroup} +% \end{macrocode} +% +%\subsubsection{The \cs{cite}s} +% +%When |opcit| reads the |bbl| file, a series of commands are defined for each bibliographical entry. The most important are (for the entry |foo|): +% +%\begin{itemize} +%\item|\foo@author| has the full author name(s). It is used only the first time |foo| is |\cite|'d. +%\item|\foo@authors| contains the last name(s), to be used in post-citations. +%\item|\foo@star| contains the rest of the information for the entry. (The name of this command responds to |\cite*| being a |\cite| without author.) +%\item|\foo@hereafter| equals |\opcittext| by default, but is changed by a |\bibhereafter| in the |bbl| file. +%\item|\@foo| expands initially to |\foo@author, \foo@star|---i.e., authors (full name) followed by info. +%\end{itemize} +% +%This information is used by |\cite| and |\cite*| (redefined earlier as |\opcit@cite|). Before expanding into the actual information, they check if they appear in a footnote.\footnote{This requires the document class to set \cs{interfootnotelinepenalty} different from \cs{interlinepenalty}.} If not, they call a |\footnote|, appending a period at the end if necessary. Then, |\cite| calls |\@foo|, while |\cite*| calls |\foo@star|. +% +%Then they call the redefinition routine |\renew@cites| (section~\ref{renew}). The main task of this latter is to substitute |\foo@authors| (only last names) for the original |\foo@author| (full names), and redefine |\foo@star| (which was the rest of the information) as |\foo@hereafter| (which is either |\opcittext| or the user's |hereafter| field). (However, this simple main task is obscured in the code by the \emph{Idem} mechanism.) +% +% \begin{macrocode} +\newcommand{\opcit@cite}[2][\@empty]{\nocite{#2}% + \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue + \else\opcit@footnotefalse\expandafter\footnote\fi + {\@nameuse{@#2}% + \check@for@period{\@nameuse{@#2}}% + \finalize@cite{#1}{#2}}} +\newcommand{\opcit@cite@star}[2][\@empty]{\nocite{#2}% + \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue + \else\opcit@footnotefalse\expandafter\footnote\fi + {\@nameuse{#2@star}% + \check@for@period{\@nameuse{#2@star}}% + \finalize@cite{#1}{#2}}} +\newcommand\finalize@cite[2]{% + \global\@lastcite=\c@footnote\relax + \ifx\@empty#1\else + \ifcheck@@idem + \check@for@period{\idemtext}% + \def\this@opt{#1}% + \ifx\last@opt\this@opt\else + \check@for@period{#1},\@quoteornot\ #1% + \fi + \else\check@for@period{#1},\@quoteornot\ #1% + \fi + \fi + \ifopcit@footnote\peri@dtrue\fi + \ifperi@d\else.\@quoteornot\fi + \global\def\last@opt{#1}% + \check@@idemfalse + \if@omitting + \@for\@tempcsa :=\@reomit \do + {\global\expandafter\let\csname omit@\@tempcsa\endcsname\relax}% + \global\def\@reomit{omitted}% + \fi + \renew@cites{#2}% + } % \end{macrocode} % -% The redefinition routine is in charge of catching two identical |\cite|'s in a row, to produce \emph{Idem} (or the current value of |\idemtext|) in the second. Also, after the first time a work is |\cite|'d, it redefines its commands to produce only the author(s)' last name(s) followed by the \texttt{hereafter} (which is either \emph{Op.~Cit.} or the \texttt{hereafter} field in the |bib| file). After that, |\check@for@period| is defined. +%The first lines of |\finalize@cite| are part of the mechanism to catch identical optional arguments to two |\cites| in a row. It is a function whose methods are scattered here and there in the code, but it is simple enough if anyone ever needs to follow it. +% +%\subsubsection{Redefinition routine}\label{renew} +% +% The redefinition routine is in charge of catching two identical |\cite|'s in a row, in which case it typesets |\idemtext|. But the main task is to reduce |\foo@star| (the information other than author of the entry |foo|) to |\foo@hereafter|. % % \begin{macrocode} \newcommand{\renew@cites}[1]{% - \global\expandafter\edef\csname\last@cited\endcsname{% - \@nameuse{\last@cited @authors},% - ~{\noexpand\em\@nameuse{\last@cited @hereafter}}}% - \global\expandafter\edef\csname\last@cited star\endcsname{% - {\noexpand\em\@nameuse{\last@cited @hereafter}}}% + \recover@last% \global\def\last@cited{#1}% - \global\@namedef{#1}{{\em\idemtext}}% - \global\@namedef{#1star}{{\em\@nameuse{#1@hereafter}}}% - \global\def\hereafter{\@nameuse{#1@hereafter}}} -\def\check@for@period#1{{\normalsfcodes\setbox0\hbox{#1% - \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else% - \global\peri@dfalse\fi}}} + \cited{#1}% + \ifopcit@footnote\else\if@idem + \global\@namedef{@#1}{\@idem{@#1}}% + \global\@namedef{#1@star}{\@idem{@#1}}% + \fi\fi + \global\def\hereafter{\textit{\@nameuse{#1@hereafter}}}}% +\newcommand*\cited[1]{\@for\@tempcsa :=#1 \do{% + \global\@namedef{@#1}{\@nameuse{#1@authors},~\@nameuse{#1@hereafter}}% + \global\@namedef{#1@star}{\@nameuse{#1@hereafter}}}}% +\newcommand\recover@last{% + \global\expandafter\edef\csname @\last@cited\endcsname{% + \noexpand\@nameuse{\last@cited @authors},% + ~{\noexpand\@nameuse{\last@cited @hereafter}}}% + \global\expandafter\edef\csname\last@cited @star\endcsname{% + {\noexpand\@nameuse{\last@cited @hereafter}}}% + } +\newcommand\@idem[1]{\advance\@lastcite1\relax + \ifnum\@lastcite=\c@footnote + \idemtext\ifcheck@idem\check@@idemtrue\fi + \else + \check@@idemfalse\recover@last\@nameuse{#1}% + \fi} % \end{macrocode} % -%Finally, the redefinitions of the communication commands have to be executed before the references list is compiled. |thebibliography| environment is formatted to produce no labels. +%\subsection*{Additional functions and user commands} % % \begin{macrocode} +\def\check@for@period#1{{\normalsfcodes\setbox0\hbox{#1% + \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else + \global\peri@dfalse\fi}}} +\ifhyper@opcit + \newcommand*\bibref[1]{\hyperlink{#1@key}{\@nameuse{#1@first}}} +\else + \newcommand*\bibref[1]{\@nameuse{#1@first}} +\fi +\newcommand\nobibliography[1]{\if@filesw + \immediate\write\@auxout{\string\bibdata{#1}}\fi + \if@omitting\PackageWarningNoLine{opcit}{No final references list, + there might be information within \string\toomit\space commands that will be lost}\fi} \let\opcit@bibliography\bibliography -\renewcommand{\bibliography}{\the\opcit@redefs\opcit@bibliography} +\renewcommand{\bibliography}{% + \renewcommand\newBibCommand[3]{\relax}% + \the\opcit@redefs\opcit@bibliography} \newcommand{\thebib@renew}{} -\@ifclassloaded{article}{% +\@ifundefined{chapter}{% \renewcommand{\thebib@renew}{\section*{\refname}\@mkboth{\refname}{\refname}}}{% \renewcommand{\thebib@renew}{\chapter*{\bibname}\@mkboth{\bibname}{\bibname}}}% \renewenvironment{thebibliography}[1] @@ -282,13 +933,11 @@ {\def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist} -%</package> % \end{macrocode} +%</package> +%\section{The \texttt{opcit.bst} bibliography style} % -%\subsection{The \texttt{opcit.bst} bibliography style} -% -%This style was prepared adapting the \texttt{plain.bst} file, crudely simplifying it, and adding new functions for communication commands. -% +%I have had no time to fully document this bibliography style, or even to purify it and make it most economical\dots % \begin{macrocode} %<*bst> ENTRY @@ -298,6 +947,7 @@ ENTRY chapter edition editor + hereafter howpublished institution journal @@ -312,79 +962,24 @@ ENTRY series title type + url + urldate volume year - hereafter } {} { label } -INTEGERS { output.state before.all mid.sentence after.sentence after.block quoted.state } +INTEGERS { output.state before.all mid.sentence after.sentence + after.block quoted.state period.state } -STRINGS { s t last.authors } +STRINGS { s t last.authors quotes } FUNCTION {init.state.consts} -{ #0 'before.all := - #1 'mid.sentence := - #2 'after.sentence := - #3 'after.block := - #0 'quoted.state := +{ #0 'period.state := + #0 'before.all := "" 'last.authors := -} -% \end{macrocode} -% -% The string \texttt{last.authors} is used to check for works by the same author, to replace the name by the |\sameauthors| command. In the following section, defining basic functions, the communication commands are implemented. -% -% \begin{macrocode} -FUNCTION {output.nonnull} -{ 's := - output.state mid.sentence = - { " " * write$ } - { output.state after.block = - { "\bibpunctuation" * - quoted.state #1 = - { #2 'quoted.state := } - { quoted.state #2 = - { "''" * #0 'quoted.state := } - 'skip$ - if$ - } - if$ - write$ - newline$ - "\newblock " write$ - } - { output.state before.all = - 'write$ - { "\bibpunctuation" * write$ } - if$ - } - if$ - mid.sentence 'output.state := - } - if$ - s -} - -FUNCTION {output} -{ duplicate$ empty$ - 'pop$ - 'output.nonnull - if$ -} - -FUNCTION {output.check} -{ 't := - duplicate$ empty$ - { pop$ "empty " t * " in " * cite$ * warning$ } - 'output.nonnull - if$ -} - - -FUNCTION {fin.entry} -{ "\opcitend%" * write$ - newline$ + "" 'quotes := } FUNCTION {new.block} @@ -393,11 +988,6 @@ FUNCTION {new.block} { after.block 'output.state := } if$ } -% \end{macrocode} -% -% Then some logical and general-purpose functions: -% -% \begin{macrocode} FUNCTION {not} { { #0 } { #1 } @@ -416,22 +1006,6 @@ FUNCTION {or} if$ } -FUNCTION {new.block.checka} -{ empty$ - 'skip$ - 'new.block - if$ -} - -FUNCTION {new.block.checkb} -{ empty$ - swap$ empty$ - and - 'skip$ - 'new.block - if$ -} - FUNCTION {field.or.null} { duplicate$ empty$ { pop$ "" } @@ -445,53 +1019,86 @@ FUNCTION {emphasize} { "{\em " swap$ * "}" * } if$ } -% \end{macrocode} -% -% The next formatting-functions are very similar (though not quite identical) to those in \texttt{plain.bst}: -% -% \begin{macrocode} INTEGERS { nameptr namesleft numnames } -FUNCTION {format.names} +FUNCTION{format.names} { 's := #1 'nameptr := s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } - { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + { s nameptr "{ff }{vv~}{ll}{,~jj}" format.name$ 't := nameptr #1 > - { namesleft #1 > - { ", " * t * } - { numnames #2 > - { "," * } - 'skip$ - if$ - t "others" = - { " et~al." * } - { " and " * t * } + { namesleft #1 > + { ", " * t * } + { numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.swap.names} +{ 's := + s num.names$ 'numnames := + "\SwapNames{" s #1 "{ff}" format.name$ + duplicate$ #-1 #1 substring$ + "." = + { #1 'period.state := } + 'skip$ + if$ + * "}{" * + s #1 "{vv~}{ll}" format.name$ * "}" * + s #1 "{, jj}" format.name$ * + numnames #3 > + { " et~al." * #1 'period.state := } + { numnames #1 > + { #2 'nameptr := + numnames #1 - 'namesleft := + { namesleft #0 > } + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + namesleft #1 > + { ", " * t * } + { " and " * t * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + 'skip$ if$ } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ + if$ } FUNCTION {format.authors} -{ author empty$ - { "" +{ author empty$ + { "" "" 'last.authors := } - { author last.authors = + { author format.names + last.authors = { "\sameauthors" } - { author format.names } + { before.all output.state = + { author format.swap.names } + { author format.names } + if$ } if$ - author 'last.authors := + author format.names 'last.authors := } if$ } @@ -499,21 +1106,27 @@ FUNCTION {format.authors} FUNCTION {format.editors} { editor empty$ { "" } - { editor format.names } + { before.all output.state = + { editor format.swap.names } + { editor format.names } + if$ + } if$ } FUNCTION {format.editors.ed} { editor empty$ { "" } - { editor format.names " (ed.)" * } - if$ -} - -FUNCTION {format.title} -{ title empty$ - { "" } - { title } + { before.all output.state = + { editor format.swap.names } + { editor format.names } + if$ + editor num.names$ #1 > + { " (eds.)" * } + { " (ed.)" * } + if$ + #0 'period.state := + } if$ } @@ -545,24 +1158,20 @@ FUNCTION {n.dashify} FUNCTION {format.date} { year empty$ { month empty$ - { "" } - { "there's a month but no year in " cite$ * warning$ - month - } + { "" } + { "there's a month but no year in " cite$ * warning$ + "\toomit[month]{" month * " }" * + } if$ } { month empty$ - 'year - { month " " * year * } + 'year + { "\toomit[month]{" month * " }" * year * } if$ } if$ } -FUNCTION {format.btitle} -{ title emphasize -} - FUNCTION {tie.or.space.connect} { duplicate$ text.length$ #3 < { "~" } @@ -571,22 +1180,21 @@ FUNCTION {tie.or.space.connect} swap$ * * } -FUNCTION {either.or.check} -{ empty$ - 'pop$ - { "can't use both " swap$ * " fields in " * cite$ * warning$ } - if$ +FUNCTION{either.warning} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ } - FUNCTION {format.bvolume} { volume empty$ { "" } - { "volume" volume tie.or.space.connect + { "\bibcase volume" volume tie.or.space.connect series empty$ - 'skip$ - { " of " * series emphasize * } + 'skip$ + { " of " * series emphasize * } if$ - "volume and number" number either.or.check + "volume and number" number either.warning } if$ } @@ -594,38 +1202,25 @@ FUNCTION {format.bvolume} FUNCTION {format.number.series} { volume empty$ { number empty$ - { series empty$ - { "" } - { ", series " * series * "" } - if$ } - { output.state mid.sentence = - { "number" } - { "Number" } - if$ - number tie.or.space.connect - series empty$ - { "there's a number but no series in " cite$ * warning$ } - { " in " * series * } - if$ - } + { series empty$ + { "" } + { ", series " * series * "" } + if$ + } + { "\bibcase number" + number tie.or.space.connect + series empty$ + { "there's a number but no series in " cite$ * warning$ } + { " in " * series * } + if$ + } if$ } { "" } if$ } -FUNCTION {format.edition} -{ edition empty$ - { "" } - { output.state mid.sentence = - { edition "l" change.case$ " edition" * } - { edition "t" change.case$ " edition" * } - if$ - } - if$ -} - -INTEGERS { multiresult } +INTEGERS { multiresult} FUNCTION {multi.page.check} { 't := @@ -651,8 +1246,8 @@ FUNCTION {format.pages} { pages empty$ { "" } { pages multi.page.check - { "pages" pages n.dashify tie.or.space.connect } - { "page" pages tie.or.space.connect } + { "\toomit[pages]{\bibcase " swap$ * pages n.dashify tie.or.space.connect "}" * } + { "\toomit[pages]{\bibcase " swap$ * pages tie.or.space.connect "}" * } if$ } if$ @@ -662,13 +1257,13 @@ FUNCTION {format.vol.num.date.pages} { volume empty$ 'skip$ { volume } - if$ - number empty$ + if$ + number empty$ 'skip$ - { "/" number * * + { "/" number * volume empty$ - { "there's a number but no volume in " cite$ * warning$ } - 'skip$ + { "there's a number but no volume in " cite$ * warning$ } + { * } if$ } if$ @@ -676,8 +1271,8 @@ FUNCTION {format.vol.num.date.pages} pages empty$ 'skip$ { duplicate$ empty$ - { pop$ format.pages } - { ": " * pages n.dashify * } + { pop$ "" format.pages * } + { ": " format.pages * } if$ } if$ @@ -685,100 +1280,86 @@ FUNCTION {format.vol.num.date.pages} FUNCTION {format.chapter.pages} { chapter empty$ - 'format.pages - { type empty$ - { "chapter" } - { type "l" change.case$ } + { pages empty$ + { "" } + { ": " format.pages } + if$ + } + { "\newblock\bibpunctuation " + type empty$ + { "\bibcase chapter" * } + { type "l" change.case$ * } if$ chapter tie.or.space.connect pages empty$ 'skip$ - { ", " * format.pages * } + { ", pages " * format.pages * } if$ } if$ } -FUNCTION {format.in.ed.booktitle} -{ booktitle empty$ - { "" } - { "\bibIn \ " booktitle emphasize * - editor empty$ - 'skip$ - { ", ed.~" * format.editors * } - if$ - } - if$ -} - -FUNCTION {empty.misc.check} -{ author empty$ title empty$ howpublished empty$ - month empty$ year empty$ note empty$ - and and and and and - key empty$ not and - { "all relevant fields are empty in " cite$ * warning$ } - 'skip$ - if$ -} -% \end{macrocode} -% -% The next three functions are new. \texttt{get.lastnames} is used to provide the argument for the |\biblastnames| command; \texttt{make.address.publisher.year} group those fields as the argument to |\bibparenthesis|; and \texttt{format.title.quoted} is used to wrap the quotes for |@ARTICLE| and |@INCOLLECTION| titles. The integer \texttt{quoted.state}, there modified, has an effect in the \texttt{output.nonnull} function above. -% -% \begin{macrocode} FUNCTION{get.lastnames} { 's := - #1 'nameptr := s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr "{vv~}{ll}" format.name$ 't := - nameptr #1 > - { namesleft #1 > - { ", " * t * } - { numnames #2 > - { "," * } - 'skip$ - if$ - t "others" = - { " et~al." * } - { " and " * t * } - if$ + s #1 "{vv~}{ll}" format.name$ + numnames #3 > + { " et~al." * } + { numnames #1 > + { #2 'nameptr := + numnames #1 - 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + namesleft #1 > + { ", " * t * } + { " and " * t * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ } + 'skip$ if$ } - 't - if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := - } - while$ + if$ } FUNCTION {make.address.publisher.year} -{ "\unskip\bibparenthesis{" +{ "" address empty$ 'skip$ - { address * ": " * } - if$ + { address * } + if$ publisher empty$ 'skip$ - { publisher * ", " * } + { address empty$ + { publisher * } + { ": " * publisher * } if$ - format.date * "}" * + } + if$ + format.date duplicate$ "" = + 'pop$ + { swap$ duplicate$ "" = + { * } + { swap$ ", " swap$ * * } + if$} + if$ + duplicate$ "" = + 'skip$ + { "\bibparenthesis{" swap$ * "}" * } + if$ } -FUNCTION{format.title.quoted} -{ title empty$ - { "" } - { "``" title * } - if$ - #1 'quoted.state := +FUNCTION {make.url} +{ "\url{" url * "}" * + urldate empty$ + { "there is url but no urldate in " cite$ * warning$ } + { " (accessed " * urldate * ")" * } + if$ } -% \end{macrocode} -% -% It is the |output.bibitem| function, which starts each |\bibitem|, that is in charge of fulfilling almost all the convention for this command (see section~\ref{bsts}), by inserting the key commands |\biblastname| and |\opcitstart| (|\opcitend| is added by |fin.entry|, above). The \texttt{hereafter} field is also handled here. -% -% \begin{macrocode} + FUNCTION {output.bibitem} { newline$ "\bibitem{" write$ @@ -787,91 +1368,295 @@ FUNCTION {output.bibitem} newline$ "\biblastnames{" write$ author empty$ - { editor get.lastnames } + { editor empty$ + { organization empty$ + { "no last names in " cite$ * warning$ } + { organization } + if$ + } + { editor get.lastnames + editor num.names$ #1 > + { " (eds.)" * } + { " (ed.)" * } + if$ + } + if$ + } { author get.lastnames } if$ - "}" * write$ - hereafter empty$ - 'skip$ - { "\bibhereafter{" write$ hereafter "}" * write$ } - if$ - newline$ - "\opcitstart " write$ + "}" * write$ before.all 'output.state := - #0 'quoted.state := } -% \end{macrocode} -% -% Then the four entry functions. Note that they do not reveal by themselves the |opcit| conventions. -% -% \begin{macrocode} -FUNCTION {article} + +FUNCTION{output.start} +{ hereafter empty$ + 'skip$ + { "\bibhereafter{{\noexpand\em " write$ hereafter "}}" * write$ } + if$ + newline$ + "\opcitstart " write$ +} + +FUNCTION{output.as.block} +{ duplicate$ "" = + 'pop$ + { period.state #1 = + { "\GobbleOrNot" #0 'period.state := } + { "" } + if$ + "\bibpunctuation" * quotes * write$ newline$ "\newblock " swap$ * write$ + #1 'output.state := + } + if$ + "" 'quotes := +} + +FUNCTION{output.omitted} +{ 't := + duplicate$ "" = + { pop$ } + { "\toomit[" t * "]{\bibpunctuation\bibcase " * swap$ * "}" * write$ } + if$ +} + +FUNCTION {fin.entry} +{ write$ + note empty$ {""} {note} if$ "note" output.omitted + "\opcitend" write$ + newline$ +} + +FUNCTION{empty.warning} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ ""} + 'skip$ + if$ +} + +FUNCTION{empty.chapter.and.pages.warning} +{ 't := + chapter empty$ + { pages empty$ + { pop$ "empty " t * " in " * cite$ * warning$ "" } + 'skip$ + if$ + } + 'skip$ + if$ + +} + +FUNCTION{book} +{ output.bibitem + output.start + author empty$ + { format.editors.ed "author and editor" empty.warning write$ } + { format.authors "author and editor" editor either.warning write$ } + if$ + title emphasize "title" empty.warning output.as.block + edition empty$ + 'skip$ + { "\bibcase " edition * " edition" * output.as.block } + if$ + howpublished missing$ + 'skip$ + { "\bibcase " howpublished * output.as.block } + if$ + format.bvolume "volume" output.omitted + format.number.series "number" output.omitted + make.address.publisher.year write$ + url empty$ + 'skip$ + { make.url output.as.block } + if$ + fin.entry +} + +FUNCTION{article} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + howpublished empty$ + 'skip$ + { "\bibpunctuation'' \newblock\toomit[howpublished]{\bibcase + " howpublished * write$ + "}" 'quotes := + } + if$ + journal emphasize "journal" empty.warning + " " * format.vol.num.date.pages "year" empty.warning * output.as.block + url empty$ + 'skip$ + { make.url output.as.block } + if$ + fin.entry +} + +FUNCTION {incollection} { output.bibitem - format.authors "author" output.check - new.block - format.title.quoted "title" output.check - new.block - journal emphasize "journal" output.check - format.vol.num.date.pages "year" output.check - new.block - note output + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + "\bibcase in " output.as.block + crossref empty$ + 'skip$ + { "\bibincite{" crossref * "}" * write$ } + if$ + "{" write$ + editor empty$ + 'skip$ + { format.editors.ed ", " * write$ } + if$ + booktitle emphasize "booktitle" empty.warning write$ + edition empty$ + 'skip$ + { "\bibcase " edition * " edition" * output.as.block } + if$ + make.address.publisher.year write$ + url empty$ + 'skip$ + { make.url output.as.block } + if$ + "}" write$ + format.chapter.pages write$ fin.entry } - -FUNCTION {book} + +FUNCTION {inbook} { output.bibitem + output.start author empty$ - { format.editors.ed "author and editor" output.check } - { format.authors output.nonnull - "author and editor" editor either.or.check + { format.editors.ed "author and editor" empty.warning write$ } + { format.authors "author and editor" editor either.warning write$ } + if$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + chapter empty$ + 'skip$ + { type empty$ + { "\bibcase chapter " chapter * } + { "\bibcase " type * " " * chapter * } + if$ + } + if$ + pages empty$ + 'skip$ + { chapter empty$ + { "\bibcase pages" pages n.dashify tie.or.space.connect } + { "\toomit[pages]{ (pages" * pages n.dashify tie.or.space.connect ")}" * } + if$ + } + if$ + "chapter and pages" empty.warning + " of " * + crossref empty$ + { booktitle emphasize * "booktitle" empty.warning + edition empty$ + 'skip$ + { ", " * edition "l" change.case$ * " edition" * } + if$ + howpublished missing$ + 'skip$ + { ", " * howpublished * } + if$ + output.as.block + make.address.publisher.year write$ } + { "\bibincitestar{" * crossref * "}{" * booktitle emphasize * "}" * output.as.block } if$ - new.block - format.btitle "title" output.check - edition new.block.checka - format.edition output - format.bvolume output - format.number.series output - make.address.publisher.year output - new.block - note output + fin.entry +} + +FUNCTION{phdthesis} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + title emphasize "title" empty.warning + "\bibparenthesis{Ph.\,D.\ diss\GobbleOrNot.}" * output.as.block + address empty$ + { "" } + { address ": " * } + if$ + school "school" empty.warning * output.as.block + month empty$ + { "" } + { month " " * } + if$ + year "year" empty.warning * output.as.block fin.entry } -FUNCTION {incollection} +FUNCTION{mastersthesis} { output.bibitem - format.authors "author" output.check - new.block - format.title.quoted "title" output.check - new.block - format.in.ed.booktitle "booktitle" output.check - format.bvolume output - format.number.series output - make.address.publisher.year output - format.chapter.pages output - new.block - note output + output.start + format.authors "author" empty.warning write$ + title emphasize "title" empty.warning + "\bibparenthesis{M.\,A.\ thesis}" * output.as.block + address empty$ + { "" } + { address ": " * } + if$ + school "school" empty.warning * output.as.block + month empty$ + { "" } + { month " " * } + if$ + year "year" empty.warning * output.as.block fin.entry } +FUNCTION{proceedings} +{ output.bibitem + output.start + editor empty$ + { organization "editor and organization" empty.warning write$ } + { format.editors.ed "editor" empty.warning write$ } + if$ + title emphasize "title" empty.warning output.as.block + format.bvolume "volume" output.omitted + format.number.series "number" output.omitted + make.address.publisher.year write$ + fin.entry +} + +FUNCTION {booklet} +{ book } + +FUNCTION {inproceedings} +{ output.bibitem + output.start + format.authors "author" empty.warning write$ + "``" title * "title" empty.warning output.as.block "''" 'quotes := + "\bibcase in " output.as.block + crossref empty$ + 'skip$ + { "\bibincite{" crossref * "}" * write$ } + if$ + "{" booktitle emphasize * "booktitle" empty.warning write$ + editor empty$ + { organization "editor and organization" empty.warning output.as.block } + { ", edited by " format.editors * write$ } + if$ + make.address.publisher.year write$ + "}" write$ + format.chapter.pages write$ + fin.entry +} + + FUNCTION {misc} { output.bibitem - format.authors "author" output.check - new.block - format.title output - howpublished new.block.checka - howpublished output - format.date output - new.block - note output + output.start + format.authors "author" empty.warning write$ + title output.as.block + howpublished missing$ + 'skip$ + { howpublished output.as.block } + if$ + format.date output.as.block fin.entry - empty.misc.check } -% \end{macrocode} -% -%The next has been copied almost verbatim (I am not even sure if all these functions are actually used by the style\dots) -% -% \begin{macrocode} FUNCTION {default.type} { misc } @@ -966,13 +1751,13 @@ FUNCTION {sort.format.names} numnames 'namesleft := { namesleft #0 > } { nameptr #1 > - { " " * } - 'skip$ + { " " * } + 'skip$ if$ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := nameptr numnames = t "others" = and - { "et al" * } - { t sortify * } + { "et al" * } + { t sortify * } if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := @@ -1082,23 +1867,19 @@ FUNCTION {presort} #1 entry.max$ substring$ 'sort.key$ := } -% \end{macrocode} -% -%By contrast, |begin.bib| has been heavily lengthened, by adding all the formatting commands. This would be the best place for inserting any |\newBibCommand|'s. -% -% \begin{macrocode} FUNCTION {begin.bib} { preamble$ empty$ 'skip$ { preamble$ write$ newline$ } if$ + "\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}" write$ newline$ + "\newBibCommand{\bibincite[2]}{\recover@last\@nameuse{@#1}}{#2}" write$ newline$ + "\newBibCommand{\bibincitestar[2]}{\recover@last " write$ newline$ + " \@nameuse{#1@star}}{#2}" write$ newline$ + "\newBibCommand{\SwapNames[2]}{#1 #2}{#2, #1}" write$ newline$ + "\newBibCommand{\GobbleOrNot}{\relax}{\newblock\@gobble}" write$ newline$ "\begin{thebibliography}{}" write$ newline$ } -% \end{macrocode} -% -% Finally, the `executive functions:' -% -% \begin{macrocode} ITERATE {presort} SORT diff --git a/Master/texmf-dist/source/latex/opcit/opcit.ins b/Master/texmf-dist/source/latex/opcit/opcit.ins index 739aab03bb3..6e56bcebb92 100644 --- a/Master/texmf-dist/source/latex/opcit/opcit.ins +++ b/Master/texmf-dist/source/latex/opcit/opcit.ins @@ -1,25 +1,25 @@ -\input docstrip.tex -\keepsilent -\preamble -Part of the `opcit' project: bibliographical references as footnotes. - -Copyright 2002 Federico Garcia - -\endpreamble -\generate{\file{opcit.sty}{\from{opcit.dtx}{package}}} -\generate{\usepostamble\empty% - \file{opcit.bst}{\from{opcit.dtx}{bst}}} - -\Msg{***********************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the files} -\Msg{* `opcit.sty' and `opcit.bst'into a directory searched} -\Msg{* by TeX. It is not bad idea to put them together.} -\Msg{*} -\Msg{* To produce the documentation run the file `opcit.dtx'} -\Msg{* through LaTeX.} -\Msg{*} -\Msg{***********************************************************} - - +\input docstrip.tex
+\keepsilent
+\preamble
+Part of the `opcit' project: bibliographical references as footnotes.
+
+Copyright 2006 Federico Garcia
+
+\endpreamble
+\generate{\file{opcit.sty}{\from{opcit.dtx}{package}}}
+\generate{\usepostamble\empty%
+ \file{opcit.bst}{\from{opcit.dtx}{bst}}}
+
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the files}
+\Msg{* `opcit.sty' and `opcit.bst'into a directory searched}
+\Msg{* by TeX. It is not bad idea to put them together.}
+\Msg{*}
+\Msg{* To produce the documentation run the file `opcit.dtx'}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{***********************************************************}
+
+
\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/opcit/opcit.sty b/Master/texmf-dist/tex/latex/opcit/opcit.sty index 37ec7c119ea..3812ed4069d 100644 --- a/Master/texmf-dist/tex/latex/opcit/opcit.sty +++ b/Master/texmf-dist/tex/latex/opcit/opcit.sty @@ -7,93 +7,219 @@ %% opcit.dtx (with options: `package') %% Part of the `opcit' project: bibliographical references as footnotes. %% -%% Copyright 2002 Federico Garcia +%% Copyright 2006 Federico Garcia %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{opcit}[2002/12/25 Footnote references (Federico Garcia)] +\ProvidesPackage{opcit}[2006/09/20 Footnote references (Federico Garcia) Version 2] \RequirePackage{xspace} -\newcommand{\opcit@bst}{opcit} -\DeclareOption*{\PackageInfo{opcit}{% - `\CurrentOption' used as bibliography style}% - \let\opcit@bst\CurrentOption} -\ProcessOptions \newif\ifopcit@bbl\opcit@bblfalse \newif\ifopcit@footnote\opcit@footnotefalse \newif\ifperi@d\peri@dfalse +\newif\ifhyper@opcit +\newif\if@omitting +\newif\if@idem +\newif\ifcheck@idem +\newif\ifcheck@@idem +\newif\if@opcit +\newif\ifcustom@bst +\newcount\@lastcite \newlength{\sameauthorsrule}\setlength{\sameauthorsrule}{23pt} \newtoks\opcit@redefs +\newtoks\opcit@defs +\newcommand*{\last@cited}{)OpcitFirst(} +\newcommand*{\opcittext}{\textit{op.\,cit.}} +\newcommand*{\idemtext}{\textit{Idem}} +\newcommand*{\sameauthors}{\rule{\sameauthorsrule}{.4pt}} +\newcommand*\opcitwarning[1]{\PackageWarning{noopcit option is called for, + but `#1' has no hereafter.}} +\newcommand*\opcit@noreferror[1]{\PackageError{key `#1' has not been cited.} + {\string\bibref can be used only after the first citation of a work. + (You might also have mistyped the key.) Go on, but there won't be a + cross reference here.}\textbf{??}} +\let\@quoteornot\relax +\DeclareOption{hyperref}{\hyper@opcittrue} +\DeclareOption{nohyperref}{\hyper@opcitfalse} +\DeclareOption{omitting}{\@omittingtrue} +\DeclareOption{noomitting}{\@omittingfalse} +\DeclareOption{noidem}{\@idemfalse} +\DeclareOption{idem}{\@idemtrue} +\DeclareOption{checkidem}{\check@idemtrue} +\DeclareOption{nocheckidem}{\check@idemfalse} +\DeclareOption{opcit}{\@opcittrue} +\DeclareOption{noopcit}{\@opcitfalse} +\DeclareOption{nocustombst}{\newcommand\opcit@bst{\bibliographystyle{opcit}}} +\DeclareOption{custombst}{\let\opcit@bst\relax} +\@ifpackageloaded{hyperref} + {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit,hyperref}} + {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit}} +\ProcessOptions +\ifhyper@opcit\RequirePackage{hyperref}\fi +\opcit@bst \newcommand{\newBibCommand}[3]{% \newcommand#1{#2}% \opcit@redefs\expandafter{\the\opcit@redefs% \renewcommand#1{#3}}} -\newcommand{\opcitstart}{\relax} -\newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else.\fi} -\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1} -\newBibCommand{\bibIn}{in}{In} -\newBibCommand{\bibpunctuation}{% - \ifnum\spacefactor=\sfcode`.\else,\fi\xspace}{% - \ifnum\spacefactor=\sfcode`?\else.\fi\xspace} -\newcommand{\sameauthors}{\rule{\sameauthorsrule}{.4pt}} +\let\opcitstart\relax +\newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else\unskip.\fi} +\newBibCommand{\bibpunctuation}{,\xspace}{% + \ifnum\spacefactor=\sfcode`?\else\unskip.\fi\xspace} \newBibCommand{\biblastnames[1]}{% \global\@namedef{\@curr@bibitem @authors}{#1}}{\relax} \newBibCommand{\bibhereafter[1]}{% - \global\@namedef{\@curr@bibitem @hereafter}{#1}}{\relax} -\newcommand{\last@cited}{)OpcitFirst(} -\newcommand{\opcittext}{Op.~Cit.} -\newcommand{\idemtext}{Idem} -\bibliographystyle{\opcit@bst} + \global\expandafter\edef\csname\@curr@bibitem @hereafter\endcsname{% + \ifhyper@opcit + \noexpand\hyperlink{\@curr@bibitem @key}{#1}\else#1\fi}}{\relax} +\newBibCommand{\bibcase[1]}{\lowercase{#1}}{\uppercase{#1}} +\newBibCommand\QuoteOrNot{\gdef\@quoteornot{''\global\let\@quoteornot\relax}}{\relax} +\if@omitting + \newBibCommand{\toomit[2][omitted]}{% + \@nameuse{omit@#1}\@gobble{#2}}{#2}% + \newcommand\with[1]{% + \global\expandafter\let\csname omit@#1\endcsname\@gobble + \edef\@reomit{\@reomit,#1}} + \newcommand\@reomit{omitted}% +\else + \newcommand\toomit[2][omitted]{#2} + \let\with\@gobble +\fi \bgroup + \renewcommand{\newBibCommand}[3]{% + \newcommand#1{#2}% + \global\opcit@defs\expandafter{\the\opcit@defs + \newBibCommand{#1}{#2}{#3}}} \renewenvironment{thebibliography}[1]{\relax}{\relax} - \def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{% + \def\toomit{\noexpand\toomit}% + \def\QuoteOrNot{\noexpand\QuoteOrNot}% + \long\def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{% \ifx#3\sameauthors\else\def\@lastauthors{#3}\fi \global\expandafter\edef\csname#1@author\endcsname{\@lastauthors}% \global\def\@curr@bibitem{#1}% - \global\expandafter\def\csname#1\endcsname{\@nameuse{#1@author}, #4}% - \global\@namedef{#1@star}{#4}% - \bibhereafter{\opcittext}% + \global\expandafter\edef\csname #1@first\endcsname{% + \noexpand\opcit@noreferror{#1}}% + \global\@namedef{#1@star}{% + \global\expandafter\edef\csname #1@first\endcsname{\thefootnote}% + \ifhyper@opcit\hypertarget{#1@key}{}\fi + #4}% + \global\def\hereafter{\@nameuse{#1@hereafter}}% + \global\expandafter\def\csname @#1\endcsname{% + \@nameuse{#1@author}, \@nameuse{#1@star}}% + \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{#1}\fi}% #2} \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}% {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{% - No information found about bibliographical references.}} + No \jobname.bbl file. There will be no footnote references}} \egroup +\the\opcit@defs \ifopcit@bbl -\renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}% -\newcommand{\opcit@cite}[2][.]{\nocite{#2}% - \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue% - \else\opcit@footnotefalse\expandafter\footnote\fi% - {\@nameuse{#2}\ifx#1.\check@for@period{\@nameuse{#2}}% - \else\check@for@period{#1}% - {, #1}\fi% - \ifopcit@footnote\peri@dtrue\fi% - \ifperi@d\else.\fi}% - \renew@cites{#2}} -\newcommand{\opcit@cite@star}[2][.]{\nocite{#2}% - \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue% - \else\opcit@footnotefalse\expandafter\footnote\fi% - {\@nameuse{#2star}\ifx#1.\check@for@period{\@nameuse{#2}}% - \else\check@for@period{#1}% - {, #1}\fi% - \ifopcit@footnote\peri@dtrue\fi% - \ifperi@d\else.\fi}% - \renew@cites{#2}} + \renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}% \fi +\newcommand*\resetcites{% + \bgroup + \renewcommand{\newBibCommand}[3]{% + \newcommand##1{##2}% + \global\opcit@defs\expandafter{\the\opcit@defs + \newBibCommand{##1}{##2}{##3}}} + \renewenvironment{thebibliography}[1]{\relax}{\relax} + \def\toomit{\noexpand\toomit}% + \def\QuoteOrNot{\noexpand\QuoteOrNot}% + \long\def\bibitem##1##2\opcitstart ##3\bibpunctuation \newblock##4\opcitend{% + \ifx##3\sameauthors\else\def\@lastauthors{##3}\fi + \global\expandafter\edef\csname##1@author\endcsname{\@lastauthors}% + \global\def\@curr@bibitem{##1}% + \global\expandafter\edef\csname ##1@first\endcsname{% + \noexpand\opcit@noreferror{##1}}% + \global\@namedef{##1@star}{% + \global\expandafter\edef\csname ##1@first\endcsname{\thefootnote}% + \ifhyper@opcit\hypertarget{##1@key}{}\fi + ##4}% + \global\def\hereafter{\@nameuse{##1@hereafter}}% + \global\expandafter\def\csname @##1\endcsname{% + \@nameuse{##1@author}, \@nameuse{##1@star}}% + \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{##1}\fi}% + ##2} + \let\newcommand\renewcommand + \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}% + {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{% + No \jobname.bbl file. There will be no footnote references}} + \egroup} +\newcommand{\opcit@cite}[2][\@empty]{\nocite{#2}% + \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue + \else\opcit@footnotefalse\expandafter\footnote\fi + {\@nameuse{@#2}% + \check@for@period{\@nameuse{@#2}}% + \finalize@cite{#1}{#2}}} +\newcommand{\opcit@cite@star}[2][\@empty]{\nocite{#2}% + \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue + \else\opcit@footnotefalse\expandafter\footnote\fi + {\@nameuse{#2@star}% + \check@for@period{\@nameuse{#2@star}}% + \finalize@cite{#1}{#2}}} +\newcommand\finalize@cite[2]{% + \global\@lastcite=\c@footnote\relax + \ifx\@empty#1\else + \ifcheck@@idem + \check@for@period{\idemtext}% + \def\this@opt{#1}% + \ifx\last@opt\this@opt\else + \check@for@period{#1},\@quoteornot\ #1% + \fi + \else\check@for@period{#1},\@quoteornot\ #1% + \fi + \fi + \ifopcit@footnote\peri@dtrue\fi + \ifperi@d\else.\@quoteornot\fi + \global\def\last@opt{#1}% + \check@@idemfalse + \if@omitting + \@for\@tempcsa :=\@reomit \do + {\global\expandafter\let\csname omit@\@tempcsa\endcsname\relax}% + \global\def\@reomit{omitted}% + \fi + \renew@cites{#2}% + } \newcommand{\renew@cites}[1]{% - \global\expandafter\edef\csname\last@cited\endcsname{% - \@nameuse{\last@cited @authors},% - ~{\noexpand\em\@nameuse{\last@cited @hereafter}}}% - \global\expandafter\edef\csname\last@cited star\endcsname{% - {\noexpand\em\@nameuse{\last@cited @hereafter}}}% + \recover@last% \global\def\last@cited{#1}% - \global\@namedef{#1}{{\em\idemtext}}% - \global\@namedef{#1star}{{\em\@nameuse{#1@hereafter}}}% - \global\def\hereafter{\@nameuse{#1@hereafter}}} + \cited{#1}% + \ifopcit@footnote\else\if@idem + \global\@namedef{@#1}{\@idem{@#1}}% + \global\@namedef{#1@star}{\@idem{@#1}}% + \fi\fi + \global\def\hereafter{\textit{\@nameuse{#1@hereafter}}}}% +\newcommand*\cited[1]{\@for\@tempcsa :=#1 \do{% + \global\@namedef{@#1}{\@nameuse{#1@authors},~\@nameuse{#1@hereafter}}% + \global\@namedef{#1@star}{\@nameuse{#1@hereafter}}}}% +\newcommand\recover@last{% + \global\expandafter\edef\csname @\last@cited\endcsname{% + \noexpand\@nameuse{\last@cited @authors},% + ~{\noexpand\@nameuse{\last@cited @hereafter}}}% + \global\expandafter\edef\csname\last@cited @star\endcsname{% + {\noexpand\@nameuse{\last@cited @hereafter}}}% + } +\newcommand\@idem[1]{\advance\@lastcite1\relax + \ifnum\@lastcite=\c@footnote + \idemtext\ifcheck@idem\check@@idemtrue\fi + \else + \check@@idemfalse\recover@last\@nameuse{#1}% + \fi} \def\check@for@period#1{{\normalsfcodes\setbox0\hbox{#1% - \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else% + \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else \global\peri@dfalse\fi}}} +\ifhyper@opcit + \newcommand*\bibref[1]{\hyperlink{#1@key}{\@nameuse{#1@first}}} +\else + \newcommand*\bibref[1]{\@nameuse{#1@first}} +\fi +\newcommand\nobibliography[1]{\if@filesw + \immediate\write\@auxout{\string\bibdata{#1}}\fi + \if@omitting\PackageWarningNoLine{opcit}{No final references list, + there might be information within \string\toomit\space commands that will be lost}\fi} \let\opcit@bibliography\bibliography -\renewcommand{\bibliography}{\the\opcit@redefs\opcit@bibliography} +\renewcommand{\bibliography}{% + \renewcommand\newBibCommand[3]{\relax}% + \the\opcit@redefs\opcit@bibliography} \newcommand{\thebib@renew}{} -\@ifclassloaded{article}{% +\@ifundefined{chapter}{% \renewcommand{\thebib@renew}{\section*{\refname}\@mkboth{\refname}{\refname}}}{% \renewcommand{\thebib@renew}{\chapter*{\bibname}\@mkboth{\bibname}{\bibname}}}% \renewenvironment{thebibliography}[1] diff --git a/Master/texmf-dist/tpm/opcit.tpm b/Master/texmf-dist/tpm/opcit.tpm index 889c10e9b71..7a073a57c98 100644 --- a/Master/texmf-dist/tpm/opcit.tpm +++ b/Master/texmf-dist/tpm/opcit.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/opcit.zip"> <TPM:Name>opcit</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/21 00:25:32</TPM:Date> + <TPM:Date>2006/09/20 18:18:00</TPM:Date> <TPM:Version>1.0</TPM:Version> <TPM:Creator>rahtz</TPM:Creator> <TPM:Title>Footnote-style bibliographical references.</TPM:Title> @@ -21,13 +21,16 @@ this, to a large extent, automatically. <TPM:Author></TPM:Author> <TPM:Size>120101</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="19859"> + <TPM:RunFiles size="30932"> texmf-dist/bibtex/bst/opcit/opcit.bst texmf-dist/tex/latex/opcit/opcit.sty texmf-dist/tpm/opcit.tpm </TPM:RunFiles> - <TPM:DocFiles size="59868">texmf-dist/doc/latex/opcit/opcit.dvi</TPM:DocFiles> - <TPM:SourceFiles size="40374"> + <TPM:DocFiles size="304934"> +texmf-dist/doc/latex/opcit/README +texmf-dist/doc/latex/opcit/opcit.pdf + </TPM:DocFiles> + <TPM:SourceFiles size="79736"> texmf-dist/source/latex/opcit/opcit.dtx texmf-dist/source/latex/opcit/opcit.ins </TPM:SourceFiles> |