Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Does How can I use BibTeX to cite a web page? help you? It looks like a duplicate for me. –  Martin Scharrer Jan 23 '12 at 10:47
    
Not really I want only one bibtex entry for one site with serveral of urls. Or would you add serveral bibtex entries for one book if you referance serveral pages? –  rekire Jan 23 '12 at 10:50
    
You can use the [link text](http://someurl.com) syntax to add links. Simply press the 'Help' link below 'Add Comment' to see this and the other formatting options. –  Martin Scharrer Jan 23 '12 at 11:17
    
Why not trying to use your second idea (the URL as "page" reference), but put the whole citation in a footnote (using \footnote{\cite[]{}} or a custom \footcite[]{}. –  ienissei Jan 23 '12 at 11:18
    
A custom cite would be an option but I wanted to see what the professionals would do. \newcommand{\citeUrl}[4]{\nocite{#1}\hyperlink{cite.0@#1}{[#2\footnote{\url{#4}‌​}, #3]}} should work \citeUrl{Google2012}{Lifecycle}{Goo12}{http://...} –  rekire Jan 23 '12 at 11:26

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
If I don't mask the # I'll get an error. Your solution works good. But I have a little problem with adding such footnote cites in image descriptions. The cited image is quiet big so it is floated to the end of the chapter. That is at the moment no problem. But the footnote is refering the first page instat the footnote with the link. –  rekire Jan 23 '12 at 12:37
    
@rekire Footnotes to captions are bad practice, particularly for page floats. Put the URL in the caption, where it belongs. –  egreg Jan 23 '12 at 13:04
    
I think so too but I don't know how to do that better. How should I quote an Image with that page vs. site situation. –  rekire Jan 23 '12 at 13:40
    
@rekire For the error with the unescaped # a minimal example is needed. Also an example for the problematic caption would be great. –  egreg Jan 23 '12 at 13:43
    
I added an example on my question. –  rekire Jan 23 '12 at 14:54

On top of all the other advice, I'd state when the URL was visited. The reason for this is that many sites change on a regular basis, so the date visited matters.

share|improve this answer
    
My idea was to put meta infomations like date of visite, the author etc. in the BibTex entry and the concrete url to the cite. –  rekire Jan 23 '12 at 11:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.