summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/har2nat/har2nat.sty
blob: b99153b9153aa3042cc8a773118a5549868bbbba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% har2nat package written by Bas Straathof, 2005/12/01
% Eindhoven University of Technology, The Netherlands
% bas.straathof@gmail.com.
%
% This small package allows a LaTeX document containing the citation commands
% provided by the Harvard package (Peter Williams and Thorsten Schnier)
% to be compiled using the natbib package (Patrick W. Daly). Migration from
% harvard to natbib thus can be achieved simply by replacing
%
% \usepackage{harvard}
%
% with
%
% \usepackage{natbib}
% \usepackage{har2nat}
%
% ---IMPORTANT---
% har2nat must not be loaded before the natbib package as it redefines
% the natbib commands \cite and \citeyear. All other natbib commands remain
% unchanged and can be used alongside the Harvard commands.

\NeedsTeXFormat{LaTeX2e}    %
\ProvidesPackage{har2nat}[2005/12/01 1.0 Harvard to natbib]%
\RequirePackage{suffix}     % Requires eTeX version 2, needed for starred commands
\RequirePackage{natbib}     %

\renewcommand{\cite}{\citep}
\WithSuffix\newcommand{\cite}*{\citep*}
\newcommand{\citeaffixed}[2]{\citep[#2][]{#1}}
\newcommand{\citeasnoun}{\citet}
\WithSuffix\newcommand\citeasnoun*{\citet*}
\renewcommand{\citename}{\citeauthor}
\WithSuffix\newcommand\citename*{\citeauthor*}
\renewcommand\citeyear\citeyearpar
\WithSuffix\newcommand\citeyear*
   {\begingroup\NAT@swafalse\def\NAT@ctype{2}\NAT@parfalse\NAT@citetp}