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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following bibliography example using alphabetic style, maxalphanames = 1 and deactivated + in case of multiple authors:

enter image description here

How can achieve a complete 4-digit year in the label? So in this case the desired output would be: Baa1989

I found a source explaining how to define a complete custom label. But I have a hard time believing that there is no simpler more generic switch to switch. Couldn't find any in the manual.

I'm looking for a solution for biblatex + biber.

Thank you.


MWE

\begin{filecontents}{references.bib}
@InProceedings{Baader1989,
  Title                    = {Direct self control of inverter-fed induction machine, a basis for speed control without speed-measurement},
  Author                   = {Baader, U. and Depenbrock, M. and Gierse, Georg},
  Booktitle                = {Industry Applications Society Annual Meeting, 1989., Conference Record of the 1989 IEEE},
  Year                     = {1989},
  Month                    = {Oct},
  Pages                    = {486-492 vol.1},
}
\end{filecontents}

\documentclass{article}

\usepackage[style=alphabetic,%
            backend=biber,
            maxnames=99,
            maxalphanames=1,    
            backref=true,
            doi=false,isbn=false,url=false,
            backref=false,
            ]{biblatex}
\renewcommand*{\labelalphaothers}{}

\bibliography{references.bib} 

\begin{document}
Citation: \cite{Baader1989}
\printbibliography
\end{document}
share|improve this question
    
Just go with \DeclareLabelalphaTemplate{ \labelelement{ \field[final]{shorthand} \field{label} \field[strwidth=3,strside=left,ifnames=1,pcompound=true]{labelname} \field[strwidth=1,strside=left,pcompound=true]{labelname} } \labelelement{ \field{year} } } (line breaks not to scale). – moewe Jan 28 at 8:24
    
I really thought there would be a duplicate on this site, but I couldn't find one, so I went ahead and answered. We have the similar Biblatex alphabetic style like Smith, 2005, but there something else is going on. – moewe Jan 28 at 8:31
up vote 5 down vote accepted

As far as I can see you will have to resort to \DeclareLabelalphaTemplate, but that is not too bad.

We can just copy the default from biblatex.def and change \field[strwidth=2,strside=right]{year} to \field{year}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1,pcompound=true]{labelname}
    \field[strwidth=1,strside=left,pcompound=true]{labelname}
  }
  \labelelement{
    \field{year}    
  }
}

and that's it.

MWE

\begin{filecontents}{\jobname.bib}
@InProceedings{Baader1989,
  Title                    = {Direct self control of inverter-fed induction machine, a basis for speed control without speed-measurement},
  Author                   = {Baader, U. and Depenbrock, M. and Gierse, Georg},
  Booktitle                = {Industry Applications Society Annual Meeting, 1989., Conference Record of the 1989 IEEE},
  Year                     = {1989},
  Month                    = {Oct},
  Pages                    = {486-492 vol.1},
}
\end{filecontents}

\documentclass{article}

\usepackage[style=alphabetic,%
            backend=biber,
            maxnames=99,
            maxalphanames=1,    
            backref=true,
            doi=false,isbn=false,url=false,
            backref=false,
            ]{biblatex}
\renewcommand*{\labelalphaothers}{}

\addbibresource{\jobname.bib} 

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1,pcompound=true]{labelname}
    \field[strwidth=1,strside=left,pcompound=true]{labelname}
  }
  \labelelement{
    \field{year}    
  }
}

\begin{document}
Citation: \cite{Baader1989}
\printbibliography
\end{document}
share|improve this answer
    
What does pcompound = true do? It is undefined und throws and error. Leaving that out everyhting seems to work. – thewaywewalk Jan 28 at 9:09
1  
@thewaywewalk pcompound is a new option that was introduced in biblatex 3.2. It is the compound equivalent for name prefixes. It was implemented because of LNI/alpha style at BibLaTeX with the usage of multiple “von” parts. Either make an update of biblatex and Biber, or just drop the pcompound=true. – moewe Jan 28 at 10:08

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.