32

I would like to know the best practice to get "universal" cite commands.

Across the different articles, I have written, each has had a different template for a different publication venue. And, each template seems to be paired with their own unique commands for citations: \cite, \autocite, \citep, \citeN, \citeyear, etc...

In the spirit of separating content and styling, I would like to make it so that I can easily switch templates, without having to --Replace All-- of one cite command for another.

So, my question is this: What is the best tactic to obtain universal cite commands? Does the choice of BibTex or BibLatex make a difference with regards to cite commands? Or should I define new commands that make use of template defined commands.

In addendum, I would like to ask, if defining new commands is the way to go, can you please supply an example of how to define new commands making use of existing cite commands?

Hope this is clear. Thanks in advance! =)


UPDATE: I see that \autocite allows for one to choose the formatting of the command to produce parenthesis or footnote citations. This is, however, not the functionality that I seek. For example, if we look at the ACM latex template (acmsmall): http://www.acm.org/publications/latex_style/

The documentation states the following, "If you mention the work explicitly in your prose, you should use \citeN command. This command generates for example, Nielson [1985] discusses denotational program transformations. Or, you use \citeyear and say that Nielson [1985] discusses them." The documentation continues to define other commands like \citeNP also.

If I format my text using these commands, but then switch templates, I must replace all the citation commands, depending on what is defined by the other templates. What I would like to do is define my own abstraction layer of commands, that I can change to adhere to each of the different templates. If I use \citeN at the start of my sentence, but the next template doesn't define this command, I would like to define it myself. Thereby slowly building up a set of citation commands that are "universal". Is this the best practice, or is there a better way to go about this?

I see the possibility of declaring cite commands in: renewcommand \cite[99]{Turing} vs. \cite{Turing}

Please let me know if there is more confusion.

13
  • 1
    In biblatex, you can choose the behavior of \autocite.
    – Crissov
    Feb 4, 2014 at 11:33
  • 1
    If a particular (more or less standard) cite command is not provided by a template you use, you might try to define it yourself. § 3.7 Citation Commands of the biblatex manual gives an overview on available commands in biblatex. If you want to normalise your writing, you might want to take that list as the starting point: Try to use only commands on that list, and if a particular style/template does not provide a command, define it yourself.
    – moewe
    Feb 25, 2014 at 16:28
  • 2
    The problem with having a uniform citation "API" is that you may need to restrict to those features supported by ALL the "backends", and since there is quite a discrepancy between say pure LaTeX and BibLatex, that could make the approach rather unhelpful...Which backends would you like to switch between?
    – Bordaigorl
    Feb 25, 2014 at 18:31
  • 2
    There is a further, or perhaps higher-level, consideration here: namely, how the citation is supposed to fit into the sentence grammatically. Usually, author-year citations -- e.g., Smith 2000 -- are treated (in English, at least) as a single noun phrase, where author-title citations are emphatically not noun phrases, but a noun (= author) + a location pointer (and thus almost a parenthetical aside). The two citation types thus fit into a sentence very differently from a grammatical point of view. I don't think an abstracted citation command will ever (trivially?) solve this problem...
    – jon
    Feb 25, 2014 at 20:40
  • 1
    That said, it is an interesting question, and I will welcome being proven wrong! (One further point regarding my earlier comment: I usually work in fields where discursive footnotes are common, so citations are often incorporated into these footnotes is a verbose kind of way. If I switch citation styles, say from author-year to author-title, many [not all] notes tend to need some degree of re-writing.)
    – jon
    Feb 25, 2014 at 20:41

2 Answers 2

35
+50

If you really want to have one set of citation commands, a good starting point seems to be the list of commands provided by biblatex (or rather its standard styles), as outlined in § 3.7 Citation Commands, p. 79 of the biblatex documentation.

You should then use the appropriate command for the task at hand. I have listed some of the commands I regard as elementary (and their use cases) below. Note that all biblatex cite commands come with a 'capitalised version' (the first letter of the command name is capitalised) that should be used at the beginning of sentences, those commands capitalise the first word they print (e.g., \cite and \Cite).

Your go-to command should be \autocite or \cite. I prefer \autocite, but I can definitely understand if people prefer \cite because it is shorter and more to the point.

If you only have one style for citations in your document, configure \autocite so that it gives the expected output. If you have several different styles, configure \autocite to give the most common style.

