2

I need to change the short citation. Right now it looks as follows: enter image description here

It should look like:

Gates, Bill and Melinda Gates Foundation, May 4. 2018, "Save the world..."

The "..." should appear after 3 or 4 words if that is technically possible.

How can I do that?

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


\documentclass{article}

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


\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\footcite{gates} sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \footcite{gates}

\printbibliography
\end{document}
  • Should that happen for all entry types or only for @online? I also feel that in this case the "..." is pretty useless, why not just include the "!" to get the full title? – moewe Dec 22 '18 at 14:25
  • This should only happen for @online. You're right, in this exemple it doesn't make that much sense, but with longer titles it does make sense. – czer Dec 22 '18 at 14:29
  • Do you really want to move the access date urldate between title and organization here? In tex.stackexchange.com/q/464205/35864 that place is taken by the normal publication date date. – moewe Dec 22 '18 at 14:38
  • No, the date should be between title and organization. I edited the question. – czer Dec 22 '18 at 16:20
  • 1
    Note that due to the and in the name of the organization you should use double braces, either organization = {{Bill and Melinda Gates Foundation}}, or organization = {Bill {and} Melinda Gates Foundation}, (I mentioned that before in tex.stackexchange.com/a/464276/35864). – moewe Dec 22 '18 at 16:23
3

Similarly to Custom type disappears in subsequent citations you need to branch the code for cite:short to obtain a different format for @online entries. A short version of the title can be specified in the shorttitle field. But that would require manual intervention, with Biber's sourcemapping you can automate that. I strongly suggest to scrutinise the output carefully in that case since the code is quite naive and chops off everything at the third word.

The MWE builds on the code from Move date before title in bibliography using biblatex to make the output for the full citation match the style of the short citation.

\documentclass{article}

\usepackage[style=verbose, autocite=footnote]{biblatex}

\DeclareFieldFormat[online]{shorttitle}{\mkbibquote{#1\dots\isdot}}
\newbibmacro*{cite:short:online}{%
  \printnames{labelname}%
  \setunit{\addcomma\space}%
  \printlist{organization}%
  \setunit{\addcomma\space}%
  \printdate
  \setunit{\addcomma\space}%
  \printtext[bibhyperlink]{%
    \iffieldundef{shorttitle}
      {\printfield[citetitle]{labeltitle}}
      {\printfield{shorttitle}}}}

% cite:short is really 'cite:subsequent'
\renewbibmacro*{cite:short}{%
  \ifbibmacroundef{cite:short:\strfield{entrytype}}
    {\printnames{labelname}%
     \setunit*{\printdelim{nametitledelim}}%
     \printtext[bibhyperlink]{%
       \printfield[citetitle]{labeltitle}}}
    {\usebibmacro*{cite:short:\strfield{entrytype}}}}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \step[fieldsource=title, match=\regexp{\A(\w+\s+){2}(\w+)}, final]
      \step[fieldset=shorttitle, origfieldval, final]
      \step[fieldsource=shorttitle, match=\regexp{\A(\w+\s+)(\w+\s+)(\w+).*}, replace={$1$2$3}]
    }
  }
}

\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}}


\usepackage{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}},
}
@online{gates2,
  author       = {Bill Gates},
  title        = {Save the moon with even longer titles},
  shorttitle   = {Save the moon},
  date         = {2016-05-04},
  url          = {https://www.gatesfoundation.org/de/},
  urldate      = {2016-07-04},
  organization = {Bill {and} Melinda Gates Foundation},
}
@online{ex:one,
  author       = {Anne Elk},
  title        = {One},
  url          = {https://example.com/~elk/1},
}
@online{ex:two,
  author       = {Anne Elk},
  title        = {Two Words},
  url          = {https://example.com/~elk/2},
}
@online{ex:three,
  author       = {Anne Elk},
  title        = {Three Words Title},
  url          = {https://example.com/~elk/3},
}
@online{ex:four,
  author       = {Anne Elk},
  title        = {Four Words in Title},
  url          = {https://example.com/~elk/4},
}
@online{ex:five,
  author       = {Anne Elk},
  title        = {Five Words in a Title},
  url          = {https://example.com/~elk/5},
}
@online{ex:long,
  author       = {Anne Elk},
  title        = {This Title Is Very Long to Test the Feature},
  url          = {https://example.com/~elk/long},
}
@online{ex:override,
  author       = {Anne Elk},
  title        = {A Long Title That Will Be Overridden},
  shorttitle   = {A Different Title},
  url          = {https://example.com/~elk/over},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\autocite{gates} sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \autocite{gates2}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\autocite{gates} sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \autocite{gates2}

Lorem\autocite{ex:one} ipsum\autocite{ex:one}.
Lorem\autocite{ex:two} ipsum\autocite{ex:two}.
Lorem\autocite{ex:three} ipsum\autocite{ex:three}.
Lorem\autocite{ex:four} ipsum\autocite{ex:four}.
Lorem\autocite{ex:five} ipsum\autocite{ex:five}.
Lorem\autocite{ex:override} ipsum\autocite{ex:override}.
Lorem\autocite{ex:long} ipsum\autocite{ex:long}.

\printbibliography
\end{document}

Fn. 1 Bill Gates. Bill and Melinda Gates Foundation. Save the world! url: https://www.gatesfoundation.org/de/ visited at 07/04/2016.//Fn. 2 Bill Gates. Bill and Melinda Gates Foundation. May 4, 2016. Save the moon with even longer titles. url: https://www.gatesfoundation.org/de/ visited at 07/04/2016.//Fn. 3 Gates, Bill and Melinda Gates Foundation, “Save the world...”//Fn. 4 Gates, Bill and Melinda Gates Foundation, May 4, 2016, “Save the moon...”//Fn. 5 Anne Elk. One. url: https://example.com/~elk/1.//Fn. 6 Elk, One.//Fn. 7 Anne Elk. Two Words. url: https://example.com/~elk/2.//Fn. 8 Elk, Two Words.//Fn. 9 Anne Elk. Three Words Title. url: https://example.com/~elk/3.//Fn. 10 Elk, “Three Words Title...”//Fn. 11 Anne Elk. Four Words in Title. url: https://example.com/~elk/4.//Fn. 12 Elk, “Four Words in...”//Fn. 13 Anne Elk. Five Words in a Title. url: https://example.com/~elk/5.//Fn. 14 Elk, “Five Words in...”//Fn. 15 Anne Elk. A Long Title That Will Be Overridden. url: https://example.com/~elk/over.//Fn. 16 Elk, “A Different Title...”//Fn. 17 Anne Elk. This Title Is Very Long to Test the Feature. url: https://example.com/~ elk/long.//Fn. 18 Elk, “This Title Is...”

In the matchreplace RegExp I went with the naive

match=\regexp{\A(\w+\s+)(\w+\s+)(\w+).*}, replace={$1$2$3}

if you want a more sophisticated solution that can be extended more easily, you could try

match=\regexp{\A((?:\w+\s+){2})(\w+).*}, replace={$1$2}

where ((?:\w+\s+){2}) captures the first 2 words and the (\w+) the following word.

| improve this answer | |

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.