[Tex/LaTex] Independent publication list with numbered list using biblatex and refsection

biblatexsubdividing

I would like to add a list of publications to a thesis ordered by the publication date and numbered 1,2,3. Additionally the author of the thesis should be highlighted bold in this list.

The approach I tried is to use a refsection with a modified \defbibenvironment{bibliography} and \ExecuteBibliographyOptions{labelnumber}. This works in principle, but the numbering is according to the bibliography (what I do not want) and not the list index. The numbering can be independent by using the option defernumbers but then the number never starts at one. In this example it would be 4,5,6.
A minor error is that each list start with a space instead of the authors name.
The normal bibliography is with a different style (alphabetic) and must remain unchanged.

If the numbered refsection with numbers according to the list index is not possible the second qustion would still be open. I want the thesis writers name in the list of publications to be highlighted (bold). In this case I have no idea how to achieve that.

This image shows how the numbering is wrong:

enter image description here

This is an example one can work on:

\documentclass{article}

\usepackage{filecontents}

\usepackage[
  style=alphabetic, % Loads the bibliography and the citation style 
  %style=numeric,
]{biblatex}  

\ExecuteBibliographyOptions{%
sorting=nty, % Sort by name, title, year.
maxbibnames=15,%
%defernumbers,
}%      

\addbibresource{publications.bib}
\ExecuteBibliographyOptions{labelnumber}
\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}

@Article{Pospiech2009,
  Title                    = {Double waveguide couplers produced by simultaneous femtosecond writing},
  Author                   = {Matthias Pospiech and Moritz Emons and Andy Steinmann and Guido Palmer and Roberto Osellame and Nicola Bellini and Giulio Cerullo and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2009},
  Number                   = {5},
  Pages                    = {3555--3563},
  Volume                   = {17},
}

@Article{Siegel2007,
  Title                    = {Theoretical and experimental limits of cavity-dumping in passively mode-locked thin-disk oscillators},
  Author                   = {Martin Siegel and Guido Palmer and Andy Steinmann and Matthias Pospiech and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2007},
  Month                    = {Dec},
  Number                   = {25},
  Pages                    = {16860--16869},
  Volume                   = {15},
}

\end{filecontents*}

\newcommand{\numberedreferences}{%
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}.%
        }%
     }%
  {\setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   % fails to compile if included
   %\renewcommand*{\makelabel}[1]{\hss##1}
  }
  {\endlist}
  {\item}
}%

\section*{Scientific publications}
\begin{refsection}[publications]%
\numberedreferences
\nocite{*}
% supposed to be numbered and with author highlighted (bold)
\printbibliography[heading=none, sorting=ynt]
\end{refsection}

% standard style
\nocite{*}
\printbibliography    

\end{document}

EDIT:
This code show how the code from the examples below fails if parts are wrapped in a conditional:

\documentclass{article}

\usepackage{filecontents}
\usepackage{ltxcmds}
\makeatletter
\newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}}
\makeatother

\usepackage{biblatex}  
\usepackage{xpatch}

\IfPackageLoaded{biblatex}{%

% \boldnames: etoolbox-list of names to typeset bold in \printbibiliography
\newcommand*{\boldnames}{}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\ifstrequal{#1, #2}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}

\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}

%
\DeclareNameAlias{default}{last-first/first-last}

}% \IfPackageLoaded{biblatex}

\addbibresource{publications.bib}

\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}
\end{filecontents*}

\begin{refsection}%
\nocite{*}
\printbibliography[heading=none, sorting=ynt, resetnumbers=true] %env=numbered+bold, 
\end{refsection}

\end{document}

The error is

! Undefined control sequence.
<argument> \blx@do 
                   {Pospiech2009}\blx@listloop@i 

Best Answer

The biblatex package allows to have independent numbering schemes for differents refsections. To get truly independent numbering in different bibliographies, you also need to pass the resetnumbers=true option to each additional \printbibliography command (in addition to the defernumbers option you already passed to the package). Note however, that you may need 3 to 4 compilation runs for the list to be correctly numbered.

\printbibliography[heading=none, sorting=ynt, resetnumbers=true]

