Using alternative citation forms in SWP

Philip A. Viton

September 8, 2003

1 Introduction

Some citation packages like Patrick Daly’s natbib provide alternative forms of the \cite command: for example, there’s a cite-as-noun style using the macro \citet whereby \citet{viton:2000} would appear in the text as Viton (2000) while \cite{viton:2000) would appear as (Viton, 2000). Other forms may also be provided, for example one in which \citename{viton:2000) produces just Viton, or \citeyear{viton:2000) which produces just the year, 2000 (these last two are not available in natbib but do appear in Peter Williams’ harvard system; in this system the noun form is called \citeasnoun) . SWP has no facilities to support these directly, but there is a way to use them, as I’ll show here.

2 What do you want to do?

There are two situations you might encounter.

2.1 Changing all citations

First, you want all the citations to in your document to be of a given form, for example noun-like. This is extremely easy to set up: you just redefine the meaning of the \cite command. Suppose you want to use natbib’s cite-as-noun form throughout your document. Then just put the following line in the document preamble (if you load the natbib package in the preamble, as opposed to the Typeset -> Options and packages dialog, be sure that this command comes after loading the package):


where \citet is the macro you want to use for all your citations. You can now write your document as usual, and when you typeset it, all the citations will come out in the changed (here, \citet) form.

2.2 Mixing citation types

If you want to mix citation forms in your document, it’s a bit more complicated. The solution I’ve come up with is to create a series of Fragments, each one of which redefines the meaning of the \cite command. Then when you want to use one of the non-standard forms, you insert the appropriate fragment, followed by the \cite command generated by SWP. The only downside to this is that you must be consistent, and use one of the Fragments each time you enter a \cite: if you don’t do this, then \cite will be translated to whatever form you used last, which may not be what you want. In particular, if you want to use the standard \cite after you’ve used one of the additional forms, you’ll need to define a Fragment for it, too.

The new Fragments are very simple. Suppose you want to create a fragment for the \citet macro.

Repeat this for any other cite forms you plan to use.

Next, you should create a fragment for the standard form of the \cite command. Just how you do this depends on the facilities provided by the citation package you’re using. There are two possibilities.