2

I use biblatex with authoryear-icomp style and my MWE looks like this:

\documentclass[11pt]{report}    

\usepackage[
style=authoryear-icomp,
isbn=false,
pagetracker=true,
firstinits=false,
maxbibnames=50,
maxcitenames=3,
mincitenames=1,
autocite=inline,
block=space,
backref=false,
backrefstyle=three+,
date=short,
backend=biber,
uniquename=false, 
uniquelist=false,
dashed=false,
sorting=nyt,
bibencoding=utf8
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{general.bib}
@book{bundesamt_fur_sicherheit_in_der_informationstechnik_bsi_it-grundschutzkataloge_2016,
    location = {Bonn},
    edition = {13. Ergänzungslieferung},
    title = {{IT}-Grundschutzkataloge},
    author = {{BSI (Bundesamt für Sicherheit in der Informationstechnik) }},
    shortauthor = {BSI},
    date = {2016},
}
@online{ibm,
author ={{International Business Machines Corporation}},
shortauthor = {{IBM}},
title = {2015 Cost of Data Breach Study},
year = {2015},
url = {http://www-03.ibm.com/security/data-breach/},
urldate = {2016-06-30},
}
\end{filecontents*}

\addbibresource{general.bib}

\DeclareBibliographyDriver{book}{% BOOK --> C:\texlive\2015\texmf-dist\tex\latex\biblatex\bbx\standard.bbx
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  {\printtext{\textbf
        {\usebibmacro{author/editor+others/translator+others}}}}
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \iffieldundef{author}
    {}
    {\newunit\newblock
     \usebibmacro{byeditor+others}}
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{online}{% Online --> C:\texlive\2015\texmf-dist\tex\latex\biblatex\bbx\standard.bbx
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  {\printtext{\textbf
        {\usebibmacro{author/editor+others/translator+others}}}}
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \printlist{organization}%
  \newunit\newblock
  \usebibmacro{date}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \newunit
  \printfield{note}%
  \usebibmacro{finentry}}


\begin{document}

\chapter{Einleitung}
\section*{}
@online ressource: \textcite[][]{bundesamt_fur_sicherheit_in_der_informationstechnik_bsi_it-grundschutzkataloge_2016}
\section*{}
@book ressource: \textcite[][]{ibm}

\clearpage

\addcontentsline{toc}{chapter}{Literaturverzeichnis}
\printbibliography[title={Literaturverzeichnis}]


\end{document}

My Problem is that biblatex prints the shortauthor field as expected when listing books in the list of references. But when citing @online ressources the shortauthor field is ignored, although the same bibmacro is used. Finally i want it to look like this and it's working but only for books:

enter image description here

For online ressource the shortauthor field is ignored:

enter image description here

How can I change that? Any help would be really much appreciated! Sry when I left out some things but I'm pretty much a beginner in writing with latex!

THX

  • Can you add a full MWE so that we already have some bib entries to play around with? Then you can explain what you want in the example. – moewe Aug 31 '16 at 14:51
  • yes, i'm currently working on it! thx – narendra Aug 31 '16 at 15:06
  • added a working MWE. Hope anyone can help! Thanks a lot! – narendra Aug 31 '16 at 15:25
  • Thank you. You will find that biblatex does not add the shortauthor field even for book entries, it just seems like that with your first example because you have author = {{BSI (Bundesamt für Sicherheit in der Informationstechnik)}}. – moewe Aug 31 '16 at 15:27
  • 1
    Me idiot! Thank you sir! I totally overlooked that... Sometime things are easier than expected! However that stupid failure led me to register here and learn how to give a MWE. So finally it was worth doing it... – narendra Aug 31 '16 at 15:30
1

You don't actually have to modify the drivers, just use the xpatch package.

\usepackage{xpatch}
\xpretobibmacro{author}{\begingroup\bfseries}{}{}
\xpatchbibmacro{author}
  {\printnames{author}}
  {\ifnameundef{shortauthor}
     {\printnames{author}}
     {\printnames{shortauthor}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{author}}}}
  {}{}
\xapptobibmacro{author}{\endgroup}{}{}

\xpretobibmacro{bbx:editor}{\begingroup\bfseries}{}{}
\xpatchbibmacro{bbx:editor}
  {\printnames{editor}}
  {\ifnameundef{shorteditor}
     {\printnames{editor}}
     {\printnames{shorteditor}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{editor}}}}
  {}{}
\xapptobibmacro{bbx:editor}{\endgroup}{}{}

\xpretobibmacro{bbx:translator}{\begingroup\bfseries}{}{}
\xpatchbibmacro{bbx:translator}
  {\printnames{translator}}
  {\ifnameundef{shorttranslator}
     {\printnames{translator}}
     {\printnames{shorttranslator}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{translator}}}}
  {}{}