Additionally, in your command the following code fails to compile:

   % fails to compile if included
   \renewcommand*{\makelabel}[1]{\hss##1}

The reason is that you're including a \defbibenvironment (which defines an environment) into your \newcommand definition. Thus, the ##1 argument being passed in \renewcommand is not the argument passed to \defbibenvironment (as it should) but rather the (non-existing) argument passed to \newcommand.

Luckily, you don't need to create a new command in order to apply a new bibliography style, you can simply create a new bibliography environment and pass it to \printbibliography:

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\newlength{\periodwidth}
\settowidth{\periodwidth}{.}

\defbibenvironment{numbered+bold}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}%
        }%
     }%
  {
   \setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   \renewcommand*{\makelabel}[1]{\hss##1}%
  }
  {\endlist}
  {\item\hskip-\periodwidth}

Once defined, it can be used like so:

\printbibliography[env=numbered+bold, heading=none, sorting=ynt, resetnumbers=true]

Note that I also corrected the indentation of the list of authors. The additional space before the authors is due to changing from the alphabetic to the numeric style mid-document. From my understanding, this is not encouraged nor supported by biblatex and it seems that even though you can successfully change the bibliography to use numeric labels, some side-effects from the alphabetic style remain. I have not been able to track where this extra space is added, but a possible workaround is to add a negative horizontal space which equals the length of the period character being used.

Making a specific author name bold has already been covered by Daniel. Note however that this is independent of the new environment we created. If you fill the list again with \forcsvlist{\listadd\boldnames}{{Pospiech, Matthias}, {Pospiech, M.}} before calling the last printbibliography, it will also mark the author in bold for that bibliography.

Full code:

\documentclass{article}

\usepackage{filecontents}

\usepackage[
  style=alphabetic, % Loads the bibliography and the citation style 
  backend=biber,
  defernumbers=true
]{biblatex}  

\ExecuteBibliographyOptions{%
  sorting=nty, % Sort by name, title, year.
  maxbibnames=15,%
}%      

\addbibresource{publications.bib}

% Emphasize own name in References with boldface
\usepackage{xpatch}

% \boldnames: etoolbox-list of names to typeset bold in \printbibiliography
\newcommand*{\boldnames}{}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\ifstrequal{#1, #2}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}


\xpretobibmacro{name:last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:first-last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:last}{\endgroup}{}{}
\xapptobibmacro{name:first-last}{\endgroup}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\DeclareNameAlias{default}{last-first/first-last}


\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}

@Article{Pospiech2009,
  Title                    = {Double waveguide couplers produced by simultaneous femtosecond writing},
  Author                   = {Matthias Pospiech and Moritz Emons and Andy Steinmann and Guido Palmer and Roberto Osellame and Nicola Bellini and Giulio Cerullo and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2009},
  Number                   = {5},
  Pages                    = {3555--3563},
  Volume                   = {17},
}

@Article{Siegel2007,
  Title                    = {Theoretical and experimental limits of cavity-dumping in passively mode-locked thin-disk oscillators},
  Author                   = {Martin Siegel and Guido Palmer and Andy Steinmann and Matthias Pospiech and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2007},
  Month                    = {Dec},
  Number                   = {25},
  Pages                    = {16860--16869},
  Volume                   = {15},
}

\end{filecontents*}

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\newlength{\periodwidth}
\settowidth{\periodwidth}{.}

\defbibenvironment{numbered+bold}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}%
        }%
     }%
  {
   \setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   \renewcommand*{\makelabel}[1]{\hss##1}%
  }
  {\endlist}
  {\item\hskip-\periodwidth}

\section*{Scientific publications}
\begin{refsection}[publications]%

\nocite{*}
% supposed to be numbered and with author highlighted (bold)
\forcsvlist{\listadd\boldnames}{{Pospiech, Matthias}, {Pospiech, M.}}
\printbibliography[env=numbered+bold, heading=none, sorting=ynt, resetnumbers=true]
\end{refsection}

% standard style
\nocite{*}
\printbibliography    

\end{document}

Edit: I also added a screenshot of the resulting bibliographies:

shot

Related Question