3

I'm trying to resort my bibliography, but I'm stuck. At the end it should be sorted alphabetically after the first author, then the year, then the co-author and if that's the same the year should be extended with an a or b

At the moment there is a somehow twisted alphabetical sorting, but I couldn't find out how LateX is sorting the bibitems.

A graphical demonstration of what I mean: enter image description here

bbx-file:

% $Id: ulm.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $

\ProvidesFile{ulm.bbx}
[\abx@bbxid $Id: ulm.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $]

\newbibmacro*{begentry}{}
\newbibmacro*{finentry}{\finentry}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit\newblock
  \usebibmacro{journal+issuetitle}%
  \addcolon
  \usebibmacro{note+pages}%
  \newblock
  \usebibmacro{date}
%  \setunit{\bibpagerefpunct}\newblock
%  \usebibmacro{pageref}%
  \usebibmacro{finentry}}



\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \ifnameundef{editor}
      {}
      {
       \usebibmacro{in:}%
       \setunit{\addspace}
       \printnames{editor}%
       \setunit{\addspace}%
       \printtext{(Hrsg)}%
       \addspace%
       \usebibmacro{title}%
       \newblock}%
  \newunit\newblock
  \printfield{edition}%
  \newunit\newblock
  \usebibmacro{publisher+location}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \addspace
  \usebibmacro{date}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \ifnameundef{editor}
      {}
      {
       \usebibmacro{in:}%
       \setunit{\addspace}
       \printnames{editor}%
       \setunit{\addspace}%
       \printtext{(Hrsg)}%
       \newblock}%
  \addspace\newblock
  \printfield{series}
  \newunit\newblock
  \printfield{volume}
  \newunit\newblock
  \printfield{edition}%
  \newunit\newblock
  \usebibmacro{publisher+location}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \addspace
  \usebibmacro{date}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printfield{url}
  \newblock
  \printfield{note} %ich konnte mit meiner Literaturverwaltung nicht urldate mitangeben. Richtig wäre die Angabe \printfield{urldate}. Ggf. muss man das noch durch ein Makro in Klammern setzen.
  \usebibmacro{finentry}}

\DeclareBibliographyAlias{mvbook}{book}
\DeclareBibliographyAlias{bookinbook}{inbook}
\DeclareBibliographyAlias{suppbook}{inbook}
\DeclareBibliographyAlias{mvcollection}{collection}
\DeclareBibliographyAlias{suppcollection}{incollection}
\DeclareBibliographyAlias{mvproceedings}{proceedings}
\DeclareBibliographyAlias{reference}{collection}
\DeclareBibliographyAlias{mvreference}{reference}
\DeclareBibliographyAlias{inreference}{incollection}
\DeclareBibliographyAlias{suppperiodical}{article}
\DeclareBibliographyAlias{review}{article}
\DeclareBibliographyAlias{*}{misc}

\newbibmacro*{maintitle+title}{%
  \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
     \clearfield{mainsubtitle}%
     \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
       {}
       {\usebibmacro{maintitle}%
    \newunit\newblock
    \iffieldundef{volume}
      {}  \usebibmacro{series+number}%
        \newunit\newblock
        \printfield{note}%
        \newunit\newblock
      {\printfield{volume}%
           \printfield{part}%
           \setunit{\addcolon\space}}}}%
  \usebibmacro{title}%
  \newunit}

\newbibmacro*{maintitle+booktitle}{%
  \iffieldundef{maintitle}
    {}
    {\usebibmacro{maintitle}%
     \newunit\newblock
     \iffieldundef{volume}
       {}
       {\printfield{volume}%
        \printfield{part}%
        \setunit{\addcolon\space}}}%
  \usebibmacro{booktitle}%
  \newunit}

\newbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume}%
%  \setunit{\addspace}%
%  \usebibmacro{issue}%
  \setunit{\addcolon\space}%
  \newunit}

\newbibmacro*{volume}{%
  \printfield{volume}%
  \setunit*{\addcolon}%
  }

