9

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 
4

2 Answers 2

3
+100

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

6
  • Very nice code, however the bold part files in my code, see the additional text in the question. Jul 5, 2014 at 21:12
  • @MatthiasPospiech interesting, maybe it would be better to create a new question for that particular issue, since it seems to be a problem with the patch commands Jul 6, 2014 at 11:07
  • I now got every thing to work in my thesis template. However I had to remove the ´\hskip-\periodwidth´ to get indentation correct. Jul 6, 2014 at 13:26
  • Glad that you got everything working :) Jul 6, 2014 at 17:03
  • The solution doesn't work anymore with biblatex 2016/03/03 v3.3. Is there any fix to get it working with the udated version?
    – Jonas
    Aug 2, 2016 at 14:59
3

The following provides a solution for the bold author and the counting issue.

Most of the code that implements the bold author feature origins from this site; however, I am currently not able to find the original source to give credit to it :-(


Edit: The bold author code was originally provided by user Audry in his answer to Make specific author bold using biblatex


The workaround for the numbering in your Scientific Publications section is to just replace the \printfield{labelnumer} with an own counter:

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


% Emphasize own name in References with boldface
\usepackage{xpatch}% or use https://tex.stackexchange.com/a/40705

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

\newcommand{\numberedreferences}{%
\newcount\mycount

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \global\advance\mycount 1
        \printfield{prefixnumber}%
        \the\mycount.%
        }%
     }%
  {\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)
\forcsvlist{\listadd\boldnames}
  {{Pospiech, Matthias}, {Pospiech, M.}}
\printbibliography[heading=none, sorting=ynt]
\end{refsection}

% standard style
\renewcommand*{\boldnames}{}
\nocite{*}
\printbibliography    

\end{document}

enter image description here

5
  • how can you just put a square (like itemize) in stead of the number for the Scientific publications? And to change the main option of maxnumber of authors?
    – jlanza
    Jul 3, 2014 at 19:00
  • Although I do not understand the code completely it works fine in your example. I do however wrap the definition code in a condition with \IfPackageLoaded{biblatex}{% ... }% which is defined as \newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}}. If I do that I get the error ! Undefined control sequence. <argument> \blx@do {Pospiech2009}\blx@listloop@i. Jul 5, 2014 at 21:04
  • I added a MWE for this error in the question. Jul 5, 2014 at 21:12
  • @MatthiasPospiech: The command definitions inside the block and its use of arguments cannot be passed "as is" to the argument of another macro (your \IfPackageLoaded). A simple solution would be to just use a TeX conditional: \newif\ifbiblatex \IfPackageLoaded{biblatex}{\biblatextrue}. Then wrap the conditional part with \ifbiblatex and \fi
    – Daniel
    Jul 6, 2014 at 10:57
  • Thanks, egreg had another idea: tex.stackexchange.com/questions/188188/…. Jul 6, 2014 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .