0

I'm writing my masters thesis and i have the following problem: I have the same author and the same year for two books.

@Book{Eschenauer1993a,
  title     = {Elastizitätstheorie},
  publisher = {BI Wissenschaftsverlag},
  year      = {1993},
  author    = {Eschenauer, Hans and Schnell, Walter},
  isbn      = {3411162635},
  subtitle  = {Grundlagen, Flächentragwerke, Strukturoptimierung},
}

@Book{Eschenauer1993b,
  title     = {Elastizitätstheorie},
  publisher = {BI Wissenschaftsverlag},
  year      = {1993},
  author    = {Eschenauer, Hans and Schnell, Walter},
  isbn      = {3411167718},
  subtitle  = {Formel- und Aufgabensammlung},
}

Now the citation looks like [Eschenauer, 1993a] when citing the first one. I like it that way but my professor wants it to look like [Eschenauer-1, 1993] for the first and [Eschenauer-2, 1993] for the second entry. Is there any way to do this quick and easy? I am using biblatex with biber as backend. Thank you in advance!

\documentclass[10pt,a4paper]{article}
\usepackage[hyperfootnotes=false,colorlinks=false,linkcolor=black,pdfborder=000,pdfencoding=auto]{hyperref} 
\usepackage{blindtext}

\usepackage[
backend         = biber,        %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
%style          = authoryear,   %% Zitierstil (siehe Dokumentation)
style           = alphabetic,   %% Alphabetische Reihenfolge der Liste im Literaturverzeichnis
%style          = iso-authoryear,
autolang        = other,        %% to support multiple languages in bibliography
maxalphanames   = 4,
maxcitenames    = 1,            %% Maximale Anzahl an genannten Autoren im Zitat-Verweis
mincitenames    = 1,
natbib          = true,         %% Bereitstellen von natbib-kompatiblen Zitierkommandos
hyperref        = true,         %% hyperref-Paket verwenden, um Links zu erstellen
%uniquelist     = false,
isbn            = false,        %% source: http://tex.stackexchange.com/a/23118/9075
bibencoding     = UTF8,         %% this is necessary only if bibliography file is in different encoding than main document
]{biblatex}

\bibliography{Literaturverzeichnis}{}
\addbibresource{Literaturverzeichnis.bib}

%Eckige Klammern um Zitat-Verweis
\makeatletter

\newrobustcmd*{\parentexttrack}[1]{%
    \begingroup
    \blx@blxinit
    \blx@setsfcodes
    \blx@bibopenparen#1\blx@bibcloseparen
    \endgroup}

\AtEveryCite{%
    \let\parentext=\parentexttrack%
    \let\bibopenparen=\bibopenbracket%
    \let\bibcloseparen=\bibclosebracket}

\makeatother
\renewcommand*{\labelalphaothers}{}
\DefineBibliographyStrings{ngerman}{andothers={et\ al\adddot}} % aus u.a. zu et al. machen