\newbibmacro*{title+issuetitle}{%
  \usebibmacro{periodical}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \printfield{volume}%
  \setunit*{\adddot}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}%
  \setunit{\addspace}%
  \usebibmacro{issue}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit} 

\renewbibmacro*{issue}{%
  \iffieldundef{issue}
      {}
    {\printtext[parens]{%
      {\printfield{issue}%
       \setunit*{\addspace}}}%
  \newunit}}

\newbibmacro*{series+number}{%
  \printfield{series}%
  \setunit*{\addspace}%
  \printfield{number}%
  \newunit}

\newbibmacro*{publisher+location}{%
    \iflistundef{publisher}
    {}
  \printlist{publisher}%
  \setunit*{\addcomma\space}
  \printlist{location}%
  \setunit*{\addcomma\space}%
  \newunit}

\newbibmacro*{institution+location+date}{%
  \printlist{location}%
  \iflistundef{institution}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcolon\space}}%
  \printlist{institution}%
%  \setunit*{\addcomma\space}%
%  \usebibmacro{date}%
  \newunit}

\newbibmacro*{organization+location+date}{%
  \printlist{location}%
  \iflistundef{organization}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcolon\space}}%
  \printlist{organization}%
%  \setunit*{\addcomma\space}%
%  \usebibmacro{date}%
  \newunit}

\newbibmacro*{location+date}{%
  \printlist{location}%
%  \setunit*{\addcomma\space}%
%  \usebibmacro{date}%
  \newunit}

\newbibmacro*{chapter+pages}{%
%  \printfield{chapter}%
%  \setunit{\addcomma\space}
  \usebibmacro{S.}
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \addspace}

\newbibmacro*{note+pages}{%
%  \printfield{note}%
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \addspace}

\ExecuteBibliographyOptions{labelnumber}

\providebool{bbx:subentry}

