# redefine \cite command to change its design

I am happy with the alpha style for bibliography; but however I want a special design to be rendered for the \cite{} commands, exactly as described here.

Here is a minimum working example:

Content of bibli.bib:

@book{LAUE09,
Author = {Kurt Laue and Helmut Stenger},
Date-Modified = {2014-05-06 20:55:42 +0000},
Title = {Strangpressen: Verfahren, Maschinen, Werkzeuge},
Year = {2009}}


Here is the content of test.tex:

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

%\usepackage[maxalphanames=1, minalphanames=1, style=alphabetic, backend=biber]{biblatex}

%\DeclareLabelalphaTemplate{
%  \labelelement{
%    \field[strwidth=100,strside=left]{labelname}
%  }
%  \labelelement{
%    \field[strwidth=2,strside=right]{year}
%  }
%}

\begin{document}
\section{First section}
Here is my link to biblio: \cite{LAUE09}.

\bibliographystyle{alpha}
\bibliography{bibli}

\end{document}


However, when I toggle the commented lines, the bibliography does not get printed. I get the \cite rendered as I want, but the bibliography stop being displayed and I got following error at compilation time:

Package biblatex Error: File 'global.bbl' not created by biblatex.
LaTeX Warning: Citation 'LAUE09' on page 1 undefined on input line 24.
Package biblatex Error: '\bibliographystyle' invalid.
LaTeX Error: Can be used only in preamble.
l.28 \bibliography
{bibli}


Apparently, bibliography and bibliography commands can't be used with the \usepackage{biblatex} package. Some docs indicate using the command printbibliography instead. This compiles then without any errors, but no bibliography is getting printed! I like the possibility of printbibliography to sort bibliography elements according to their type, and would like if possible to use it.

How can I show my bibliography, while still keeping this particular design for the \cite command?

• When using biblatex, remove both \bibliographystyle and \bibliography, add \printbibliography instead (all docs should indicate this), and run biber instead of bibtex. – Torbjørn T. Jan 3 '16 at 14:05
• And indicate a pointer to the database using \addbibresource{<bibname>.bib}. Clear all helper files afterwards, they will be regenerated. – Johannes_B Jan 3 '16 at 14:09
• ok, your both comments solved the missing bibliography issue. But now, instead of getting [LAUE09], I got [Laue+09]! – philippe Jan 3 '16 at 14:19
• Maybe I'm a bit thick, but the output "[LAUE09]" is not really what the link you posted has as its desired format? You can achieve what they do much easier if you use an authoryear-type style. If you want capslock of what you have in your MWE use \DeclareLabelalphaTemplate{ \labelelement{ \field[uppercase=true]{labelname} } \labelelement{ \field[strwidth=2,strside=right]{year} } } – moewe Jan 3 '16 at 14:46
• Maybe you can write up an answer yourself then. So we can mark this as solved. Or ask one of those who helped you to write one. – moewe Jan 3 '16 at 15:40

Here is the solution I have found, plus some little improvements:

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\usepackage[maxalphanames=1,
minalphanames=1,
style=alphabetic,
backend=biber]{biblatex}
\usepackage{xcolor}
\definecolor{MyDarkBlue}{rgb}{0,0.08,0.7}

\renewcommand*{\labelalphaothers}{}

\DeclareLabelalphaTemplate{
\labelelement{
\field[uppercase=true,strwidth=100,strside=left]{labelname}
}
\labelelement{
\field[strwidth=2,strside=right]{year}
}
}

\begin{document}

\section{First section}

Here is my link to biblio : \cite{LAUE09}.

\printbibliography

\end{document}


I then just use pdflatex test.tex, then biber test.bcf which generates global.bbl file used by pdflatex test.tex again to provide the final document.

The \renewcommand*{\labelalphaothers}{} let me get ride of the + between name and 2-digit-year.