1

The alphabetical sorting doesn't work if I have entries with only an organization. The bibliography should be sorted alphabetically in a non-hierachical way between the organization and the author.

I don't think that the solution with corporate authors in double brackets works, because I need the organizations in italics.

\begin{filecontents}{\jobname.bib}
      @online{musk,
        author       = {Elon Musk},
        title        = {Tesla Model X},
        url          = {https://www.tesla.com/modelx?redirect=no},
        date         = {2017-07-04},
        organization = {Tesla},
        urldate      = {2018-10-16},
      },

@online{b, title = {Tesla Model X}, url = {https://www.tesla.com/modelx?redirect=no}, date = {2017-07-04}, organization = {ABZ}, urldate = {2018-10-16}, },

@online{a, title = {Tesla Model X}, url = {https://www.tesla.com/modelx?redirect=no}, date = {2017-07-04}, organization = {ZBA}, urldate = {2018-10-16}, }, \end{filecontents}

\documentclass{article} \usepackage[style=authortitle]{biblatex} \addbibresource{\jobname.bib} \DeclareListFormat{organization}{% \usebibmacro{list:delim}{#1}% \mkbibemph{#1}\isdot \usebibmacro{list:andothers}}

\DeclareBibliographyDriver{online}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% \setunit{\printdelim{nametitledelim}}\newblock \printlist{organization}% \newunit\newblock \usebibmacro{title}% \newunit \printlist{language}% \newunit\newblock \usebibmacro{byauthor}% \newunit\newblock \usebibmacro{byeditor+others}% \newunit\newblock \printfield{version}% \newunit \printfield{note}% \newunit\newblock \usebibmacro{date}% \newunit\newblock \iftoggle{bbx:eprint} {\usebibmacro{eprint}} {}% \newunit\newblock \usebibmacro{url+urldate}% \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}}

\begin{document} Let's cite! \footcite{musk} \footcite{a} \footcite{b} \printbibliography \end{document}

With this MWE I get the following output: enter image description here

However, it should be sorted as follows:

ABZ [...]
Musk [...]
ZBA [...]

How can I achieve that?

derd
  • 107
  • 2
    The customization for the organisation comes from https://tex.stackexchange.com/questions/464166/biblatex-move-organization – derd Dec 14 '18 at 22:41
  • If you have bib entries without an author field but with an organization field, you may want to rethink the organization (pun intended) of these entries: change the name of the organization field to author and encase the authorfield in double curly braces. That way, you inform biblatex (or BibTeX) that it's dealing with a "corporate" author, not the name of a "normal" person. – Mico Dec 15 '18 at 08:53

1 Answers1

3

Indeed, the organization field is not part of the default sort template. You could either add it or, as I suggest you assuming you have a limited number of such entries, you can provide a sortkey to the bib entries of interest:

\begin{filecontents}{\jobname.bib}
  @online{musk,
    author       = {Elon Musk},
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {Tesla},
    urldate      = {2018-10-16},
  },

  @online{b,
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {ABZ},
    sortkey      = {ABZ},
    urldate      = {2018-10-16},
  },

  @online{a,
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {ZBA},
    sortkey      = {ZBA},
    urldate      = {2018-10-16},
  },
\end{filecontents}

\documentclass{article}
\usepackage[style=authortitle]{biblatex}
\addbibresource{\jobname.bib}
\DeclareListFormat{organization}{%
  \usebibmacro{list:delim}{#1}%
  \mkbibemph{#1}\isdot
  \usebibmacro{list:andothers}}

\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \printlist{organization}%
  \newunit\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{date}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
  {\usebibmacro{eprint}}
  {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\begin{document}
Let's cite! \footcite{musk} \footcite{a} \footcite{b}
\printbibliography
\end{document}

enter image description here

Alternatively, as requested in the comments, by adding organization to the sorting template:

\begin{filecontents}{\jobname.bib}
  @online{musk,
    author       = {Elon Musk},
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {Tesla},
    urldate      = {2018-10-16},
  },

  @online{b,
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {ABZ},
    urldate      = {2018-10-16},
  },

  @online{a,
    title        = {Tesla Model X},
    url          = {https://www.tesla.com/modelx?redirect=no},
    date         = {2017-07-04},
    organization = {ZBA},
    urldate      = {2018-10-16},
  },
\end{filecontents}

\documentclass{article}
\usepackage[style=authortitle]{biblatex}
\addbibresource{\jobname.bib}

\DeclareSortingTemplate{nty}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{organization}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

\DeclareListFormat{organization}{%
  \usebibmacro{list:delim}{#1}%
  \mkbibemph{#1}\isdot
  \usebibmacro{list:andothers}}

\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \printlist{organization}%
  \newunit\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{date}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
  {\usebibmacro{eprint}}
  {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\begin{document}
Let's cite! \footcite{musk} \footcite{a} \footcite{b}
\printbibliography
\end{document}
gusbrs
  • 13,740