\DeclareBibliographyOption{subentry}[true]{%
  \setbool{bbx:subentry}{#1}}

\DeclareNameAlias{author}{default}
\DeclareNameAlias{editor}{default}
\DeclareNameAlias{translator}{default}

\DeclareFieldFormat{bibentrysetcount}{\mkbibparens{\mknumalph{#1}}}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\defbibenvironment{shorthands}
  {\list
     {\printfield[shorthandwidth]{shorthand}}
     {\setlength{\labelwidth}{\shorthandwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}%
      \renewcommand*{\makelabel}[1]{\hss##1}}}
  {\endlist}
  {\item}

\DeclareBibliographyDriver{set}{%
  \entryset
    {\ifbool{bbx:subentry}
       {\printfield[bibentrysetcount]{entrysetcount}%
    \setunit*{\addnbspace}}
       {}}
    {}%
  \newunit\newblock
  \usebibmacro{setpageref}%
  \finentry}

\def\MKbibnamefirst#1{\expandafter\mkbibnamefirst@i#1..\@nil}
\def\mkbibnamefirst@i#1.#2.#3\@nil{#1}

\renewbibmacro*{name:last-first}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifblank{#3}{}{%
       \ifcapital
         {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
     {\mkbibnameprefix{#3}}%
       \ifpunctmark{'}{}{\addhighpenspace}}%
     \mkbibnamelast{#1}\isdot
     \ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
     \ifblank{#2}{}{\addlowpenspace\mkbibnamefirst{#2}}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamelast{#1}\isdot
     \ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
%     \ifblank{#2#3}{}{\addcomma}%
     \ifblank{#2}{}{\addlowpenspace\MKbibnamefirst{#2}}%
%     \ifblank{#3}{}{\addlowpenspace\mkbibnameprefix{#3}\isdot}
}}

\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}

\renewcommand*{\multilistdelim}{\addslash }

\renewbibmacro*{finentry}{}

\newbibmacro*{S.}{%
  \printtext{S.}}


\renewbibmacro*{in:}{%
  \printtext{In:%
%    \bibstring{In}
    \intitlepunct}}

\endinput

cbx-file

% $Id: verbose-inote.cbx,v 1.7 2011/11/13 19:09:07 lehman stable $

\ProvidesFile{ulm.cbx}
[\abx@cbxid $Id: verbose-inote.cbx,v 1.7 2011/11/13 19:09:07 lehman stable $]

\ExecuteBibliographyOptions{labelnumber,sortcites,autocite=inline}
\renewcommand*{\multicitedelim}{\addcomma\space}
\providebool{bbx:subentry}
\DeclareFieldFormat[article,book,collection,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\addperiod}
\DeclareFieldFormat[article]{journaltitle}{#1}

\DeclareNameAlias{default}{last-first}
\renewcommand{\labelnamepunct}{\addcolon\space}
\AtEveryBibitem{\clearfield{month}}
%\renewbibmacro{in:}{}
\renewcommand*{\finalnamedelim}{%
  \ifbibliography% NEW
    {\addcomma\space}% NEW
    {\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
        \addspace\bibstring{and}\space}}
\DeclareFieldFormat[book]{year}{\mkbibquote{#1\isdot}}

\DeclareFieldFormat{pages}{#1\isdot}

\DeclareFieldFormat{entrysetcount}{\mknumalph{#1}}
\newbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

\newbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\multicitedelim}
    {\cbx@tempa
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \addspace\bibopenbracket}%
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \usebibmacro{cite}%
  \savefield{namehash}{\cbx@lasthash}%
  \gdef\cbx@tempa{\bibclosebracket\multicitedelim}}

\DeclareCiteCommand{\cite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibbrackets\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\textcite}
  {\let\cbx@tempa=\empty
   \undef\cbx@lasthash}
  {\usebibmacro{citeindex}%
   \usebibmacro{textcite}}
  {}
  {\usebibmacro{postnote}%
   \bibclosebracket}

\DeclareCiteCommand{\supercite}[\mkbibsuperscript]
  {\iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\supercitedelim}
  {}

\DeclareMultiCiteCommand{\cites}[\mkbibbrackets]{\cite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\mkbibbrackets]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibbrackets\mkbibfootnote]{\smartcite}{\multicitedelim}

\DeclareFieldFormat{edition}{%
  \ifinteger{#1}
    {\mkbibordedition{#1}~\printtext{Aufl}}
    {#1}}

\renewcommand\mkbibnamelast[1]{\textsc{#1}} %Autor/Editorname in small caps
\renewcommand*{\newunitpunct}{\addcomma\addspace}

\endinput

MWE:

\documentclass{scrreprt}
\usepackage[latin1]{inputenc}
\usepackage[
bibstyle=ulm, citestyle=ulm, maxbibnames=99,
]{biblatex}

\begin{filecontents*}{books.bib}
@ARTICLE{Jager2012a,
  author = {J\"ager, M. and Lang, F. and Frasch, K. and Becker, T.},
  title = {Schizophrene Psychosen mit bipolarem Verlauf -- Implikationen f\"ur
    Nosologie und Therapie},
  journal = {Fortschr Neurol Psychiatr},
  year = {2012},
  volume = {80},
  pages = {520--526},
  number = {09},
}

@ARTICLE{Jager2012b,
  author = {J\"ager, Markus and Lang, Fabian and Frasch, Karel and Becker, Thomas},
  title = {Schizophrenie und aggressives Verhalten -- die Bedeutung katatoner
    Ph\"anomene},
  journal = {Psychiatr Prax},
  year = {2012},
  volume = {39},
  pages = {84--90},
  number = {02},
}

@ARTICLE{Lang2012,
  author = {F. Lang and M. K\"osters and S. Lang and T. Becker and M. J\"ager},
  title = {Psychopathological long-term outcome of schizophrenia -- a review.},
  journal = {Acta Psychiatr Scand},
  year = {2012},
  pages = {173--182},
  month = {11},
}

@ARTICLE{Lang2012a,
  author = {Lang, F.U. and Klug, R. and Kunath, M. and Palm, C. and Uttner, I.
    and J\"ager, M.},
  title = {Fr\"uhe Demenz als Leitsyndrom einer Schizophrenie},
  journal = {Nervenarzt},
  year = {2012},
  pages = {1--4},
  publisher = {Springer-Verlag},

}

@ARTICLE{Lang2013,
  author = {Lang, F. U. AND Lang, S. AND Becker, T. AND J\"ager, M.},
  title = {Therapieresistente schizophrene Psychosen},
  journal = {Dtsch Z Nervenheilkd},
  year = {2013},
  volume = {3},
  pages = {145--149},
}


\end{filecontents*}

\bibliography{books.bib}

\begin{document}
\cite{Jager2012a}
\cite{Jager2012b}
\cite{Lang2012}
\cite{Lang2012a}
\cite{Lang2013}

\printbibliography
\end{document}

I've read the biblatex manual, but the only thing I found was sorting=nyt, but that doesn't work, because I'm not using biber.

  • Okay, ther solution for the problem with year 2012a or 2012b is simple. I just rename the year to the disired one in the books.bib file. This just leaves my sorting problem. – ingo Aug 26 '13 at 17:05
  • 2
    1) Why do you need extra letters after years? You never use them. They make sense for authoryear-like styles, not for the numeric. 2) You can have any sorting order you want, if you use the sortkey field. For example, set sortkey={Lang2012Klug} etc. There are also other sort... fields in biblatex. – Oleg Domanov Aug 27 '13 at 5:46
  • Thank you. I need the extra letter after the year because of my faculty, although I numerated my bibliography. It's said explicitly... With your help I just created my answer. – ingo Aug 27 '13 at 21:18
2

Like said in my first comment I added a letter in the bibliography, like 2012 a and 2012 b The wrong sorting of the three Lang entries I corrected by introducing sortname={LangX} X is the ordering number. With sortkey I would have had to define more sortkeys in my original = non-MWE-bibliography.

\documentclass{scrreprt}
\usepackage[latin1]{inputenc}
\usepackage[
bibstyle=ulm, citestyle=ulm, maxbibnames=99,
]{biblatex}

\begin{filecontents*}{books2.bib }
@ARTICLE{Jager2012a,
  author = {J\"ager, M. and Lang, F. and Frasch, K. and Becker, T.},
  title = {Schizophrene Psychosen mit bipolarem Verlauf -- Implikationen f\"ur
    Nosologie und Therapie},
  journal = {Fortschr Neurol Psychiatr},
  year = {2012 a},
  volume = {80},
  pages = {520--526},
  number = {09},
}

@ARTICLE{Jager2012b,
  author = {J\"ager, Markus and Lang, Fabian and Frasch, Karel and Becker, Thomas},
  title = {Schizophrenie und aggressives Verhalten -- die Bedeutung katatoner
    Ph\"anomene},
  journal = {Psychiatr Prax},
  year = {2012 b},
  volume = {39},
  pages = {84--90},
  number = {02},
}

@ARTICLE{Lang2012,
  author = {F. Lang and M. K\"osters and S. Lang and T. Becker and M. J\"ager},
  title = {Psychopathological long-term outcome of schizophrenia -- a review.},
  journal = {Acta Psychiatr Scand},
  year = {2012},
  pages = {173--182},
  month = {11},
  sortname = {Lang2}
}

@ARTICLE{Lang2012a,
  author = {Lang, F.U. and Klug, R. and Kunath, M. and Palm, C. and Uttner, I.
    and J\"ager, M.},
  title = {Fr\"uhe Demenz als Leitsyndrom einer Schizophrenie},
  journal = {Nervenarzt},
  year = {2012},
  pages = {1--4},
  publisher = {Springer-Verlag},
  sortname = {Lang1}

}

@ARTICLE{Lang2013,
  author = {Lang, F. U. AND Lang, S. AND Becker, T. AND J\"ager, M.},
  title = {Therapieresistente schizophrene Psychosen},
  journal = {Dtsch Z Nervenheilkd},
  year = {2013},
  volume = {3},
  pages = {145--149},
  sortname = {Lang3}
}


\end{filecontents*}

\bibliography{books2.bib }

\begin{document}
\cite{Jager2012a}
\cite{Jager2012b}
\cite{Lang2012}
\cite{Lang2012a}
\cite{Lang2013}

\printbibliography
\end{document}

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.