3

How do I move the date before the title in the bibliograhpy?

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{gates,
    author       = {Bill Gates},
    title        = {Save the world!},
    url          = {https://www.gatesfoundation.org/de/},
    urldate      = {2016-07-04},
    organization = {Bill and Melinda Gates Foundation},
}
\end{filecontents*}


\documentclass{article}

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

\DeclareFieldFormat{urldate}{visted at #1}


   \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}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\footcite{gates} \cite{gates}

\printbibliography
\end{document}

enter image description here

  • 3
    Welcome to TeX.se, and thanks for posting a minimal example document. But I'm not sure what output you want. When I correct your .bib file (missing brace in the title, and some commas between the fields), I get the following: Gates, Bill (July 4, 2016). Save the world! Bill and Melinda Gates Foundation. url: gatesfoundation.org/de. – Alan Munn Dec 10 '18 at 20:47
  • 2
    Please use the corrected bib entry I gave you in your last question. Can you please show us an screenshot and mark there what you want to change? Your question is not very clear ... – Mensch Dec 10 '18 at 21:15
  • The code in the MWE seems to come from tex.stackexchange.com/q/464166/35864. Are you the same person with a different account (you could ask SX staff to merge the accounts: tex.stackexchange.com/help/merging-accounts) or are you just a colleague with the same question? – moewe Dec 11 '18 at 8:41
  • No, I don't have a second account. But in the last few days there were some questions in this forum which all answered my problems exactly. I have to ask my collegues, with the same teacher with it's weird requirements, if they also post questions here. – czer Dec 11 '18 at 8:53
2

Since you are already changing the bibdriver (as a result of Biblatex move organization) I suggest you just move the call to \usebibmacro{date} a bit.

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{gates,
  author       = {Bill Gates},
  title        = {Save the world!},
  date         = {2016-05-04},
  url          = {https://www.gatesfoundation.org/de/},
  urldate      = {2016-07-04},
  organization = {{Bill and Melinda Gates Foundation}},
}
\end{filecontents*}

\documentclass{article}

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

\DefineBibliographyStrings{english}{
  urlseen = {visited at} 
} 

\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}

\DeclareListWrapperFormat{organization}{\mkbibemph{#1}}

\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \newunit\newblock
  \printlist{organization}%
  \newunit\newblock
  \usebibmacro{date}%
  \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
  \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}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\footcite{gates} \cite{gates}

\printbibliography
\end{document}

Gates, Bill. Bill and Melinda Gates Foundation. May 4, 2016. Save the world! url: https://www.gatesfoundation.org/de/ visited at 07/04/2016.

Since there is now no clear place for nametitledelim in the driver, it was replaced by the usual \newunit\newblock.

Note that I strongly recommend using the method Guido suggests in Biblatex change last visited: It is always preferable to use bibstrings, hard-coded text should be a last resort.

I have also applied the preferable solution for newer version of biblatex from my answer to Show institution with biblatex instead of the more awkward \DeclareListFormat{organization} for versions older than 3.12. In case the command \DeclareListWrapperFormat is not recognised, please refer to that answer for a workaround.

I would like to point out that the usual placement of organization in the @online driver makes sense because organization can be seen as largely analogous to publisher and institution and those lists are usually printed near the end of the entry together with the location and the date (at least if the date has not been moved to the front of the entry for an author-year style).

Finally note the double curly braces in organization = {{Bill and Melinda Gates Foundation}},. organization is a list field and if only a single pair of braces is used Biber will parse the list as containing the two organizations "Bill" and "Melinda Gates Foundation". The double curly braces escape the special meaning of the and and make sure that only one organization is parsed, namely the "Bill and Melinda Gates Foundation". You can see an unwanted side effect of not using the double curly braces in your example: The "and" is upright while the rest of the organization is in italics.

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.