Author and year displayed in separate column: which bibliography style is this?
You can automate the choice of length with the following code
\newcounter{mymaxcitenames}
\AtBeginDocument{%
\setcounter{mymaxcitenames}{\value{maxnames}}%
}
\newlength{\citelabelwidth}
\defbibenvironment{bibliography}
{\list
{\begingroup\defcounter{maxnames}{\value{mymaxcitenames}}\usebibmacro{cite}\endgroup}
{\setlength{\labelwidth}{\citelabelwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{##1\hss}}
{\endlist}
{\item}
\makeatletter
\AtEveryCitekey{%
\blx@setlabwidth{\citelabelwidth}{\usebibmacro{cite}}
}
\makeatother
This is similar to what biblatex
does with numeric and alphabetic labels already.
\documentclass{book}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\usepackage[backend=biber,style=authoryear,maxcitenames=1]{biblatex}
\newcounter{mymaxcitenames}
\AtBeginDocument{%
\setcounter{mymaxcitenames}{\value{maxnames}}%
}
\newlength{\citelabelwidth}
\defbibenvironment{bibliography}
{\list
{\begingroup\defcounter{maxnames}{\value{mymaxcitenames}}\usebibmacro{cite}\endgroup}
{\setlength{\labelwidth}{\citelabelwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{##1\hss}}
{\endlist}
{\item}
\makeatletter
\AtEveryCitekey{%
\blx@setlabwidth{\citelabelwidth}{\usebibmacro{cite}}
}
\makeatother
\renewcommand*{\nameyeardelim}{\addcomma\space}
\begin{filecontents}{biblio.bib}
@article{lamport1982byz,
title={The Byzantine generals problem},
author={Lamport, Leslie and Shostak, Robert and Pease, Marshall},
journal={ACM Transactions on Programming Languages and Systems (TOPLAS)},
volume={4},
number={3},
pages={382--401},
year={1982},
publisher={ACM}
}
@article{lamport1998part,
title={The part-time parliament},
author={Lamport, Leslie},
journal={ACM Transactions on Computer Systems (TOCS)},
volume={16},
number={2},
pages={133--169},
year={1998},
publisher={ACM}
}
\end{filecontents}
\addbibresource{biblio.bib}
\begin{document}
\cite{lamport1982byz}
\cite{lamport1998part}
\printbibliography
\end{document}
MWE">
Here's a version with biblatex
, because I find that natbib
is really hard to customize.
For now, the length is manual (set to 100pt
) since this is the first time I've been trying to change biblatex
this much and I'm not sure how to set it automatically. Although I doubt you should have longer last names, if they happen, you can just slightly increase that length. In the meantime, here are the results.
Output
Code
\documentclass{book}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\usepackage[backend=biber,style=authoryear,maxcitenames=1]{biblatex}
\DeclareFieldFormat{labelalphawidth}{#1}
\defbibenvironment{bibliography}
{\list
{\printtext[labelalphawidth]{%
\printnames[][-\value{liststop}]{labelname}\addcomma\space%
\printfield{labelyear}}}
{\setlength{\labelwidth}{100pt}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{1.5ex}}%
\renewcommand*{\makelabel}[1]{##1\hss}}
{\endlist}
{\item}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\begin{filecontents}{biblio.bib}
@article{lamport1982byz,
title={The Byzantine generals problem},
author={Lamport, Leslie and Shostak, Robert and Pease, Marshall},
journal={ACM Transactions on Programming Languages and Systems (TOPLAS)},
volume={4},
number={3},
pages={382--401},
year={1982},
publisher={ACM}
}
@article{lamport1998part,
title={The part-time parliament},
author={Lamport, Leslie},
journal={ACM Transactions on Computer Systems (TOCS)},
volume={16},
number={2},
pages={133--169},
year={1998},
publisher={ACM}
}
\end{filecontents}
\addbibresource{biblio.bib}
\begin{document}
\cite{lamport1982byz}
\cite{lamport1998part}
\printbibliography
\end{document}