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.

With biblatex, the author can be replaced by a dash (or “idem”) in the bibliography. Is it possible to have this replacement also if there are multiple authors, and the first of these multiple authors is the same as the author of the book listed before? (It is somewhat difficult to describe, see the attached example instead, where “Buchautor, Hans-Wilhelm” should be replaced in book3 as well.)

I assume that it should be possible by customising \DeclareNameFormat, but I don’t know how.

Minimal example:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{book1,
  author = {Buchautor, Hans-Wilhelm},
  title = {Irgendein Buch},
  location = {Buch am Wald},
  date = {2000}
}
@BOOK{book2,
  author = {Buchautor, Hans-Wilhelm},
  title = {Ein anderes Buch},
  location = {Berlin},
  date = {2001}
}
@BOOK{book3,
  author = {Buchautor, Hans-Wilhelm and Zweitautor, Zoran},
  title = {Noch ein Buch},
  location = {London and New York},
  date = {2010}
}
\end{filecontents}

\usepackage[
style=authortitle,
backend=bibtex8
]{biblatex}
\bibliography{\jobname}

\renewcommand*{\bibnamedash}{%
  \bibstring[\mkbibbold]{idem\thefield{gender}}}

\begin{document}
\nocite{*}

\printbibliography
\end{document}

Edit 15/02/2011 17:14

I should have added that there was a feature request for biber which pointed back to biblatex. See this feature request.

Edit 21/06/2011 9:26

Is this somehow possible now with biblatex 1.4/1.5? I played a bit with uniquename/uniquelist, but I could not get it to work.

share|improve this question
    
I guess you've considered doing this 'by hand', saving each name to a macro as it's formatted, and then doing a comparison when you format the next name? –  Joseph Wright Feb 15 '11 at 16:07
    
@Joseph: Yes, this would be my approach, too. –  domwass Feb 15 '11 at 16:15
    
with maxnames=1 you'll get different namehash and fullhash values which can be used for saving the last name into \bbx@lasthash. The only problem is that namehash with maxnames=1 is not the same with only one author. In your example biber returns BHW1 and BHW+1. It would be really easy to solve if biber will return a firsthash value, which doesn't have the +, then it can be done. –  Herbert Feb 15 '11 at 17:10

2 Answers 2

up vote 5 down vote accepted

The leading names in the current author/editor could be compared with the previous bibliography entry's author/editor using internal lists from etoolbox. These lists can be built up with \indexnames.

Some counters and tracking of the last entry's gender field help ensure that the names are properly delimited and use of the appropriate idem bibliography string.

For simplicity I've assumed no truncation of author/editor. It is possible to permit truncation. However the resulting style would be rather ambiguous; recurrent andothers read identically, but could refer to different authors/editors.

The solution could definitely be made more efficient, probably with the use of a routine that drops a specified number of elements from the end of a given list. It could also make smarter use of information available in the gender field, either from entries before just the last one or from the current entry.

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authortitle,% Based on this style
            maxbibnames=99,% Solution assumes no truncation
            backend=biber,% Needed if using hash field
            sorting=nyt,
            abbreviate=false]{biblatex}

\newcounter{bbx:idemcount}
\newcounter{bbx:namecount}