Use

  • \cite to refer to the work itself as the subject (or object) of a sentence. For example:

    In \cite{foo} we can find a very interesting discussion of that matter.

  • \parencite for parenthetical citations, for example to give the exact source of a particular quote:

    "The toaster is the greatest invention since sliced bread" \parencite[14]{foo}

    Ideally, you wouldn't even use \parencite directly, you'd use the high-level \autocite command together with the appropriate autocite option for citations like these.

  • \footcite for citations in footnotes; in my experience the use cases of \parencite and \footcite are very similar, one will probably use one or the other, but there is \autocite to take care of that.

  • \textcite to obtain the author/editor (as the subject of a sentence) and a parenthetical reference to the particular work.

    \Textcite{foo} found something.

  • \citeauthor/\citeyear/\citetitle to print just the author, year, title the entry. Only use this if you need to refer to the year, title etc., do not use those commands to mimic the behaviour of \textcite. That is: Do not write \citeauthor{foo} (\citetitle{foo}) found ... if you use a author-title style, because you might change to a author-year style which would require \citeauthor{foo} (\citeyear{foo}) found .... Use \textcite{foo} found ... instead.

    When \citeauthor{foo} wrote his first work titled \citetitle{foo} in \citeyear{foo} ...

Most (if not all) biblatex styles should come with at least that set of commands. So you should be fine there.

If, however, you use templates that do not rely on biblatex, you could try to define the set of commands below. In your example, \citeN seems to be equivalent to \textcite, so you could tell LaTeX to \let\textcite\citeN and use \textcite in your document. (Of course, the publisher might not be particularly happy about this seemingly nonsensical \letting around of macros, but that's another story.) If you use a template with an author-year style that does not provide a \textcite you might define it yourself via

\newcommand{\textcite}[1]{\citeauthor{#1} (\citeyear{#1})}

Of course this definition does not at all take care of pre- and postnotes, but it might be enough to get along in one document. If you use biblatex you should use \DeclareCiteCommand and internal bibmacros instead, but that might get more involved.

If your template does not offer an \autocite but does have a \parencite equivalent, do not hesitate to \let\autocite\parencite so you can use \autocite consistently throughout all of your documents.

You see, there is no easy solution that can be applied to normalise bibliography styles in different templates. One will always have to look very thoroughly at the commands provided, and - at best - can hope to find (or define) commands equivalent to the "standard" macros one expects to find. But this can at times be quite a tough ask.

8
  • 2
    +1. How citations fit into text is very much context-dependent. I don't think it can just be a matter of having one \superclevercite command, even if it can be very helpful in maximizing portability in many/several contexts by virtue of its super-cleverness.
    – jon
    Feb 25, 2014 at 20:49
  • 1
    @jon One \superclevercite is most certainly a pie in the sky. A set of commands seems just about feasible, but is quite some work to get consistent across all templates/bibliography styles.
    – moewe
    Feb 25, 2014 at 20:54
  • @moewe One caveat with the method you describe above is that there might be conflicts between commands that have already been defined in the templates. So, I would guess (being a programmer) that I would define my own \plgcite or whatever instead. You mention, "what the publish might not like" and this is also part of my concern. In addition, why do you suggest \newcommand instead of DeclareCiteCommand found in the related question I linked above?
    – PLG
    Feb 26, 2014 at 10:28
  • @PLG Sure, some naming conflicts might arise and you will have to deal with those, the list above was just a suggestion, you do not have to use exactly those names; if you do stick to that naming scheme, however, there will be little to no modification necessary to work with biblatex. The concern regarding the publisher cannot be ignored: If they really want you to use their commands (and don't look favourably on you defining, redefining and renaming commands), you will have to do that - even if that means deviating from your universal scheme.
    – moewe
    Feb 26, 2014 at 10:46
  • 2
    @PLG \DeclareCiteCommand is a biblatex command and therefore not available all the time (I would argue that if its is available, i.e. if you use biblatex, you will probably not have to define a lot of new commands anyway - if the template/style is well-coded [most are]). If you can use \DeclareCiteCommand use it; the \newcommand example above will not be able to deal with pre and postnotes and the like: it is rather a kludge than a citation command one should use extensively. This illustrates the point that normalising such a vast number of styles cannot be easy.
    – moewe
    Feb 26, 2014 at 10:48
1

Though question. First, the \citeN, \citeNP and so commands you mention presumably have different meaning, and their differences can't be (easily) automatized, leaving the author the task to select the appropiate one.

Next point is that one venue uses one set of cite commands, the other a different set. I'd wagger the sets aren't completely interchangeable, so defining your own set to translate into each set won't help either.

Then there is the requirement by the publishers that the authors don't define their own macros. This is understandable, they don't want to get burdened with having to learn your particular toolset for your paper (one among a hundred or so they have to handle this month).

A (partial) solution would be to use commands in a style that an external program translates to the particular set used before shipping off the finished LaTeX version, in which your style is stripped.

In any case, when I had to change a paper from one publication style to another it was much more work to fix title, authors, author information as requested, figure/table style; changing the citation style was mostly incidental. Why is this so much of a chore to you?

1
  • " I'd wagger the sets aren't completely interchangeable, so defining your own set to translate into each set won't help either." Defining my own commands that translate to each of the templates would be my first guess, why would this not work. I find it a chore to search through my texts just to replace citation commands. I also find it a chore when the templates don't support the commands I want. This is why I want a universal solution. Short answer, I'm not a copy/paste programmer.
    – PLG
    Feb 26, 2014 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .