Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am currently writing my thesis with LaTeX using biblatex for citations and bibliography. I try to match a formal request regarding the first part of the bibliographic entries which have to look like "Meyer, B. (1990):" or when having more than two names "Meyer, B.; Wang, S. et al. (1992):". The rest of the entry already fits the requested. By tweaking the authoryear-style with Google-collected pieces I got some parts of it right, but not all of them. My biggest problem seems to be "et al." which is either always bold or never. Having it always bold causes problems with some editor listings. The same problem occurs with name-prefixes like "de la Fuentes" as the example shows.

So I would like to know if there is any possibility of addressing the label of the entries with a command like \mkbibbold in general instead of separately changing every part?

Here is an example of what I got so far (my excuses for its length but I did not find anything that can be shortened):

    \documentclass[ngerman, 12pt, a4paper, oneside, notitlepage]{scrreprt}
       \usepackage[utf8]{inputenc}
       \usepackage[ngerman]{babel}
       \usepackage[babel,german=quotes]{csquotes} 

    \usepackage [backend=bibtex,style=authoryear] {biblatex}
    \ExecuteBibliographyOptions{hyperref=true, firstinits=true, isbn=false, url=true, doi=false, sorting=nyt, minnames=1, maxcitenames=2, maxbibnames=2, language=ngerman, alldates=short, punctfont=true, autopunct=false, block=none, dashed=false}
       \addbibresource{literatur.bib} 
       \usepackage{filecontents} 

        \AtBeginBibliography{
            \renewcommand*{\multinamedelim}{\textbf\addsemicolon\space}
            \renewcommand*{\finalnamedelim}{\textbf\addsemicolon\space}
            \renewcommand*{\nameyeardelim}{\textbf\addcomma\space}
            \renewcommand*{\labelnamepunct}{\addcolon\space}
            \renewcommand*{\newunitpunct}{\addcomma\space}}

        \DefineBibliographyStrings{ngerman}{
            sequens = {f},  sequentes = {ff}} 
        \DefineBibliographyStrings{ngerman}{
            editors = {\mkbibbold{Hrsg.}},  editor = {\mkbibbold{Hrsg.}}, 
            andothers = {et\addspace al\adddotspace}, andmore = {et\addspace al\adddotspace}} % defining et al.

        \DeclareNameAlias{sortname}{last-first}

        \AtBeginBibliography{
            \renewcommand*{\mkbibnamelast}[1]{%bold names in label
            \ifmknamesc{\mkbibbold{#1}}{#1}}
            \renewcommand*{\mkbibnamefirst}[1]{
            \ifmknamesc{\mkbibbold{#1}}{#1}}
            \renewcommand*{\mkbibnameprefix}[1]{
            \ifboolexpr{ test {\ifmknamesc} and test {\ifuseprefix} }{\mkbibbold{#1}}{#1}}
            \def\ifmknamesc{%bold editors in labels, but not in content
            \ifboolexpr{ test {\ifcurrentname{labelname}}
            or test {\ifcurrentname{author}}
            or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}

        \renewbibmacro*{name:andothers}{
            \ifthenelse{\value{listcount}=\value{liststop}\AND 
            \ifmorenames}
            {\ifnum\value{liststop}>1 \finalandcomma\fi 
            \andothersdelim\textbf{\bibstring{andothers}}}
            {}}
            }

        \setlength {\bibitemsep}{18pt}
        \setlength {\bibhang}{0.2cm}
        \DeclareFieldFormat[article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
            {title}{\mkbibquote{#1\isdot}}
        \DeclareFieldFormat [article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
            {date}{\mkbibbold{#1}}%bold-printed year in labels
        \DeclareFieldFormat{parens}{\mkbibbold{\mkbibparens{#1}}}%round brackets for year in label

    \usepackage[colorlinks, allcolors=black]{hyperref}
    \usepackage{url} 
    \urlstyle{same}

\begin{filecontents*}{literatur.bib} 
@article{nature, 
   author      =   {Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie}, 
   title      =   {Advances in understanding the molecular basis of frontotemporal dementia - elongated title}, 
   journal      =   {Nature Reviews Neurology}, 
   volume      =   {8}, 
   year      =   {2012}, 
   pages      =   {423-434}, 
   doi         =   {10.1038/nrneurol.2012.117}} 
@article{fuente, 
   author      =   {D. de la Fuente and J.G. Castaño and M. Morcillo}, 
   title      =   {Long-term atmospheric corrosion of zinc}, 
   journal      =   {Corrosion Science}, 
   volume      =   {49}, 
   year      =   {2007}, 
   pages      =   {1420–1436 www.elsevier.com/locate/corsci}}, 
 @incollection{Rocca2007a,
   author = {Rocca, Emmanuel and Mirambet, Fran\c{c}ois},
   booktitle = {Corrosion of Metallic Heritage Artefacts: Investigation, Conservation and Prediction of Long Term Behaviour},
   chapter = {18},
   editor = {Philippe Dillmann and Pedro Piccardo and Gerard Beranger},
   pages = {308-334},
   title = {{Corrosion inhibitors for metallic artefacts: temporary protection}},
   year = {2007}}

\end{filecontents*} 

\begin{document} 
   Test\cite{nature}\\
   another test \cite{fuente} and \cite{Rocca2007a}
   \printbibliography
\end{document} 
share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Your example wasn't quite minimal, so I removed some redefinitions not related to the actual problem (achieving bold labels). I suggest to simply wrap the author bibmacro (which also prints the year in authoryear styles) into a \mkbibbold -- I use the xpatch package to do so. (In addition, one has to make the colon after the year bold by redefining \labelnamepunct.)

EDIT: For works without author, the bbx:editor bibmacro must be changed accordingly.

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes} 

\usepackage[style=authoryear]{biblatex}
\ExecuteBibliographyOptions{firstinits=true,maxnames=2}

\setlength{\bibitemsep}{18pt}
\setlength{\bibhang}{0.2cm}

\DeclareNameAlias{sortname}{last-first}

\AtBeginBibliography{%
  \renewcommand*{\multinamedelim}{\addsemicolon\space}%
  \renewcommand*{\finalnamedelim}{\addsemicolon\space}%
}

\DefineBibliographyStrings{ngerman}{%
  andothers = {et\addspace al\adddotspace},%
  andmore = {et\addspace al\adddotspace},%
}

\usepackage{xpatch}
\xpretobibmacro{author}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{author}{\egroup}{}{}
\xpretobibmacro{bbx:editor}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{bbx:editor}{\egroup}{}{}

\renewcommand*{\labelnamepunct}{\mkbibbold{\addcolon\space}}

\usepackage{filecontents} 

\begin{filecontents*}{\jobname.bib} 
@article{nature, 
   author      =   {Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie}, 
   title      =   {Advances in understanding the molecular basis of frontotemporal dementia - elongated title}, 
   journal      =   {Nature Reviews Neurology}, 
   volume      =   {8}, 
   year      =   {2012}, 
   pages      =   {423-434}, 
   doi         =   {10.1038/nrneurol.2012.117},
} 
@article{fuente, 
   author      =   {D. de la Fuente and J.G. Castaño and M. Morcillo}, 
   title      =   {Long-term atmospheric corrosion of zinc}, 
   journal      =   {Corrosion Science}, 
   volume      =   {49}, 
   year      =   {2007}, 
   pages      =   {1420–1436},
}
 @incollection{Rocca2007a,
   author = {Rocca, Emmanuel and Mirambet, Fran\c{c}ois},
   booktitle = {Corrosion of Metallic Heritage Artefacts: Investigation, Conservation and Prediction of Long Term Behaviour},
   chapter = {18},
   editor = {Philippe Dillmann and Pedro Piccardo and Gerard Beranger},
   pages = {308-334},
   title = {Corrosion inhibitors for metallic artefacts: temporary protection},
   year = {2007},
}
@misc{A01,
  editor = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents*} 

\addbibresource{\jobname.bib} 

\nocite{*}

\begin{document}

\printbibliography

\end{document}

enter image description here

share|improve this answer
    
That works very well, too. In fact I like it even more than the previous answer which continued my attempt to format every piece separately. Yours instead answers my question for a general solution for the whole label. Thank you very much, too. :) –  fortunecookies Jan 13 '13 at 15:50
    
I recently included a bibliographic entry without an author. Therefore the editor is used for quotations and the bibliography. But its label has still its normal font while all the others are bold. I wonder if you might fix that too, please. :) –  fortunecookies Jan 21 '13 at 21:55
    
@fortunecookies See updated answer. –  lockstep Jan 24 '13 at 11:56
    
works very well too. love it. :) –  fortunecookies Jan 28 '13 at 21:33
add comment

You can wrap the instruction to print the string "et al" in a conditional, and to switch it on and off. Given the order in which the various bibliographic information is presented we can set the switch on at the begin of each reference, and we can switch off after the container title.

\newtoggle{boldetal}
\renewbibmacro{begentry}{\settoggle{boldetal}{true}}
\def\mymkbibbold{\iftoggle{boldetal}{\mkbibbold}{}} 

The first line create a toggle. Then we use the hook begentry to set the toggle true at the begin of each reference. Then the third line is a shortcut: if the toggle is true we print using boldface otherwise we do nothing.

Based on this, the definition of biblatex macro name:andother is modified to use the new shortcut.

\renewbibmacro*{name:andothers}{% 
   \ifthenelse{\value{listcount}=\value{liststop}\AND 
    \ifmorenames}%
    {\ifnum\value{liststop}>1 \finalandcomma\fi 
    \andothersdelim\mymkbibbold{\bibstring{andothers}}}
    {}}

Finally, the switch to turn the toggle off is inserted with the title.

\DeclareFieldFormat[article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
    {title}{\mkbibquote{#1\isdot}\global\settoggle{boldetal}{false}}

By the way in your code, there are spaces before comments, i.e., { % if you remove them, with the changes above you get:

enter image description here

share|improve this answer
    
The toggle works like a charm, thank very much for coming up with it so quickly. :) That sort of things unfortunately goes way beyond my abilities with LaTeX. I also tried to kill every space before a comment. Only the "de la" of "de la Fuente" has not changed its position and shape like it did in your version. How did you manage it? –  fortunecookies Jan 13 '13 at 15:05
    
@fortunecookies with the useprefix biblatex option –  Guido Jan 13 '13 at 15:07
    
Oh, I must have overlooked that when I set all the options. Thanks a lot –  fortunecookies Jan 13 '13 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.