1

I used the following custom style to create a bibliography matching the requirements of our institution: Creating a bibliography with fixed indention and authoryear labels using biblatex and biber

It successfully creates a bibliography with labels and intended entries. However, the label looks like this:

author year

This is true for both the in-text citation and the label in bibliography. What I need is

author year     [at position of \parencite]

author (year)     [in bibliography]
         rest of bibliography entry

  • If you have applied any changes to the code in the other answer an MWE of what you have now would be appreciated (and is probably necessary to make sure everything works as expected). – moewe Feb 6 '17 at 12:17
1

With biblatex-ext as suggested in the update to Creating a bibliography with fixed indention and authoryear labels using biblatex and biber this is much easier now. You can simply redefine the inner cite delims of bbx@introcite.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=ext-authoryear, backend=biber, introcite=label, dashed=false]{biblatex}
\addbibresource{biblatex-examples.bib}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{6em}

\DeclareInnerCiteDelims{bbx@introcite}{\bibopenparen}{\bibcloseparen}

\begin{document}
\cite{sigfridsson,worman,geer,knuth:ct:a}
\printbibliography
\end{document}

You only need \usebibmacro{textcite} instead of \usebibmacro{cite} as well as a few tiny modifications for textcite.

The only part that is changed from the other answer to Creating a bibliography with fixed indention and authoryear labels using biblatex and biber is

\newbibmacro{labelwidthbib}{%
  \begingroup
  \DeclareFieldFormat{bibhyperref}{##1}%
  \csuse{blx@hook@cite}%
  \csuse{blx@hook@citekey}%
  \citetrackerfalse\pagetrackerfalse\backtrackerfalse
  \global\undef\cbx@lasthash
  \global\undef\cbx@lastyear
  \defcounter{maxnames}{\blx@maxcitenames}%
  \boolfalse{cbx:parens}%
  \usebibmacro{textcite}%
  \ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
  \endgroup
} 

In total

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,backend=biber,dashed=false]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}

\newsavebox\ay@labelbox
\newlength{\labwidthsameline}
\setlength{\labwidthsameline}{6em}

\newbibmacro{labelwidthbib}{%
  \begingroup
  \DeclareFieldFormat{bibhyperref}{##1}%
  \csuse{blx@hook@cite}%
  \csuse{blx@hook@citekey}%
  \citetrackerfalse\pagetrackerfalse\backtrackerfalse
  \global\undef\cbx@lasthash
  \global\undef\cbx@lastyear
  \defcounter{maxnames}{\blx@maxcitenames}%
  \boolfalse{cbx:parens}%
  \usebibmacro{textcite}%
  \ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
  \endgroup
} 
%-----------------------
\newbibmacro{kicklabel}{% 
  \sbox\ay@labelbox{\usebibmacro{labelwidthbib}}%
  \global\togglefalse{blx@insert}%
  \ifdim\wd\ay@labelbox>\labwidthsameline
    \leavevmode\newline
  \fi
}

\defbibenvironment{bibliography}%
  {\list
    {\usebibmacro{labelwidthbib}}%
    {\setlength{\labelwidth}{\labwidthsameline}%
     \setlength{\leftmargin}{\labelwidth}%
     \setlength{\labelsep}{\biblabelsep}%
     \addtolength{\leftmargin}{\labelsep}%
     \setlength{\itemsep}{\bibitemsep}%
     \setlength{\parsep}{\bibparsep}%
     \renewcommand*{\makelabel}[1]{##1\hss}}}%
  {\endlist}%
  {\item\usebibmacro{kicklabel}}
\makeatother

\begin{document}
\cite{sigfridsson,worman,geer,knuth:ct:a,knuth:ct:b,knuth:ct:c}
\printbibliography
\end{document}

example output

  • Note that this solution still leaves \parencite to show bracketed citations, if you want no brackets use \cite as in the MWE. – moewe Feb 6 '17 at 12:16
  • \parencite is fine for me. I just need to change the bibliography itself. Its an requirement to get my thesis printed. Thank you so much, it looks good now! – Oliver Gerlach Feb 9 '17 at 9:49

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.