2

Trouble in using biblatex package here !

In authortitle style, author's name is automatically replaced by a dash in the bibliography when printing multiple works written by the same author :

enter image description here

In apa style however (in application of APA 6.25) these dashes don't show and the author's name is repeated before each work :

enter image description here

I would like to keep the APA style for my citations and bibliography, but to get dashes instead of repeated author's name. I tried searching for answers in the apa.bbx file, but I'm new to LaTeX and don't know where to start.

I forgot to mention that I'm using apa style in french, if that is worth mentioning.

So, here is what I got for now :

\documentclass{article}

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{polyglossia}
\usepackage[style=apa, dashed=true, doi=false, isbn=false, url=false, backend=biber, sorting=nyt]{biblatex}
\DeclareLanguageMapping{french}{french-apa}

\setmainlanguage{french}

\bibliography{/example.bib}

\begin{document}
\part{Sources}
\printbibliography
\nocite{*}

\end{document}

And for my example.bib file :

  @Misc{breen_yasukuni_2005,
  author = {Breen, John},
  title = {Yasukuni {Shrine}: {Ritual} and {Memory} {\textbar} {The} {Asia}-{Pacific} {Journal}: {Japan} {Focus}},
  date = {2005-06},
  journaltitle = {The Asia-Pacific Journal: Japan Focus},
  url = {http://apjjf.org/-John-Breen/2060/article.html},
  urldate = {2016-10-26},
}
  @Book{breen_yasukuni_2007,
     title = {Yasukuni, the war dead and the struggle for {Japan}'s past},
     publisher = {C. HURST \& CO. PUBLISHERS},
     author = {Breen, John},
     date = {2007},
}
  @Article{breen_resurrecting_2010,
     author = {Breen, John},
     title = {Resurrecting the {Sacred} {Land} of {Japan}},
     volume = {37},
     number = {2},
     pages = {295--315},
     date = {2010},
     journaltitle = {Japanese Journal of Religious Studies},
}
  @Book{breen_shinto_2000,
     title = {Shinto in history: ways of the kami},
     publisher = {University of Hawaiʻi Press},
     author = {Breen, John and Teeuwen, Mark},
     note = {OCLC: 43487317},
     date = {2000},
     location = {Honolulu},
}
  @Book{breen_new_2010,
     title     = {A new history of {Shinto}},
     publisher = {Wiley-Blackwell},
     author    = {Breen, John and Teeuwen, Mark},
     date      = {2010},
}   
  @Book{casanova_public_2011,
     title = {Public religions in the modern world},
     publisher = {University of Chicago Press},
     author = {Casanova, José},
     date = {2011},
}
Vic L.
  • 99
  • 2
    If would be awesome if you could provide the community with a minimal working example so we can recreate your setup. It just makes providing you with answers so much more convenient. It should start with \documentclass and end with \end{document}, and allow us to copy-and-paste-and-compile and see exactly what you're seeing. For more information, please read I've just been asked to write a minimal example, what is that? Note that for a bibliography, include that as part of your minimal example. – Werner Apr 24 '17 at 22:13

1 Answers1

3

Using dashes in your bibliography will (probably) make your document not compliant with APA style any more, so be warned. Note that your biblatex-apa packages seems to be quite outdated.

Fortunately, some of what we need is already implemented in apa.bbx, but we need to add a bit more on top.

\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber, dashed=true]{biblatex}
\DeclareLanguageMapping{french}{french-apa}

\addbibresource{biblatex-examples.bib}

\makeatletter
\renewbibmacro*{begrelated}{%
  \booltrue{bbx@inset}}

\renewbibmacro*{endrelated}{%
  \usebibmacro*{bbx:savehash}}

\newbibmacro*{bbx:dashcheck}[2]{%
  \ifboolexpr{
    test {\iffieldequals{fullhash}{\bbx@lasthash}}
    and
    not test \iffirstonpage
    and
    (
       not bool {bbx@inset}
       or
       test {\iffieldequalstr{entrysetcount}{1}}
    )
  }
    {#1}
    {#2}}

\renewbibmacro*{author}{%
  \ifnameundef{author}
    {\usebibmacro{labeltitle}%
     \global\undef\bbx@lasthash}
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\printnames[apaauthor][-\value{listtotal}]{author}%
        \usebibmacro{bbx:savehash}}%
     \setunit*{\addspace}%
     \printfield{nameaddon}%
     \ifnameundef{with}
       {}
       {\setunit{}\addspace\mkbibparens{\printtext{\bibstring{with}\addspace}%
        \printnames[apaauthor][-\value{listtotal}]{with}}
        \setunit*{\addspace}}}%
  \newunit\newblock%
  \usebibmacro{labelyear+extrayear}}

\renewbibmacro*{editorinauthpos}{%
  \global\booltrue{bbx:editorinauthpos}%
  \usebibmacro{bbx:dashcheck}
    {\bibnamedash}
    {\printnames[apaauthor][-\value{listtotal}]{editor}}%
  \setunit{\addspace}%
  \ifnameundef{editor}
    {\global\undef\bbx@lasthash}
    {\usebibmacro{bbx:savehash}%
     \printtext[parens]{\usebibmacro{apaeditorstrg}{editor}}%
    % need to clear editor so we don't get an "In" clause later
     % But we also need to set a flag to say we did this so we
     % don't lose sight of the fact we once had an editor for
     % various year placement tests
     \clearname{editor}%
     \setunit{\adddot\addspace}%
     \usebibmacro{labelyear+extrayear}%
     \setunit{\adddot\addspace}}}
\makeatother

\begin{document}
\cite{sigfridsson,knuth:ct:d,knuth:ct:c,knuth:ct:a}
\printbibliography
\end{document}

bibliography of MWE

moewe
  • 175,683