1

Additional to the references I want to create a list of publication which should be ordered by year. Audrey has already published a solution that does something similar for a CV. However, with every first entry for a certain year an indent is inserted, which I want to avoid (in the figure the blue marked indent).

How can I achieve that all lines and entries are left aligned and no indent is created at the first line of a certain year?

% !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}

The blue marked indent should be avoided

TomTom
  • 141

1 Answers1

1

The definition of myPublicationListYearStyle reserves too little space for the year. When there is too little space for the list label, the remaining entry gets pushed to the right a bit.

With

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

you reserve the same amount of space for the year as you reserve for the numeric labels in the other bibliography. The largest label in the bibliography is "[10]", but the years are longer than that ("2000").

It is easiest to manually reserve a suitable amount of space by setting \labelwidth to a sensible value (in the example I chose 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}

Nicely aligned years.

moewe
  • 175,683