作者和年份显示在单独的列中:这是哪种书目样式?

作者和年份显示在单独的列中:这是哪种书目样式?

我试图弄清楚这是哪种书目风格:

参考书目示例

我正在使用natbib具有apalike参考书目样式的包,这正是我想要的右列,但我缺少左列(作者年份)。我认为这是一个很好的补充,可以更轻松地参考。

答案1

这是一个带有的版本biblatex,因为我发现它natbib真的很难定制。

目前,长度是手动的(设置为100pt),因为这是我第一次尝试更改biblatex这么多,而且我不确定如何自动设置。虽然我怀疑你的姓氏是否应该更长,但如果发生这种情况,你可以稍微增加长度。与此同时,以下是结果。

输出

在此处输入图片描述

代码

\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}

答案2

您可以使用以下代码自动选择长度

\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

biblatex这与数字和字母标签的作用类似。

平均能量损失

\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 书目

相关内容