3

When I make a reference I would like to have the url of the website and the consultation date in a footnote, and all the information in the bibliography.

I have created a function (\refbiblio) for that but I can't get the value of the urldate field, it's not recognized by \citefield.

I've checked the biblatex package, urldate is a field and there is no command to get it directly (like \citeurl for the url).

Here is MWE :

\documentclass[11pt]{article}
\usepackage[french]{babel}
  \FrenchFootnotes
  \AddThinSpaceBeforeFootnotes
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib} 
@misc{wiki_sdn,
  title={Wikipedia Software-defined networkong},
  url={https://en.wikipedia.org/wiki/Software-defined_networking},
  urldate={2019-02-24}
}
\end{filecontents} 
\usepackage[sorting=none]{biblatex}
  \addbibresource{biblio.bib}
\usepackage{csquotes}         % Add when use bibtex and babel
\usepackage{xpatch}           % Add when use biblatex and etoolbox
\usepackage[french]{isodate}
\newcommand{\refbiblio}[1]{\footnote{\citeurl{#1}, consulté le \citefield{#1}{urldate} \cite{#1}}}

\begin{document}
Test\refbiblio{wiki_sdn}
\printbibliography
\end{document}

And there is a picture of the result I get enter image description here

4

urldate is not a normal field, dates internally consist of several fields and must be handled differently, and so it can't be cited with \citefield. You could define a \citeurldate (like \citedate) as

\DeclareCiteCommand{\citeurldate}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printurldate}
  {\multicitedelim}
  {\usebibmacro{postnote}}

and use that.

It is, however, much better not to combine several \cite... commands into a \newcommand. Instead the entire command \refbiblio should be declared as a biblatex cite command with \DeclareCiteCommand. A simple example why \DeclareCiteCommand is better than \newcommand with several \cite...s is that \DeclareCiteCommand can handle multiple citations as well as pre- and postnotes properly. If you want to do that with \newcommand, additional work is needed. You may also run into issues with citation trackers ('ibid.' etc.) if you combine several \cite... commands into a single invocation.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\FrenchFootnotes
\AddThinSpaceBeforeFootnotes

\usepackage{csquotes}
\usepackage[french]{isodate}

\usepackage[sorting=none]{biblatex}

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

\renewbibmacro*{url+urldate}{%
  \usebibmacro{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addcomma\space}%
     \usebibmacro{urldate}}}

\DeclareCiteCommand{\fnurlcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{url+urldate}%
   \setunit{\addspace}%
   \printtext[labelnumberwidth]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib} 
@misc{wiki_sdn,
  title   = {Wikipedia Software-defined networking},
  url     = {https://en.wikipedia.org/wiki/Software-defined_networking},
  urldate = {2019-02-24},
}
\end{filecontents} 
\addbibresource{\jobname.bib}

\begin{document}
Test\fnurlcite{wiki_sdn}
\printbibliography
\end{document}

url: https://en.wikipedia.org/wiki/Software-defined_networking, visité le 24/02/2019 [1].

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.