3

When citing a page with an electronic entry the page number should be behind the title of the website. With a normal website this may not make that much sense but with a pdf from a website it does.
enter image description here

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@Electronic{wade,
  title     = {Darwin, Ahead of His Time, Is Still Influential},
  author    = {Nicholas Wade},
  date       = {2009-02-09},
  url       = {https://www.nytimes.com/2009/02/10/science/10evolution.html?ref=sciencespecial2},
  urldate   = {2018-10-08},
  }


\end{filecontents*}


\documentclass{article}

\usepackage[style=verbose, autocite=footnote]{biblatex}
\addbibresource{\jobname.bib}
\DeclareFieldFormat[online, article]{title}{\mkbibquote{#1\isdot}}
\begin{document}
Lorem ipsum   \autocite[p. 42]{wade}

\printbibliography
\end{document}

How can I do that?

heidil
  • 171
  • 3
    In general it is better to use \autocite[42]{wade} instead of \autocite[p. 42]{wade}: Usually biblatex is really good at figuring out automatically whether or not a "p." or "pp." is needed. – moewe Dec 24 '18 at 22:21

2 Answers2

3

You are already heavily modifying the bibliography driver for @online (compare Customize second citation for books, articles, incollection with code from amongst others Move date before title in bibliography using biblatex, Biblatex move organization), so like Henri Menke in his answer I will modify the driver directly. In case the bibliography driver is not being changed that much, one could inject the \usebibmacro{bib:postnote} into the title bibmacro or patch the driver with xpatch to keep the code shorter.

Printing the postnote in the bibliography driver is the easy bit, suppressing the postnote at the end if it has been printed before is trickier. Luckily the verbose citation styles know an option called citepages. That option is intended to control the appearance of page postnotes in full citations where the pages field is also present. See the verbose style documentation for an explanation with examples. It is possible to make use of the infrastructure for that option to avoid printing the postnote twice in this case as well. (Note that the implementation below therefore relies on a citation style of the verbose family. If you wanted to do the same for say, \fullcite or a different style, things would be a bit more involved. Though you would probably just copy the citepages infrastructure from verbose.cbx and simplify it a bit.)

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

% modelled after the citepages option of the verbose family
\newtoggle{cbx:suppresspostnote}
\renewbibmacro*{cite:citepages}{%
  \global\togglefalse{cbx:suppresspostnote}}%
\renewbibmacro*{cite:full:citepages}{%
  \global\togglefalse{cbx:suppresspostnote}}%
\renewbibmacro*{cite:postnote}{%
  \iftoggle{cbx:suppresspostnote}
    {}
    {\usebibmacro{postnote}}}

% usually I don't like to start bibmacros with punctuation
% but in this case I thought it would work nicer that way
\newbibmacro{bib:postnote}{%
  \ifnumequal{\value{citecount}}{\value{citetotal}}
    {\setunit{\postnotedelim}%
     \printfield{postnote}%
     \global\toggletrue{cbx:suppresspostnote}}
    {}%
}

%%%%% https://tex.stackexchange.com/q/464205/35864,
%%%%% https://tex.stackexchange.com/q/464166/35864
\DeclareFieldFormat[online]{title}{\mkbibquote{#1\isdot}}

\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}%
  \usebibmacro{bib:postnote}%
  \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}}
%%%% 464205 & 464166 END

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{wade,
  title     = {Darwin, Ahead of His Time, Is Still Influential},
  author    = {Nicholas Wade},
  date      = {2009-02-09},
  url       = {https://www.nytimes.com/2009/02/10/science/10evolution.html},
  urldate   = {2018-10-08},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem ipsum\autocite[42]{wade}

Lorem ipsum\autocite[380]{sigfridsson}

Lorem ipsum\autocite[43]{wade}

\printbibliography
\end{document}

Nicholas Wade. Feb. 9, 2009. “Darwin, Ahead of His Time, Is Still Influential”, p. 42. url: https://www.nytimes.com/2009/02/10/science/10evolution.html visited at 10/08/2018.//Emma Sigfridsson and Ulf Ryde. “Comparison of methods for deriving atomic charges from the electrostatic potential and moments”. In: *Journal of Computational Chemistry* 19.4 (1998), pp. 377–395. doi: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P, p. 380.//Wade, Darwin, Ahead of His Time, Is Still Influential, p. 43.

Note that since this answer uses the already modified @online driver from the questions and answers linked above, the output is slightly different from the one shown in the question.

moewe
  • 175,683
  • @heidil Thanks for adding the screenshot, though I must admit I was aiming for a screenshot of the footnotes and not the bibliography. – moewe Dec 25 '18 at 12:06
  • You're completely right. A picture from the bibliography doesn't make much sense. I corrected it. – heidil Dec 25 '18 at 16:23
  • @heidil Thank you very much. I added the removed text form of the output as alt-text for people with screen readers or where the picture does not load. – moewe Dec 25 '18 at 19:35
2

You have to hack deep into the bibliography driver to accomplish this.

% arara: pdflatex
% arara: biber
% arara: pdflatex
% arara: pdflatex
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@Electronic{wade,
  title     = {Darwin, Ahead of His Time, Is Still Influential},
  author    = {Nicholas Wade},
  date       = {2009-02-09},
  url       = {https://www.nytimes.com/2009/02/10/science/10evolution.html?ref=sciencespecial2},
  urldate   = {2018-10-08},
  }


\end{filecontents*}

\documentclass{article}

\usepackage[style=verbose, autocite=footnote]{biblatex}
\addbibresource{\jobname.bib}
\DeclareFieldFormat[online, article]{title}{\mkbibquote{#1\isdot}}

\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit              % <--- NEW!
  \usebibmacro{postnote}% <--- NEW!
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \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}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {}%{\usebibmacro{cite:postnote}} % <-- NEW!

\begin{document}
Lorem ipsum \autocite[p. 42]{wade}

\printbibliography
\end{document}

enter image description here

Henri Menke
  • 109,596
  • Something along those lines is required, but completely removing the postnote from the \cite... macros will also remove postnotes from all other entry types. – moewe Dec 24 '18 at 22:20