[Tex/LaTex] Best practice for quoting a website

best practicesbibtexfootnotesurls

How should I quote a website? E.g. I'm using the android reference.

Here is my BibTeX entry:

@ELECTRONIC{Google2012,
  author = {Google},
  month = {01},
  year = {2012},
  title = {Android Developers},
  language = {english},
  url = {http://developer.android.com/reference/},
}

I quote different parts of that page and I think it is a bad idea adding dozens of references to the same site only to another page.

Actually I'm using this:

The Activity Lifecycle is blah blah\footnote{\url{http://developer.android.com/reference/android/app/Activity.html\#Fragments}}.\cite{Google2012}

But I think I should cite it e.g.:

The Activity Lifecycle is blah blah\cite[\url{http://developer.android.com/reference/android/app/Activity.html\#Fragments}]{Google2012}.

But that produced a very long line which I don't want. My next try was this here:

The Activity Lifecycle is blah blah\cite[Lifecycle\footnote{\url{http://developer.android.com/reference/android/app/Activity.html\#Fragments}}]{Google2012}.

The last one produces some strange errors:

Overfull \hbox (6.45833pt too wide) in paragraph at lines 463--464
[]\T1/lmr/m/n/12 The Ac-ti-vi-ty Li-fe-cy-cle is blah blah[[]Goo12[], []$\T1/lm
tt/m/n/12 http : / / developer . android . com / reference /$
! Use of \@xfootnote doesn't match its definition.
\@ifnextchar ...eserved@d =#1\def \reserved@a {#2}
\def \reserved@b {#3}\futu...
l.467 .../Activity.html\#Fragments}}]{Google2012}.

So what is the best practice for quoting and how can I fix my last solution?


After reading the answers I build my own solution. But I have got some trouble with that quotes in image lables.

Here is the compleate example:

\documentclass[
    a4paper,
    parskip,
    pdftex,
    ]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[backend=bibtex, natbib=true, citestyle=alphabetic, bibstyle=alphabetic]{biblatex}
\usepackage{hyperref}
\usepackage[all]{hypcap}
\usepackage{csquotes}
\usepackage{etoolbox}
\usepackage{blindtext}

\bibliography{source}

\newrobustcmd{\staticURL}[1]{%
  \expandafter\footnote\expandafter{\expandafter\url\expandafter{\detokenize{#1}}}}

\newcommand{\citeUrl}[3]{\cite[#1\staticURL{#2}]{#3}} %what, url, source

\begin{document}
\chapter{Example}
Here is some text related on bluetooth\citeUrl{Activity}{http://developer.android.com/reference/android/bluetooth/package-summary.html\#footer}{Google2012}

\Blindtext

\begin{figure}[htp]
  \centering
  \includegraphics[width=10cm]{img/activity_lifecycle}
  \caption{Activity Lifecycle \citeUrl{Activity}{http://developer.android.com/reference/android/app/Activity.html\#Fragments}{Google2012}}
  \label{activity_lifecycle}
\end{figure}
\end{document}

In mention of "Note that # doesn't need to be escaped." I'll get this error:

Chapter 1.
! Illegal parameter number in definition of \reserved@a.
<to be read again> 
                   f
l.26 ...h/package-summary.html#footer}{Google2011}

Best Answer

Since \url switches to a "verbatim" mode it can't go in the argument of another command. You can go over this limitation, in this particular case, with the following code

\documentclass{article}
\usepackage{etoolbox,hyperref}

\newrobustcmd{\urlfootnote}[1]{%
  \expandafter\footnote\expandafter{\expandafter\url\expandafter{\detokenize{#1}}}}
\begin{document}
The Activity Lifecycle is blah
blah\cite[Lifecycle\urlfootnote{http://developer.android.com/reference/android/app/Activity.html#Fragments}]{Google2012}.
\end{document}

Note that # doesn't need to be escaped.