From 562d46ca476802952d24f54feea01d244ee01bca Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Jan 2006 23:53:54 +0000 Subject: trunk/Master/texmf-dist/source/latex/harvard git-svn-id: svn://tug.org/texlive/trunk@318 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/harvard/INSTALL | 19 + Master/texmf-dist/source/latex/harvard/Makefile | 43 ++ Master/texmf-dist/source/latex/harvard/README | 42 ++ .../texmf-dist/source/latex/harvard/doc_Makefile | 20 + .../texmf-dist/source/latex/harvard/harvard.perl | 786 +++++++++++++++++++++ 5 files changed, 910 insertions(+) create mode 100644 Master/texmf-dist/source/latex/harvard/INSTALL create mode 100644 Master/texmf-dist/source/latex/harvard/Makefile create mode 100644 Master/texmf-dist/source/latex/harvard/README create mode 100644 Master/texmf-dist/source/latex/harvard/doc_Makefile create mode 100644 Master/texmf-dist/source/latex/harvard/harvard.perl (limited to 'Master') diff --git a/Master/texmf-dist/source/latex/harvard/INSTALL b/Master/texmf-dist/source/latex/harvard/INSTALL new file mode 100644 index 00000000000..855d1be88d7 --- /dev/null +++ b/Master/texmf-dist/source/latex/harvard/INSTALL @@ -0,0 +1,19 @@ +# harvard family of bibliographic styles +# Copyright 1994 - Peter Williams peterw@archsci.arch.su.edu.au + +1. edit 'Makefile' setting 'bstdir', 'stydir', 'htmldir' and 'docdir' to values + appropriate to your LaTeX installation + +2. type 'make install' + +3. make sure 'bstdir' is in the paths for BST input (probably environment + variable BSTINPUTS on the latest web2c installation) + +4. make sure 'stydir' is in the paths for TeX input (probably environment + variable TEXINPUTS on the latest web2c installation) + +5. type 'make install_doc' to install documentation + +6. cd to $docdir and type 'make' to create postscript version of documentation. + If necessary edit 'Makefile' in $docdir to produce output other than + postscript. diff --git a/Master/texmf-dist/source/latex/harvard/Makefile b/Master/texmf-dist/source/latex/harvard/Makefile new file mode 100644 index 00000000000..d24bdf4604f --- /dev/null +++ b/Master/texmf-dist/source/latex/harvard/Makefile @@ -0,0 +1,43 @@ +# harvard family of bibliographic styles +# Copyright 1994 - Peter Williams peterw@archsci.arch.su.edu.au + +prefix=/opt/TeX +texlib=$(prefix)/lib/texmf +bstdir=$(texlib)/bibtex/bst/harvard +stydir=$(texlib)/tex/latex/local +docdir=$(texlib)/bibtex/doc/harvard +htmldir=/people/archsci/archsci-www/utils/latex2html/styles + +BSTS=agsm.bst dcu.bst jmr.bst jphysicsB.bst kluwer.bst nederlands.bst apsr.bst + +all: + +harvard.ps: harvard.dvi + dvips harvard + +harvard.dvi: harvard.tex harvard.bbl + latex harvard + latex harvard + +harvard.bbl: harvard.aux harvard.bib + bibtex harvard + +harvard.aux: harvard.tex + latex harvard + +install: harvard.sty harvard.perl $(BSTS) + mkdir -p $(bstdir) + mkdir -p $(stydir) + mkdir -p $(htmldir) + cp $(BSTS) $(bstdir) + cp harvard.sty $(stydir) + cp harvard.perl $(htmldir) + +install_doc: harvard.tex harvard.bib + mkdir -p $(docdir) + cp doc_Makefile $(docdir)/Makefile + cp harvard.tex $(docdir) + cp harvard.bib $(docdir) + +clean: + rm -f harvard.dvi harvard.aux harvard.bbl harvard.log harvard.blg diff --git a/Master/texmf-dist/source/latex/harvard/README b/Master/texmf-dist/source/latex/harvard/README new file mode 100644 index 00000000000..38f0b96d1c0 --- /dev/null +++ b/Master/texmf-dist/source/latex/harvard/README @@ -0,0 +1,42 @@ +# harvard family of bibliographic styles +# Copyright 1994 - Peter Williams peterw@archsci.arch.su.edu.au + +This is version 2.0.5 of the harvard family of bibliographic styles. +It is a bug fix of 2.0 which was a major rewrite to bring the sty file into +line with the new latex described in ``The LaTeX Companion''. Due to the +efforts of Thorsten Schnier (thorsten@archsci.arch.su.edu.au) it incorporates +support for the LaTeX to html translator by Nikos Drakos +(nikos@cbl.leeds.ac.uk). + +It includes a fixes by Berwin A. Turlach (berwin@alphasun.anu.edu.au) for +problems with \AtBeginDocument introduced in the latest version of LaTeX2e +and problems with the \nocite command. + +A new style apsr.bst (American Political Science Review) is enclosed +courtesy of Nathaneil L. Beck (nbeck@weber.ucsd.edu) + +NB. The file harvard.sty makes considerable use of features in the new latex +that were not present in latex version 2.09 and is, therefore, not compatible +with that version. However, the *.bbl files produced by the various bst files +should be still useable with latex version 2.09. + +The following files are enclosed. + + README - This file + INSTALL - Installation instructions + Makefile - Makefile for installation + harvard.ps - Postscript version of the documentation + harvard.tex - LaTeX source for the documentation + harvard.bib - BibTeX database file for the documentation + doc_Makefile - Makefile for documentation + harvard.sty - LaTeX style file for harvard bibliographic style + harvard.perl - LaTeX2html style file for harvard bibliographic style + agsm.bst - harvard BibTeX style file to satisfy the requirements + of the Australian Government Style Manual + dcu.bst - harvard BibTeX style file to satisfy the requirements + of the Design Computing Unit, Sydney University + .bst - various style files contributed by users + +Online documentation is available via the WWW at: + +HREF="http://www.arch.su.edu.au/~peterw/latex/harvard/" diff --git a/Master/texmf-dist/source/latex/harvard/doc_Makefile b/Master/texmf-dist/source/latex/harvard/doc_Makefile new file mode 100644 index 00000000000..e41a58dec12 --- /dev/null +++ b/Master/texmf-dist/source/latex/harvard/doc_Makefile @@ -0,0 +1,20 @@ +# harvard family of bibliographic styles - documentation +# Copyright - Peter Williams peterw@archsci.arch.su.edu.au + +all: harvard.ps + +harvard.ps: harvard.dvi + dvips harvard + +harvard.dvi: harvard.tex harvard.bbl + latex harvard + latex harvard + +harvard.bbl: harvard.aux harvard.bib + bibtex harvard + +harvard.aux: harvard.tex + latex harvard + +clean: + rm -f harvard.dvi harvard.aux harvard.bbl harvard.log harvard.blg diff --git a/Master/texmf-dist/source/latex/harvard/harvard.perl b/Master/texmf-dist/source/latex/harvard/harvard.perl new file mode 100644 index 00000000000..e4318614232 --- /dev/null +++ b/Master/texmf-dist/source/latex/harvard/harvard.perl @@ -0,0 +1,786 @@ +# harvard.perl +# Copyright 1994 - thorsten schnier (thorsten@arch.su.edu.au) +# key center of design computing, university of sydney +# +# Change Log: +# =========== +# +# 07-JUN-94 first attempt +# 16-JUN-94 changes for harvard 2.0 +# (star and starstar commands) + + +package main; + +$cite_mark = ''; +$citefull_mark = ''; +$citeshort_mark = ''; +$citename_mark = ''; +$citenamefull_mark = ''; +$citenameshort_mark = ''; +$citekey_mark = ''; +$citeyear_mark = ''; + +$harvard_left = '('; +$harvard_right = ')'; +$harvardyear_left = '('; +$harvardyear_right = ')'; +$harvard_cite_separator = $harvard_agsm_cite_separator = ', '; +$harvard_year_separator = $harvard_agsm_year_separator = " "; +$harvard_agsm_and = '&'; +$harvard_dcu_cite_separator = "; "; +$harvard_dcu_year_separator = ", "; +$harvard_dcu_and = 'and'; +$harvard_and = $harvard_agsm_and; +$harvard_default = 1; +$harvard_full = 0; + +# the citation commands +# This just creates a link from a label (yet to be determined) to the +# cite_key in the citation file. +# use different markers, depending on the style of the citation used + +#changes to latex2html-version: +#insert separating sign, use optional text argument, use brackets +#according to cite-mode, and reverse order of cites (to correct order) + + + +sub do_cmd_cite { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first ? $harvard_left : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $cite_mark, + $harvard_year_separator, + '##', $cite_key, $citeyear_mark, + "<\/A>"); + $first = 0; + } + join ('', + $result, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +sub do_cmd_citestar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first ? $harvard_left : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $citefull_mark, + $harvard_year_separator, + '##', $cite_key, $citeyear_mark, + "<\/A>"); + $first = 0; + } + join ('', + $result, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +sub do_cmd_citestarstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first ? $harvard_left : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $citeshort_mark, + $harvard_year_separator, + '##', $cite_key, $citeyear_mark, + "<\/A>"); + $first = 0; + } + join ('', + $result, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + + + +sub do_cmd_citeaffixed { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + s/$next_pair_pr_rx//o; + local($comment) = $2; + local ($first) = 1; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first? ($harvard_left, $comment, " ") + : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $cite_mark, + $harvard_year_separator, + '##', $cite_key,$citeyear_mark, + "<\/A>"); + $first = 0; + } + join('', + $result, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +sub do_cmd_citeaffixedstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + s/$next_pair_pr_rx//o; + local($comment) = $2; + local ($first) = 1; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first? ($harvard_left, $comment, " ") + : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $citefull_mark, + $harvard_year_separator, + '##', $cite_key,$citeyear_mark, + "<\/A>"); + $first = 0; + } + join('', + $result, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + +sub do_cmd_citeaffixedstarstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + s/$next_pair_pr_rx//o; + local($comment) = $2; + local ($first) = 1; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + $result = join ('', $result, + $first? ($harvard_left, $comment, " ") + : $harvard_cite_separator, + "$citekey_mark", + '##', $cite_key, $citeshort_mark, + $harvard_year_separator, + '##', $cite_key,$citeyear_mark, + "<\/A>"); + $first = 0; + } + join('', + $result, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + $_); + } + else {warn "Cannot find citation argument\n";} +} + + + +#similar to cite +#no multiple cites allowed ! + +sub do_cmd_citeasnoun { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + join ('', + "$citekey_mark", + '##', $cite_key,$cite_mark, + ' ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +sub do_cmd_citeasnounstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + join ('', + "$citekey_mark", + '##', $cite_key,$citefull_mark, + ' ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +sub do_cmd_citeasnounstarstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + join ('', + "$citekey_mark", + '##', $cite_key,$citeshort_mark, + ' ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text ? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + + + +#same as citeasnoun, but add the possessive 's +#no multiple cites allowed ! + +sub do_cmd_possessivecite { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + join('', "$citekey_mark", + '##', $cite_key,$cite_mark, + '\'s ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + +sub do_cmd_possessivecitestar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + join('', "$citekey_mark", + '##', $cite_key,$citefull_mark, + '\'s ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + +sub do_cmd_possessivecitestarstar { + local($_) = @_; + local($text, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + join('', "$citekey_mark", + '##', $cite_key,$citeshort_mark, + '\'s ', + $harvard_left, + '##', $cite_key,$citeyear_mark, + $text? ($harvard_agsm_cite_separator, $text):'', + $harvard_right, + "<\/A>", + $_); + } + else {warn "Cannot find citation argument\n";} +} + + +#similar to citeasnoun, but only names +#multiple arguments allowed, no link produced +#no optional text argument + +sub do_cmd_citename { + local($_) = @_; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + $result = join('', $result, + ($first? '': $harvard_cite_separator), + "$citekey_mark", + '##', $cite_key, $citename_mark, + ""); + $first = 0; + } + join ('', $result, $_); + } + else {warn "Cannot find citation argument\n";} +} + +sub do_cmd_citenamestar { + local($_) = @_; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + $result = join('', $result, + ($first? '' : $harvard_cite_separator), + "$citekey_mark", + '##', $cite_key,$citenamefull_mark, + ""); + $first = 0; + } + join ('', $result, $_); + } + else {warn "Cannot find citation argument\n";} +} + +sub do_cmd_citenamestarstar { + local($_) = @_; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + $result = join('', $result, + ($first? '' : $harvard_cite_separator), + "$citekey_mark", + '##', $cite_key,$citenameshort_mark, + ""); + $first = 0; + } + join ('', $result, $_); + } + else {warn "Cannot find citation argument\n";} +} + + +#similar to cite, but only year +#multiple arguments allowed, no link produced +#no optional text argument + +sub do_cmd_citeyear { + local($_) = @_; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + $result = join ('', $result, + ($first ? $harvard_left : $harvard_cite_separator), + "$citekey_mark", + '##', $cite_key,$citeyear_mark, + ""); + $first = 0; + } + join('',$result, $harvard_right, $_); # closing bracket + } + else {warn "Cannot find citation argument\n";} +} + + +# citeyear without brackets + +sub do_cmd_citeyearstar { + local($_) = @_; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + local ($first) = 1 ; + local ($result); + if ($cite_key) { + foreach $cite_key (split(/,/,$cite_key)) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # The proper link $citefile#$cite_key will be substituted later + $result = join ('', $result, + ($first ? '' : $harvard_cite_separator), + "$citekey_mark", + '##', $cite_key,$citeyear_mark, + ""); + $first = 0; + } + join('',$result, $_); # no brackets + } + else {warn "Cannot find citation argument\n";} +} + + + + +# the style commands + +sub do_cmd_citationstyle{ + local($_) = @_; + s/$next_pair_pr_rx//o; + $2; + switch: { + if ($2 =~ /dcu/){ + $harvard_cite_separator = $harvard_dcu_cite_separator; + $harvard_year_separator = $harvard_dcu_year_separator; + $harvard_and = $harvard_dcu_and; + last switch; } + if ($2 =~ /agsm/) { + $harvard_cite_separator = $harvard_agsm_cite_separator; + $harvard_year_separator = $harvard_agsm_year_separator; + $harvard_and = $harvard_agsm_and; + last switch;} + warn 'unknown citation style $2';} + $_; +} + + + +sub do_cmd_citationmode{ + local($_) = @_; + s/$next_pair_pr_rx//o; + $2; + switch: { + if ($2 =~ /full/){ + $harvard_full = 1; + $harvard_default = 0; + last switch; } + if ($2 =~ /abbr/) { + $harvard_full = 0; + $harvard_default = 0; + last switch;} + if ($2 =~ /default/) { + $harvard_full = 0; + $harvard_default = 1; + last switch;} + warn 'unknown citation mode $2';} + $_; +} + + +sub do_cmd_harvardparenthesis{ + local($_) = @_; + s/$next_pair_pr_rx//o; + switch: { + if ($2 =~ /round/){ + $harvard_left = '\('; + $harvard_right = '\)'; + $harvardyear_left = '\('; + $harvardyear_right = '\)'; + last switch; } + if ($2 =~ /curly/) { + $harvard_left = '\{'; + $harvard_right = '\}'; + $harvardyear_left = '\{'; + $harvardyear_right = '\}'; + last switch;} + if ($2 =~ /square/) { + $harvard_left = '\['; + $harvard_right = '\]'; + $harvardyear_left = '\['; + $harvardyear_right = '\]'; + last switch;} + if ($2 =~ /angle/) { + $harvard_left = '<'; + $harvard_right = '>'; + $harvardyear_left = '<'; + $harvardyear_right = '>'; + last switch;} + warn 'unknown paranthesis type $2';} + $_ +} + + +sub do_cmd_harvardyearparenthesis{ + local($_) = @_; + s/$next_pair_pr_rx//o; + switch: { + if ($2 =~ /round/){ + $harvardyear_left = '\('; + $harvardyear_right = '\)'; + last switch; } + if ($2 =~ /curly/) { + $harvardyear_left = '\{'; + $harvardyear_right = '\}'; + last switch;} + if ($2 =~ /square/) { + $harvardyear_left = '\['; + $harvardyear_right = '\]'; + last switch;} + if ($2 =~ /angle/) { + $harvardyear_left = '<'; + $harvardyear_right = '>'; + last switch;} + warn 'unknown year paranthesis type $_';} + $_; +} + + +# harvard symbols + +sub do_cmd_harvardleft { + join('',$harvard_left,@_[0]); +} + +sub do_cmd_harvardright { + join('',$harvard_right,@_[0]); +} + +sub do_cmd_harvardyearleft { + join('',$harvardyear_left,@_[0]); +} + +sub do_cmd_harvardyearright { + join('',$harvardyear_right,@_[0]); +} + +sub do_cmd_harvardand { + join('',$harvard_and,@_[0]); +} + + + +# This command will only be encountered inside a thebibliography environment. +# this should not occur in a file using harvard style +# mainly unchanged, only a warning added + +sub do_cmd_bibitem { + local($_) = @_; + # The square brackets may contain the label to be printed + warn "bibitem-command in harvard-style file\n Cannot extract all neccessary information for cites\n"; + local($label, $dummy) = &get_next_optional_argument; + $label = ++$bibitem_counter unless $label; # Numerical labels + s/$next_pair_pr_rx//o; + $cite_key = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # Associate the cite_key with the printed label. + # The printed label will be substituted back into the document later. + $cite_info{$cite_key} = $label; + # Create an anchor around the citation + join('',"
$label
", $_); + } + else { + warn "Cannot find bibitem labels\n";} +} + +# collect information from item and associate it with the +# cite-key. Contrary to bibitem, the cite-key argument is not optional, +# so no numeric cite-key has to be generated + +sub do_cmd_harvarditem { + local($_) = @_; + # The square brackets may contain the short citation + local($abbr_cite, $dummy) = &get_next_optional_argument; + s/$next_pair_pr_rx//o; + local($full_cite)= $2; + $abbr_cite= $full_cite unless $abbr_cite; + s/$next_pair_pr_rx//o; + local($cite_year) = $2; + s/$next_pair_pr_rx//o; + local($cite_key) = $2; + if ($cite_key) { + $cite_key =~ s/\W//g; # Remove non alphanumeric characters + # Associate the citation-infos with the cite-key. + # The infos will be substituted back into the document later, + # depending on the citation used + $cite_info_abbr {$cite_key} = $abbr_cite; + $cite_info_full {$cite_key} = $full_cite; + $cite_info_year {$cite_key} = $cite_year; + $cite_info_first {$cite_key} = 1; + # Create an anchor around the citation + join('',"
-
", $_); + } + else { + warn "Cannot find bibitem labels\n";} +} + + +## +## to allow bibcard to produce URL links: +## same as htmladdnormallink, but only one argument (both link and text) + +sub do_cmd_harvardurl{ + local($_) = @_; + local($url); + s/$next_pair_pr_rx/$url = $2; ''/eo; + join('',do {qq/URL:<\/B>$url<\/A>/;},$_); +} + + + +# this onle has to be extended to search for citename_mark and +# citeyear_mark as well +# the appropriate entries should have been produced by do_cmd_harvarditem + +sub replace_cite_references { + s/##(\w+)$cite_mark/&help_replace_cites(\1)/ge; + s/##(\w+)$citefull_mark/&help_replace_fullcites(\1)/ge; + s/##(\w+)$citeshort_mark/&help_replace_shortcites(\1)/ge; + s/##(\w+)$citename_mark/&help_replace_name($1)/ge; + s/##(\w+)$citenamefull_mark/$cite_info_full{\1}/g; + s/##(\w+)$citenameshort_mark/$cite_info_short{\1}/g; + s/##(\w+)$citeyear_mark/$cite_info_year{\1}/g; + s/#(\w+)>$citekey_mark/$citefile#\1>/g; + $_ +} + + +#return full or abbreviated cite text +sub help_replace_cites { + local ($key)= @_[0]; + $cite_info_first{$key}= 0; # not the first time anymore + if ($harvard_full || ($cite_info_first{$key} && $harvard_default)) { + $cite_info_full{$key}; # full citation + } + else{ + $cite_info_abbr{$key}; # abbreviated citation + } +} + +sub help_replace_shortcites { + local ($key)= @_[0]; + $cite_info_first{$key}= 0; # not the first time anymore + $cite_info_abbr{$key}; # abbreviated citation +} + +sub help_replace_fullcites { + local ($key)= @_[0]; + $cite_info_first{$key}= 0; # not the first time anymore + $cite_info_full{$key}; # full citation +} + +sub help_replace_name { + local ($key)= @_[0]; + if ($harvard_full || ($cite_info_first{$key} && $harvard_default)) { + $cite_info_full{$key}; # full citation + } + else{ + $cite_info_abbr{$key}; # abbreviated citation + } +} + + +#this one has to be changes as well, so that it finds all citemarks + +sub remove_general_markers { + s/$lof_mark/
    $figure_captions<\/UL>/o; + s/$lot_mark/
      $table_captions<\/UL>/o; + s/$bbl_mark/$citations/o; + &add_toc if (/$toc_mark/); + &add_idx if (/$idx_mark/); + &replace_cross_references if /$cross_ref_mark/; + &replace_external_references if /$external_ref_mark/; + &replace_cite_references; #just take the if out (not really neccessary) +} + + +1; # Not really necessary... + + + +# T.S.: added the starstar option +# If a normalized command name exists, return it. +sub normalize { + local($cmd) = @_; + local($ncmd); + if ($ncmd = $normalize{$cmd}) { + $ncmd} + elsif ($cmd =~ s/[*]/star/g) { + $cmd } + elsif ($cmd =~ s/^@/tex/) { + $cmd} + else {$cmd} +} + + +# does not really belong to harvard.perl, but as a general improvement + + +sub do_cmd_and { + join('',"

      ", @_[0]); #make a paragraph brake of it +} + +sub do_cmd_newline { + join('',"
      ", @_[0]); +} + -- cgit v1.2.3