\xapptobibmacro{bbx:translator}{\endgroup}{}{}

With this code we add the short<name> fields is available and then wrap the <name> in brackets. Furthermore the label is written in bold.

In total

\documentclass[11pt]{report}    

\usepackage[
style=authoryear-icomp,
isbn=false,
pagetracker=true,
firstinits=false,
maxbibnames=50,
maxcitenames=3,
mincitenames=1,
autocite=inline,
block=space,
backref=false,
backrefstyle=three+,
date=short,
backend=biber,
uniquename=false, 
uniquelist=false,
dashed=false,
sorting=nyt,
bibencoding=utf8
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{general.bib}
@book{bundesamt_fur_sicherheit_in_der_informationstechnik_bsi_it-grundschutzkataloge_2016,
    location = {Bonn},
    edition = {13. Ergänzungslieferung},
    title = {{IT}-Grundschutzkataloge},
    author = {{Bundesamt für Sicherheit in der Informationstechnik}},
    shortauthor = {BSI},
    date = {2016},
}
@online{ibm,
author ={{International Business Machines Corporation}},
shortauthor = {{IBM}},
title = {2015 Cost of Data Breach Study},
year = {2015},
url = {http://www-03.ibm.com/security/data-breach/},
urldate = {2016-06-30},
}
\end{filecontents*}

\addbibresource{general.bib}

\usepackage{xpatch}
\xpretobibmacro{author}{\begingroup\bfseries}{}{}
\xpatchbibmacro{author}
  {\printnames{author}}
  {\ifnameundef{shortauthor}
     {\printnames{author}}
     {\printnames{shortauthor}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{author}}}}
  {}{}
\xapptobibmacro{author}{\endgroup}{}{}

\xpretobibmacro{bbx:editor}{\begingroup\bfseries}{}{}
\xpatchbibmacro{bbx:editor}
  {\printnames{editor}}
  {\ifnameundef{shorteditor}
     {\printnames{editor}}
     {\printnames{shorteditor}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{editor}}}}
  {}{}
\xapptobibmacro{bbx:editor}{\endgroup}{}{}

\xpretobibmacro{bbx:translator}{\begingroup\bfseries}{}{}
\xpatchbibmacro{bbx:translator}
  {\printnames{translator}}
  {\ifnameundef{shorttranslator}
     {\printnames{translator}}
     {\printnames{shorttranslator}%
      \setunit{\addspace}%
      \printtext[parens]{\printnames{translator}}}}
  {}{}
\xapptobibmacro{bbx:translator}{\endgroup}{}{}



\begin{document}

\chapter{Einleitung}
\section*{}
@online ressource: \textcite[][]{bundesamt_fur_sicherheit_in_der_informationstechnik_bsi_it-grundschutzkataloge_2016}
\section*{}
@book ressource: \textcite[][]{ibm}

\clearpage

\printbibliography[title={Literaturverzeichnis}, heading=bibintoc]
\end{document}
  • Why have you used xpatch? I was thinking to do a similar thing with \renewbibmacro, is it not sufficient? Just for curiosity... – CarLaTeX Aug 31 '16 at 15:56
  • 1
    @CarLaTeX I didn't want to copy the lengthy definitions of bbx:editor, bbx:translator for those changes. Normally I prefer a \renewbibmacro approach, but that can involve copying around lots of code for fairly minor changes in which case I prefer xpatch. – moewe Aug 31 '16 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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