[Tex/LaTex] BibLaTeX equivalent for the BibTeX style “alphadin” for the DIN 1505 Standard

biblatex

A similar question was asked here before and I found DIN 1505 conform .bbx and .cbx but it doesn't look like the alphadin. The BibLaTeX alphabetic style sadly won't do it for my purposes.

So I tried to modify the files but failed.

I'm aiming for a look like this. It's basically din .bbx and .cbx combined with the alphabetic style.

enter image description here

Moreover the label for entries without an author should be the first 3 characters of the cite-key – just like alphadin would do it but alphabetic won't.

Does anyone know how to modify the files or a workaround for this problem?

Best Answer

More information is certainly needed to specify an alphabetic style, but the document below gives a start. It requires biber as the backend.

Here \DeclareLabelalphaTemplate specifies an alphabetic label format that largely corresponds to one of the following, ordered by precedence:

  • shorthand field
  • the label field, plus the last two digits in year
  • first three letters of the surname in the (truncated) labelname list when it contains only one item, plus the last two digits in year
  • first letter of each surname in the (truncated) labelname, plus the last two digits in year
  • first three letters of the entry key

If the length of labelname exceeds maxalphanames it is truncated to a list of length minalphanames. The default option settings are minalphanames=1 and maxalphanames=3. Truncation is indicated in the label via the \labelalphaothers character:

\newcommand*{\labelalphaothers}{+}
\newcommand*{\sortalphaothers}{\labelalphaothers}

These can be redefined with \renewcommand*. The \sortalphaothers variant is used only for sorting and should be redefined if \labelalphaothers uses any formatting commands. Details on \DeclareLabelalphaTemplate and \defbibenvironment can be found in the biblatex manual.

\documentclass{article}
\usepackage[backend=biber,citestyle=alphabetic,bibstyle=din]{biblatex}

% Use cite/entry key as fallback label
\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1]{labelname}
    \field[strwidth=1,strside=left]{labelname}
    \field[final,strwidth=3]{citekey}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}    
  }
}

% Add labels to bibliography - taken from alphabetic.bbx
\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelalphawidth]{%
        \printfield{prefixnumber}%
        \printfield{labelalpha}%
        \printfield{extraalpha}}}
     {\setlength{\labelwidth}{\labelalphawidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{##1\hss}}
  {\endlist}
  {\item}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{bit:kiel,
  title = {Arbeitsgruppe Angewandte Informatik (Wirtschaftsinformatik)},
  url = {http://www.informatik.uni-kiel.de/bit/},
  year = 2012}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{knuth:ct,companion,aksin,cms,kant:ku,bit:kiel}
\printbibliography
\end{document}

enter image description here

Related Question