\DeclareFieldFormat[phdthesis]{title}{#1} % keine Anführungszeichen um Titel bei allen Abschlussarbeiten

\renewcommand{\labelnamepunct}{\addcolon\space} % Doppelpunkt nach letztem Autor

\DeclareLabelalphaTemplate{
    \labelelement{
        \field[final]{shorthand}
        \field{label}
        % \field[strwidth=0,strside=left,ifnames=3-, namessep={\space}]{labelname}
        % \field[strwidth=0,strside=left,ifnames=2, namessep={\space und\space}]{labelname}
        \field[strwidth=20,strside=left,names=1]{labelname}
    }
    \labelelement{\literal{,\nobreakspace}}
    \labelelement{
        \field[strwidth=4,strside=right]{year}
    }
}

% Eckige Klammer um Abrufdatum URL/DOI ohne Text (\bibstring{urlseen}\space)
\DeclareFieldFormat{urldate}{\mkbibbrackets{#1}}

% Zitierung ohne eckige Klammern: Autor (Jahr) im Text: 
\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
    \boolfalse{pagetracker}%
    \usebibmacro{prenote}}
{\ifciteindex
    {\indexnames{labelname}}
    {}%
    \printtext[bibhyperref]{\printnames{labelname}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\def\citeplain#1{\citeauthor{#1} (\citeyear{#1})}

\bibliography{Literaturverzeichnis}{}
\addbibresource{Literaturverzeichnis.bib}

\begin{document}

\blindtext  \cite{Eschenauer1993a}

\nocite{*}
\printbibliography[title=Literaturverzeichnis]  

\end{document}
3
  • Are you using the authoryear style? You can make it much easier for us to help you, if you can show us a complete, yet minimal example document that shows how you load biblatex and how you use it: an MWE/MWEB. FWIW I know of no style that would produce the exact output "[Eschenauer, 1993a]" for the first citation out of the box, so I really need to know whether you use style=authoryear (where a solution should be fairly straightforward) or style=alphabetic (where I'm not sure).
    – moewe
    Sep 7, 2018 at 6:28
  • I would also need to know how the disambiguation label is supposed to be displayed in the bibliography.
    – moewe
    Sep 7, 2018 at 6:34
  • I added a MWE, the disambiguation label is the corresponding label in the bibliography right before the Entry am I correct? in that case it shoult also look like "[Eschenauer-1, 1993]" like in the text itself...
    – celi
    Sep 7, 2018 at 6:46

1 Answer 1

0

This seems like a very odd way to do disambiguation, especially because the disambiguation number is normally subordinate to the entire label, which is "Author, Year", putting it in the middle looks odd.

The disambiguation letter lives in the extraalpha field and is normally appended at the end of the label as generated by Biber. The format can easily be changed with \DeclareFieldFormat{extraalpha}. But injecting the value into the middle of the label is a bit harder, because Biber and biblatex normally consider the label and extraalpha separate.

We have to protect some things from being executed, that's why we need the \strings

\documentclass[10pt,a4paper]{article}

\usepackage[
backend         = biber,
style           = alphabetic,
]{biblatex}

\renewcommand*{\labelalphaothers}{}

\DeclareFieldFormat{extraalpha}{-#1}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=20,strside=left,names=1]{labelname}
  }
  \labelelement{
    \literal{%
      \string\printfield{extraalpha}%
      \string\global\string\clearfield{extraalpha}%
      ,\nobreakspace}
  }
  \labelelement{
    \field[strwidth=4,strside=right]{year}
  }
}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{knuth:ct:b}

\cite{knuth:ct:c}

\cite{sigfridsson}

\printbibliography
\end{document}

Knuth-1, 1986 Knuth-2, 1986 Sigfridsson, 1998

I would like to mention that I wholeheartedly object to using the alphabetic style to essentially recreate an authoryear citation (though I will admit that one or two peculiarities of your style would be difficult to implement, namely the 20-letter restriction on names and suppression of "et al.").

With your current style (alphabetic) the code to obtain square brackets around citations should not be needed any more.

I would recommend not defining \def\citeplain#1{\citeauthor{#1} (\citeyear{#1})}. Firstly (and this is a minor point), one should use \newcommand* instead of \def as much as possible. Secondly, this command will not be able to deal with pre- or post-note and not even with multiple citations. Most cite commands for biblatex should be defined with \DeclareCiteCommand.

2
  • Thank you @moewe this works like a charm! I agree that the way of displaying sources like this quite weird, but who am i to tell my professor how to write my thesis? The \citeplain command was created because he also wanted one citation to be just like text and not like an actual citation... I know it's kinda bumpy but at this point I'm just glad it works.. Anyway, thank you a lot!!
    – celi
    Sep 7, 2018 at 7:14
  • @celi You'll know better, but all professors I have dealt with so far are very reasonable people and if I had suggested that the citation system they favour is very unusual and hard to implement I'm sure they would have been fine with using a more natural system...
    – moewe
    Sep 7, 2018 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .