diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:56:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:56:41 +0000 |
commit | 4e7661e91a4e64f08f8d46c0974e05de23a49dd0 (patch) | |
tree | 3b505b5e1df08c6dfdd3abe58a52866c6279b0ad /Master/texmf-dist/tex/latex/harvard | |
parent | 754163d7156c4021b4108e3dbe0807c5357e6e22 (diff) |
harvard
git-svn-id: svn://tug.org/texlive/trunk@970 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/harvard')
-rw-r--r-- | Master/texmf-dist/tex/latex/harvard/harvard.sty | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/harvard/harvard.sty b/Master/texmf-dist/tex/latex/harvard/harvard.sty new file mode 100644 index 00000000000..9a4c64623f5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/harvard/harvard.sty @@ -0,0 +1,270 @@ +%% harvard.sty - harvard bibliography style Version 2.0.5 +%% Author: Peter Williams peterw@archsci.arch.su.edu.au +%% Copyright: Peter Williams 1994 +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{harvard} +\RequirePackage{ifthen} +\IfFileExists{html.sty}{\RequirePackage{html} +\newcommand{\harvardurl}[1]{\htmladdnormallink*{\textbf{URL:} \textit{##1}}{##1}} +}{ +\newcommand{\harvardurl}[1]{\textbf{URL:} \textit{##1}} +} +\DeclareOption{full}{\citationmode{full}} +\DeclareOption{abbr}{\citationmode{abbr}} +\DeclareOption{default}{\citationmode{default}} +\DeclareOption{agsmcite}{\citationstyle{agsm}} +\DeclareOption{dcucite}{\citationstyle{dcu}} +\DeclareOption{round}{\harvardparenthesis{round}\harvardyearparenthesis{round}} +\DeclareOption{curly}{\harvardparenthesis{curly}\harvardyearparenthesis{curly}} +\DeclareOption{angle}{\harvardparenthesis{angle}\harvardyearparenthesis{angle}} +\DeclareOption{square}{\harvardparenthesis{square}\harvardyearparenthesis{square}} +\DeclareOption{none}{\harvardparenthesis{none}\harvardyearparenthesis{none}} +\DeclareOption*{ + \global\edef\HAR@tmp{\CurrentOption} +%% Berwin A. Turlach <berwin@alphasun.anu.edu.au> + \AtEndDocument{\bibliographystyle{\HAR@tmp}} +} + +%% Kristoffer H. Rose <kris@diku.dk> 1995/03/01: +%% do not expand macros in citations: put definitions on .aux file instead. +{\catcode`\:=12 \catcode`\-=12 \catcode`\>=12 \catcode`\<=12 % + \gdef\codeof#1{\expandafter\codeof@\meaning#1<-:}% + \gdef\codeof@#1:->#2<-:{#2}} + +\def\harvardpreambletext{\catcode`\#=12 \harvardpreambletext@} +\def\harvardpreambletext@#1{\def\next{#1}\catcode`\#=6 % + \immediate\write\@auxout{\string\harvardpreambledefs{% + \string\AtBeginDocument{\codeof\next}}}} + +\def\harvardpreambledefs#1{#1\gdef\harvardpreambledefs##1{}} + +\newcommand{\harvarditem}[4][\null]{\item[]% +\if@filesw{ \def\protect##1{\string ##1\space}% +\ifthenelse{\equal{#1}{\null}} + {\def\next{{#4}{#2}{#2}{#3}}} + {\def\next{{#4}{#2}{#1}{#3}}} +\immediate\write\@auxout{\string\harvardcite\codeof\next}% +}\fi% +\protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces% +} + +\newcommand{\harvardcite}[4]{ + \global\@namedef{HAR@fn@#1}{#2} + \global\@namedef{HAR@an@#1}{#3} + \global\@namedef{HAR@yr@#1}{#4} + \global\@namedef{HAR@df@#1}{\csname HAR@fn@#1\endcsname} +} + +\newcommand{\citationmode}[1]{ + \renewcommand{\HAR@citemode}{\csname HAR@cite@#1\endcsname} +} + +\newcommand{\HAR@cite@full}{HAR@fn@} +\newcommand{\HAR@cite@abbr}{HAR@an@} +\newcommand{\HAR@cite@default}{HAR@df@} +\newcommand{\HAR@citemode}{\HAR@cite@default} + +\newcommand{\HAR@citetoaux}[1]{% + \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi% +} + +\newcommand{\HAR@checkdef}[2]{\@ifundefined{HAR@df@#1}% + {\textbf{?}\@warning{Citation '#1' on page \thepage \space undefined}}% + {#2}% +} + +\newcommand{\HAR@dolist}[2]{\def\@citea{\null}\@for\@citeb:=#1\do% +{\@citea\def\@citea{\HAR@hisep\penalty\@m\ }\HAR@checkdef{\@citeb}% +{#2{\@citeb}\HAR@hysep\penalty\@m\ % +\HAR@year{\@citeb}\HAR@setd{\@citeb}}}% +} + +\def\@enamedef#1{\expandafter\def\csname #1\expandafter\endcsname\expandafter} +\newcommand{\HAR@name}[1]{\csname \HAR@citemode#1\endcsname} +\newcommand{\HAR@fname}[1]{\csname HAR@fn@#1\endcsname} +\newcommand{\HAR@aname}[1]{\csname HAR@an@#1\endcsname} +\newcommand{\HAR@year}[1]{\csname HAR@yr@#1\endcsname} +\newcommand{\HAR@setd}[1]{% +\global\@enamedef{HAR@df@#1}{\csname HAR@an@#1\endcsname}% +} + +%% Berwin A. Turlach <berwin@alphasun.anu.edu.au> +\global\@namedef{HAR@df@*}{\csname HAR@fn@*\endcsname} +\renewcommand{\nocite}[1]{\HAR@citetoaux{#1}% +\@for\@citeb:=#1\do% +{\HAR@checkdef{\@citeb}{}}}% + +\renewcommand{\cite}{\@ifstar{\@ifstar{\HAR@acite}{\HAR@fcite}}{\HAR@dcite}} + +\newcommand{\HAR@dcite}[2][\null]{\HAR@citetoaux{#2}% +{\harvardleft\HAR@dolist{#2}{\HAR@name}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\HAR@acite}[2][\null]{\HAR@citetoaux{#2}% +{\harvardleft\HAR@dolist{#2}{\HAR@aname}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\HAR@fcite}[2][\null]{\HAR@citetoaux{#2}% +{\harvardleft\HAR@dolist{#2}{\HAR@fname}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\citeaffixed}{\@ifstar{\@ifstar{\HAR@aciteaff}{\HAR@fciteaff}}% +{\HAR@dciteaff}% +} + +\newcommand{\HAR@fciteaff}[3][\null]{\HAR@citetoaux{#2}% +{\harvardleft#3\ \HAR@dolist{#2}{\HAR@fname}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\HAR@aciteaff}[3][\null]{\HAR@citetoaux{#2}% +{\harvardleft#3\ \HAR@dolist{#2}{\HAR@aname}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\HAR@dciteaff}[3][\null]{\HAR@citetoaux{#2}% +{\harvardleft#3\ \HAR@dolist{#2}{\HAR@name}\ifthenelse{\equal{#1}{\null}}% + {}{, #1}\harvardright}% +} + +\newcommand{\citeasnoun}{\@ifstar{\@ifstar{\HAR@aciteasn}{\HAR@fciteasn}}% +{\HAR@dciteasn}% +} + +\newcommand{\HAR@fciteasn}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@fname{#2}\ \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\HAR@aciteasn}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@aname{#2}\ \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\HAR@dciteasn}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@name{#2}\ \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\possessivecite}{\@ifstar{\@ifstar{\HAR@acitepos}{\HAR@fcitepos}}% +{\HAR@dcitepos}% +} + +\newcommand{\HAR@fcitepos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@fname{#2}'s \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\HAR@acitepos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@aname{#2}'s \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\HAR@dcitepos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@name{#2}'s \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}} + {}{, #1}\harvardyearright}\HAR@setd{#2}}% +} + +\newcommand{\citename}{\@ifstar{\@ifstar{\HAR@acitenam}\HAR@fcitenam}% +{\HAR@dcitenam}% +} + +\newcommand{\HAR@fcitenam}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@fname{#2}\ifthenelse{\equal{#1}{\null}} + {}{\ \harvardleft#1\harvardright}}}% +} + +\newcommand{\HAR@acitenam}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@aname{#2}\ifthenelse{\equal{#1}{\null}} + {}{\ \harvardleft#1\harvardright}}}% +} + +\newcommand{\HAR@dcitenam}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{% +{\HAR@name{#2}\ifthenelse{\equal{#1}{\null}} + {}{\ \harvardleft#1\harvardright}}}% +} + +\newcommand{\citeyear}{\@ifstar{\HAR@citeyrnb}{\HAR@citeyr}} + +\newcommand{\HAR@citeyrnb}[2][\null]{\HAR@citetoaux{#2}% +{\def\@citea{\null}\@for\@citeb:=#2\do% +{\@citea\def\@citea{\HAR@hisep\penalty\@m\ }\HAR@checkdef{\@citeb}% +{\HAR@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}% +{}{, #1}}% +} + +\newcommand{\HAR@citeyr}[2][\null]{\HAR@citetoaux{#2}% +{\harvardleft\def\@citea{\null}\@for\@citeb:=#2\do% +{\@citea\def\@citea{\HAR@hisep\penalty\@m\ }\HAR@checkdef{\@citeb}% +{\HAR@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}% +{}{, #1}\harvardright}% +} + +\newcommand{\HAR@hysep@apsr}{\null} +\newcommand{\HAR@hisep@apsr}{;} +\newcommand{\HAR@hysep@agsm}{\null} +\newcommand{\HAR@hisep@agsm}{,} +\newcommand{\HAR@hysep@dcu}{,} +\newcommand{\HAR@hisep@dcu}{;} +\newcommand{\HAR@and@agsm}{\&} +\newcommand{\HAR@and@dcu}{and} +\newcommand{\HAR@and@apsr}{and} +\newcommand{\HAR@hysep}{\HAR@hysep@agsm} +\newcommand{\HAR@hisep}{\HAR@hisep@agsm} +\newcommand{\harvardand}{\HAR@and@agsm} +\newcommand{\citationstyle}[1]{% + \renewcommand{\HAR@hysep}{\csname HAR@hysep@#1\endcsname} + \renewcommand{\HAR@hisep}{\csname HAR@hisep@#1\endcsname} + \renewcommand{\harvardand}{\csname HAR@and@#1\endcsname} +} + +\newcommand{\HAR@bl@round}{(} +\newcommand{\HAR@br@round}{)} +\newcommand{\HAR@bl@square}{[} +\newcommand{\HAR@br@square}{]} +\newcommand{\HAR@bl@curly}{\{} +\newcommand{\HAR@br@curly}{\}} +\newcommand{\HAR@bl@angle}{$<$} +\newcommand{\HAR@br@angle}{$>$} +\newcommand{\HAR@bl@none}{} +\newcommand{\HAR@br@none}{} +\newcommand{\harvardleft}{\HAR@bl@round} +\newcommand{\harvardright}{\HAR@br@round} +\newcommand{\harvardparenthesis}[1]{ + \renewcommand{\harvardleft}{\csname HAR@bl@#1\endcsname} + \renewcommand{\harvardright}{\csname HAR@br@#1\endcsname} + \harvardyearparenthesis{#1} +} + +\newcommand{\harvardyearleft}{\HAR@bl@round} +\newcommand{\harvardyearright}{\HAR@br@round} +\newcommand{\harvardyearparenthesis}[1]{ + \renewcommand{\harvardyearleft}{\csname HAR@bl@#1\endcsname} + \renewcommand{\harvardyearright}{\csname HAR@br@#1\endcsname} +} + +\newcommand{\HAR@checkcitations}[4]{ + \def\HAR@tempa{#2}\expandafter + \ifx \csname HAR@fn@#1\endcsname \HAR@tempa + \def\HAR@tempa{#3}\expandafter + \ifx \csname HAR@an@#1\endcsname \HAR@tempa + \def\HAR@tempa{#4}\expandafter + \ifx \csname HAR@yr@#1\endcsname \HAR@tempa + \else + \@tempswatrue + \fi + \else + \@tempswatrue + \fi + \else + \@tempswatrue + \fi +} + +\AtEndDocument{\renewcommand{\harvardcite}{\HAR@checkcitations}} + +\ExecuteOptions{agsm,agsmcite,default,round} +\ProcessOptions* |