使用 biblatex 按年份排序的出版物列表

使用 biblatex 按年份排序的出版物列表

除了参考文献之外,我还想创建一个按年份排序的出版物列表。Audrey 已经发表了针对简历的解决方案。但是,对于某一年份的每个第一个条目,都会插入一个缩进,我想避免这种情况(图中蓝色标记的缩进)。

如何才能实现所有行和条目都左对齐,并且在某一年份的第一行不产生缩进?

% !BIB program = biber
\documentclass{article}
\usepackage[backend=biber, maxnames=99, giveninits=true]{biblatex}

\begin{filecontents}[overwrite]{\jobname.bib}
@InProceedings{identifier1,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Some Book about the Future},
 Year = {2004},
 Pages = {1--42}
}
@InProceedings{identifier2,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Some Book about the Future},
 Year = {2004},
 Pages = {1--42}
}
@InProceedings{identifier3,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: First edition},
 Year = {2000},
 Pages = {1--100}
}
@InProceedings{identifier4,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Third edition},
 Year = {1995},
 Pages = {1--100}
}
@InProceedings{identifier5,
 Title = {Some really awesome long title: And some further information},
 Author = {First Author, Second Author, Third Author },
 Booktitle = {An okay Booktitle First Special Edition},
 Year = {1994},
 Pages = {1--100}
}
@Book{test1,
 author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 title = {Some really awesome long title: And some further information},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1994},
}
@Book{test2,
 author = {Mittelbach, F. and Goossens, Michel and Mouse, Mickey and Pan, Peter and Samarin, Alexander},
 title = {The LaTeX Companion Ninth Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1995},
}
@Book{test3,
 author = {Mittelbach, Frank and Samarin, Alexander and Mouse, Mickey and Pan, Peter and Goossens, Michel},
 title = {The LaTeX Companion First Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {2004},
} 
@Book{test4,
 author = {Mittelbach, Frank and Samarin, Alexander and Mouse, Mickey and Pan, Peter and Goossens, Michel},
 title = {The LaTeX Companion Third Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1995},
} 
@Book{test5,
 author = {Mittelbach, F. and Mouse, Mickey and Pan, Peter and Goossens, Michel and Samarin, Alexander},
 title = {The LaTeX Companion Second Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {2000},
}

\end{filecontents}
\addbibresource{\jobname.bib}

\defbibenvironment{myPublicationListYearStyle}{
 \list{%
  \iffieldequals{year}{\bibyear}
  {}
  {\printfield{year}\savefield{year}{\bibyear}}%
 }{%
  \setlength{\labelwidth}{\labelnumberwidth}%
  \setlength{\leftmargin}{\labelwidth}%
  \setlength{\labelsep}{\biblabelsep}%
  \setlength{\itemsep}{\bibitemsep}%
  \leftmargin\labelwidth%
  \advance\leftmargin\labelsep%
 }%
 \renewcommand*{\makelabel}[1]{\hss##1}%
}%
{\endlist}
{\item}

\begin{document}

\nocite{*}
\printbibliography

\newpage
\section*{List of publications}
\nocite{*}
\begin{refcontext}[sorting=ydnt]{}
\printbibliography[heading=none, env=myPublicationListYearStyle]
\end{refcontext}

\end{document}

应避免使用蓝色标记的缩进

答案1

定义中myPublicationListYearStyle为年份预留的空间太少。当列表标签的空间太少时,剩余的条目就会向右推一点。

\defbibenvironment{myPublicationListYearStyle}{
 \list{%
  \iffieldequals{year}{\bibyear}
  {}
  {\printfield{year}\savefield{year}{\bibyear}}%
 }{%
  \setlength{\labelwidth}{\labelnumberwidth}%
  \setlength{\leftmargin}{\labelwidth}%
  \setlength{\labelsep}{\biblabelsep}%
  \setlength{\itemsep}{\bibitemsep}%
  \leftmargin\labelwidth%
  \advance\leftmargin\labelsep%
 }%
 \renewcommand*{\makelabel}[1]{\hss##1}%
}%
{\endlist}
{\item}

您为年份保留的空间量与其他书目中的数字标签保留的空间量相同。书目中最大的标签是“[10]”,但年份比它长(“2000”)。

最简单的方法是通过设置一个合理的值来手动保留适当数量的空间\labelwidth(在我选择的示例中2em)。

\documentclass{article}
\usepackage[backend=biber, maxnames=99, giveninits=true]{biblatex}


\defbibenvironment{myPublicationListYearStyle}
  {\list
     {\iffieldequals{year}{\bibyear}
        {}
        {\printfield{year}\savefield{year}{\bibyear}}}
     {\setlength{\labelwidth}{2em}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \leftmargin\labelwidth%
      \advance\leftmargin\labelsep}%
   \renewcommand*{\makelabel}[1]{\hss##1}}%
  {\endlist}
  {\item}

\begin{filecontents}[overwrite]{\jobname.bib}
@InProceedings{identifier1,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Some Book about the Future},
 Year = {2004},
 Pages = {1--42}
}
@InProceedings{identifier2,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Some Book about the Future},
 Year = {2004},
 Pages = {1--42}
}
@InProceedings{identifier3,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: First edition},
 Year = {2000},
 Pages = {1--100}
}
@InProceedings{identifier4,
 Title = {Some really awesome long title: And some further information},
 Author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 Booktitle = {An Booktitle with additional content: Third edition},
 Year = {1995},
 Pages = {1--100}
}
@InProceedings{identifier5,
 Title = {Some really awesome long title: And some further information},
 Author = {First Author, Second Author, Third Author },
 Booktitle = {An okay Booktitle First Special Edition},
 Year = {1994},
 Pages = {1--100}
}
@Book{test1,
 author = {Goossens, Michel and Mouse, Mickey and Pan, Peter and Mittelbach, Frank and Samarin, Alexander},
 title = {Some really awesome long title: And some further information},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1994},
}
@Book{test2,
 author = {Mittelbach, F. and Goossens, Michel and Mouse, Mickey and Pan, Peter and Samarin, Alexander},
 title = {The LaTeX Companion Ninth Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1995},
}
@Book{test3,
 author = {Mittelbach, Frank and Samarin, Alexander and Mouse, Mickey and Pan, Peter and Goossens, Michel},
 title = {The LaTeX Companion First Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {2004},
} 
@Book{test4,
 author = {Mittelbach, Frank and Samarin, Alexander and Mouse, Mickey and Pan, Peter and Goossens, Michel},
 title = {The LaTeX Companion Third Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {1995},
} 
@Book{test5,
 author = {Mittelbach, F. and Mouse, Mickey and Pan, Peter and Goossens, Michel and Samarin, Alexander},
 title = {The LaTeX Companion Second Special Edition},
 publisher = {Addison-Wesley},
 location = {Reading, Mass.},
 year = {2000},
}

\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}

\nocite{*}
\printbibliography

\newpage
\section*{List of publications}
\nocite{*}
\begin{refcontext}[sorting=ydnt]{}
\printbibliography[heading=none, env=myPublicationListYearStyle]
\end{refcontext}

\end{document}

年份排列整齐。

相关内容