Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to include only the first and the last author in my citations within the text. In case, there are only two authors, they should be connected by 'and'. For more than two authors, the remaining author names should be replaced by dots.

  • (1 author ) John Doe (2004)
  • (2 authors) John Doe and Peter Noel (2004)
  • (3 authors) John Doe, ..., Peter Noel (2004)

What I am looking for is some way of formatting it, so that the following commands, in particular 'FirstLast' gives me the desired output.

\DeclareCiteCommand{\longcite}{}{%
 \printnames[FirstLast]{author} (\printfield{year}),    
 \printfield{journaltitle}}{;}{}

So my question is, what should FirstLast look like, to get the desired output?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Here is a possible redefinition of FirstLast name formatting directive

\DeclareNameFormat{FirstLast}{%
  \ifthenelse{\value{listtotal}=1}
    {#3\addspace\ifblank{#5}{}{#5\addnbspace}#1}
    {\ifthenelse{\value{listtotal}=2}
      {\ifthenelse{\value{listcount}<\value{listtotal}}
        {#3\addspace\ifblank{#5}{}{#5\addnbspace}#1\addspace}
        {\bibstring{and}\addspace#3\addspace\ifblank{#5}{}{#5\addnbspace}#1}}
      {\ifthenelse{\value{listcount}=1}
        {#3\addspace\ifblank{#5}{}{#5\addnbspace}#1\addcomma\addspace\dots\isdot\addcomma}
        {\ifthenelse{\value{listcount}<\value{listtotal}}
          {}
          {\addspace#3\addspace\ifblank{#5}{}{#5\addnbspace}#1}}%
      }%
    }%
}

producing

enter image description here

share|improve this answer
    
The problem here is that for more than two authors, I only get John Doe, ..., (2004), JournalXY. What I would need is John Doe, ..., LastAuthor (2004), JournalXY. That's the tricky part for me. I only want to suppress the authors in between basically. –  glaux Oct 18 '13 at 12:48
    
You have to set maxcitenames to a large value (e.g., 999) otherwise it is truncated as in the example you report. maxcitenames is an option of biblatex –  Guido Oct 18 '13 at 22:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.