\newbibmacro*{bbx:printlist}[1]{%
  \global\csundef{bbx:namelist}%
  \global\csundef{bbx:checklist}%
  \setcounter{bbx:namecount}{0}%
  \indexnames[bbx:checklist]{#1}%
  \ifcsequal{bbx:checklist}{bbx:idemlist}
    {\ifnumequal{\value{bbx:namecount}-\value{bbx:idemcount}}{1}
       {\let\finalandcomma=\empty}
       {}%
     \printnames[idem:first-last]{#1}}
    {\printnames{#1}}}

\DeclareIndexNameFormat{bbx:checklist}{%
  \addtocounter{bbx:namecount}{1}%
  \listcsxadd{bbx:namelist}{\thefield{hash}}% Or #4 #5 #1 might be sufficient
  \ifnumgreater{\value{listcount}}{\value{bbx:idemcount}}
    {}
    {\listcsxadd{bbx:checklist}{\thefield{hash}}}}

% authortitle uses sortname format - i.e. last-first/first-last
% Use \biblstring \bibxlstring for long idem, irrespective of
% the abbreviate option setting
\DeclareNameFormat{idem:first-last}{%
  \ifnumequal{\value{listcount}}{1}
    {\ifboolexpr{ test {\ifbibxstring{idem\csuse{bbx:idemgender}}}
                  and test {\ifcsdef{bbx:idemgender}} }
       {\bibstring[\mkbibbold]{idem\csuse{bbx:idemgender}}}
       {\ifnumgreater{\value{bbx:idemcount}}{1}
          {\bibstring[\mkbibbold]{idempn}}
          {\bibstring[\mkbibbold]{idemsn}}}}
    {\ifnumgreater{\value{listcount}}{\value{bbx:idemcount}}
       {\iffirstinits
          {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
          {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}
       {}}}

\newbibmacro*{bbx:savelist}{%
  \savefieldcs{gender}{bbx:idemgender}%
  \setcounter{bbx:idemcount}{\value{bbx:namecount}}%
  \csxdef{bbx:idemlist}{\csuse{bbx:namelist}}}

\renewbibmacro*{author}{%
  \ifboolexpr{ test {\ifuseauthor}
               and not test {\ifnameundef{author}} }
    {\usebibmacro{bbx:printlist}{author}%
     \setunit{\addcomma\space}%
     \usebibmacro{bbx:savelist}%
     \usebibmacro{authorstrg}}
    {\global\csundef{bbx:idemlist}%
     \setcounter{bbx:idemcount}{0}}}

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{ test {\ifuseeditor}
               and not test {\ifnameundef{editor}} }
    {\usebibmacro{bbx:printlist}{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{bbx:savelist}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\global\csundef{bbx:idemlist}%
     \setcounter{bbx:idemcount}{0}}}

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{ test {\ifusetranslator}
               and not test {\ifnameundef{translator}} }
    {\usebibmacro{bbx:printlist}{translator}%
     \setunit{\addcomma\space}%
     \usebibmacro{bbx:savelist}%
     \usebibmacro{#1}%
     \clearname{translator}}
    {\global\csundef{bbx:idemlist}%
     \setcounter{bbx:idemcount}{0}}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{book1,
  author = {Buchautor, Emma-Louise},
  gender = {sf},
  title = {First Title},
  date = {2001}}
@BOOK{book2,
  author = {Buchautor, Emma-Louise},
  title = {Same female author},
  date = {2002}}
@BOOK{book3,
  author = {Buchautor, Emma-Louise and van Helsing, Sarah},
  gender = {pf},
  title = {Same first author whose gender is unspecified},
  date = {2003}}
@BOOK{book4,
  author = {Buchautor, Emma-Louise and van Helsing, Sarah and Knuth, Donald E.},
  gender = {pp},
  title = {Same first and second female authors},
  date = {2004}}
@BOOK{book5,
  editor = {Buchautor, Emma-Louise and van Helsing, Sarah and Knuth, Donald E. and Cicero, Marcus Tullius},
  gender = {pp},
  title = {Same leading names of mixed genders},
  date = {2005}}
@BOOK{book6,
  editor = {van Helsing, Abraham},
  title = {Different name},
  date = {2006}}
@BOOK{book7,
  author = {van Helsing, Abraham},
  gender = {sm},
  translator = {van Helsing, Abraham},
  title = {Same male name},
  date = {2007}}
@BOOK{book8,
  editor = {van Helsing, Abraham and Jackson, Tom},
  gender = {pm},
  translator = {Cicero, Marcus Tullius},
  title = {Same first male author},
  date = {2008}}
@BOOK{book9,
  author = {van Helsing, Abraham and Jackson, Tom},
  title = {Same male names},
  date = {2009}}
@BOOK{book10,
  author = {van Helsing, Abraham and Jackson, Tom},
  gender = {pm},
  title = {Same authors of unspecified gender},
  date = {2010}}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

For comparison here is the same bibliography generated with no changes to the authortitle bibliography macros:

enter image description here

share|improve this answer
    
Thanks for this approach, @Audrey. Your example works here. As soon as I will find some time (i.e. not soon …), I will have a closer look at your solution. –  domwass Sep 25 '11 at 14:09
    
@domwass You're welcome. I can understand the criticisms of the style, but the question is still an interesting one. This solution does need some more thorough testing. I'll make an edit to clean up the code and clarify the example. –  Audrey Sep 25 '11 at 19:15

AFAIK this is not possible yet. The is a limitation of the traditional bibtex format. You cannot really handle individual persons in the author field (the same problem rears its ugly head when it comes to things as name prefixes or gender which can't be set for one author if there are several persons in the author field). I know that this will be improved in later biber versions (the TODO says version 1.3).

EDIT: I'm also not sure if this behaviour in your case is really desirable. As long as the style doesn't demand it I wouldn't do that. After all, the dash is meant to indicate that the authorship is identical, but if there are several authors, the authorship has changed.

share|improve this answer
    
@Simifilm: Thanks for your answer. I also thought that this would not be possible with BibTeX. However, the biblatex/biber maintainers seem to think differently. See the link to the feature request in my edited question. Regarding the desire: As you said, some style guides require it, so it would be nice to have this feature. I would also not combine it with a dash, only with an idem string (so my question was somewhat vague, in this point). –  domwass Feb 15 '11 at 16:17
    
@domwass: I'd like to see the exact definition of these requirements -- I can imagine several cases where the meaning of "idem" would be ambiguous. –  lockstep Feb 15 '11 at 18:30
    
@lockstep: I don’t have exact requirements at hand, but I know that I have seen this before. Which cases do you think of as possibly being ambiguous? –  domwass Feb 15 '11 at 19:53
    
@domwass: For example (numbers representing list items, single letters representing author names): (1) A and B (2) A and B (3) A, B and C (4) A and C. –  lockstep Feb 15 '11 at 20:00
    
@lockstep: (1) A and B (2) eidem (German “dieselben”), (3) eidem and C (4) A and C. (c: I know it’s not the nicest style … –  domwass Feb 15 '11 at 20:18

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.