3

I am using BibLaTeX, with the authordate-comp style. I have one citation where I cite seven citations for the same author for the same year, using \parencite. This results in a citation like (Author, 2000a,b,c,d,e,f,g), which is what I want. However, the citation falls near the end of a line, and there are apparently no line breaks allowed between the letters representing the multiple citations (where the commas are), and this results in the citation running into the margin. Here is a MWE:

\documentclass[12pt]{report}
\usepackage[left=1.5in, top=1.3in, right=1.3in, bottom=1.2in]{geometry}
\usepackage[style=authoryear-comp,backend=bibtex8]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{MWE.bib}
@misc{a1,
  author = {Author},
  title = {title1},
  date = {2000},
}
@misc{a2,
  author = {Author},
  title = {title2},
  date = {2000},
}
@misc{a3,
  author = {Author},
  title = {title3},
  date = {2000},
}
@misc{a4,
  author = {Author},
  title = {title4},
  date = {2000},
}
@misc{a5,
  author = {Author},
  title = {title5},
  date = {2000},
}
@misc{a6,
  author = {Author},
  title = {title6},
  date = {2000},
}
@misc{a7,
  author = {Author},
  title = {title7},
  date = {2000},
}
\end{filecontents*}

\addbibresource{MWE.bib}

\begin{document}
This citation has many works by one author from one year
\parencite{a1,a2,a3,a4,a5,a6,a7}. As you can see, the 
letters for repeated citations stick into the margin, 
and an ``Overfull /hbox'' warning is produced.
\end{document}

How can I make authordate-comp allow line breaks after the commas in the citation?

I have already thought of "rewrite the text so that the citation doesn't occur near the end of a line" and "just write the citation out by hand instead of using \parencite", but I'd like a more robust answer.

2

You can try and redefine the delimiter between the letters to allow a break.

Unfortunately, that particular delimiter is not accessible via a macro, but hard-coded into the cite bibmacro.

By default, biblatex does a \setunit{\addcomma}, but we can insert a \setunit{\addcomma\allowbreak}.

The following is a copy of authoryear-comp.cbx's definition of cite with one line modified

\makeatletter
\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}%
        \usebibmacro{cite:labelyear+extrayear}%
        \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\setunit{\addcomma\allowbreak}% <------ here
              \usebibmacro{cite:extrayear}}
             {\setunit{\compcitedelim}%
              \usebibmacro{cite:labelyear+extrayear}%
              \savefield{labelyear}{\cbx@lastyear}}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}%
           \usebibmacro{cite:labelyear+extrayear}%
           \savefield{namehash}{\cbx@lasthash}%
           \savefield{labelyear}{\cbx@lastyear}}}}
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}
\makeatother

MWE

\documentclass[12pt]{report}
\usepackage[left=1.5in, top=1.3in, right=1.3in, bottom=1.2in]{geometry}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{a1,
  author = {Author},
  title = {title1},
  date = {2000},
}
@misc{a2,
  author = {Author},
  title = {title2},
  date = {2000},
}
@misc{a3,
  author = {Author},
  title = {title3},
  date = {2000},
}
@misc{a4,
  author = {Author},
  title = {title4},
  date = {2000},
}
@misc{a5,
  author = {Author},
  title = {title5},
  date = {2000},
}
@misc{a6,
  author = {Author},
  title = {title6},
  date = {2000},
}
@misc{a7,
  author = {Author},
  title = {title7},
  date = {2000},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\makeatletter
\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}%
        \usebibmacro{cite:labelyear+extrayear}%
        \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\setunit{\addcomma\allowbreak}%
              \usebibmacro{cite:extrayear}}
             {\setunit{\compcitedelim}%
              \usebibmacro{cite:labelyear+extrayear}%
              \savefield{labelyear}{\cbx@lastyear}}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}%
           \usebibmacro{cite:labelyear+extrayear}%
           \savefield{namehash}{\cbx@lasthash}%
           \savefield{labelyear}{\cbx@lastyear}}}}
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}
\makeatother

\begin{document}
This citation has many works by one author from one year
\parencite{a1,a2,a3,a4,a5,a6,a7}. As you can see, the 
letters for repeated citations stick into the margin, 
and an ``Overfull /hbox'' warning is produced.
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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