[Tex/LaTex] Citing many long URLs (shortening and numbering)

biberbiblatexbibliographiescountersurls

In my thesis I have to quote a lot from a single weblog. The URLs are mostly of this structure:

  • blogname.providername.com/stories/123456
  • blogname.providername.com/stories/some-random-text-taken-from-the-first-words-of-the-blogpost
  • blogname.providername.com/topics/some-topic

or if it is a comment

  • blogname.providername.com/stories/123456/#123456

I quote probably several dozen of these very long URLs mainly within one chapter, normally in the footnotes. The problem is that the footnotes get almost unreadable, bloated and hard to typeset properly (line breaks etc.). Because of that I thought of shortening them and citing them in an appendix (next to the bibliography).

The idea is to use something along the lines of “see URL-1, 2012-03-01” and in the next citation “see URL-2, 2010-07-20”, so they are numbered sequentially.
And in the appendix there would be

URL-1: blogname.providername.com/stories/123456

URL-2: blogname.providername.com/stories/327162/#123456

The questions are:

  • would it be useful to quote them via bibtex/biblatex-Database? Or is there a better way, because the list in the appendix should be separated from the ‘normal’ bibliography
  • how to number them automatically as they are quoted?

For regular bibliography management I use biblatex and biber. I quote other URLs as well, so the bibliography driver for URLs shouldn’t be modified generally. BTW: the URLs have to be put into \url{}, because of hyperlinking them via hyperref and mainly because some of them include hash keys, which cause problems otherwise.

Does anyone have an idea how to do this? Any hints where and how to start would be welcome.

Edit1: Regarding jon’s hint: This discussion might be showing the right direction, but I don’t get it to work yet. I tried using the following new definition of a numeric cite command.

\newbibmacro*{numcite}{%
\printtext[bibhyperref]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
}}

\DeclareCiteCommand{\numcite}[\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{numcite}}
{\multicitedelim}
{\usebibmacro{postnote}}

But then I would still need a redefinition for my subbibliography. And I don’t know if that is possible.

Edit2: minimal working example (see my comment)

%!TEX encoding = UTF-8 Unicode

\begin{filecontents}{mybib.bib}

@book{HorkheimerAdorno-DdA,
    Author = {Max Horkheimer and Theodor W. Adorno},
    Location = {Frankfurt am Main},
    Publisher = {Fischer Taschenbuch Verlag},
    Subtitle = {Philosophische Fragmente},
    Title = {Dialektik der Aufklärung},
    Year = {1988}}

@online{url-blog-example,
    Url = {http://blogname.provider.com/stories/some-random-text-from-the-beginning-of-the-blog-entry/#8360558},
    Keywords = {Blogurl},
    Year = {22.9.2010}}

@online{url-blog-another-example,
    Url = {http://blogname.provider.com/stories/some-more-but-different-random-text-from-the-beginning-of-the-blog-entry/#1239877},
    Keywords = {Blogurl},
    Year = {13.4.2004}}


\end{filecontents}

\documentclass[12pt]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[babel,german=quotes]{csquotes}

\usepackage{hyperref,lipsum}


\usepackage[style=authortitle-dw]{biblatex}
\addbibresource{mybib.bib}


\begin{document}

\lipsum*[1]\footcite[34]{HorkheimerAdorno-DdA} \lipsum*[2]\footnote{Cf. \cite{url-blog-example} and cf. \cite{url-blog-another-example}.} 


\printbibheading
\printbibliography[notkeyword=Blogurl,heading=subbibliography,title={Main Sources}]
\printbibliography[keyword=Blogurl,heading=subbibliography,title={Blog Citations}]



\end{document}

Best Answer

Example 18 from the biblatex documentation (18-numeric-hybrid.tex) will get you most of the way there. The document below takes the example a step further by integrating citation labels for URL references via the shorthand field, dispensing with the need for an additional citation command. The solution requires some fixes to the biber-only multiple sorting scheme feature available with biblatex 2.3+ and biber 1.3+.

\documentclass{article}
\usepackage[backend=biber,style=authortitle-dw,
  labelnumber,defernumbers,alldates=iso8601]{biblatex}
\usepackage[colorlinks]{hyperref}

% adapted from authortitle-dw.cbx
\renewbibmacro*{cite:shorthand}{%
  \printtext[bibhyperref]{\printfield{shorthand}}%
  \ifkeyword{blog}
    {\iffieldundef{year}
       {}
       {\setunit*{\addcomma\space}%
        \iffieldundef{urlyear}{\printdate}{\printurldate}}}
    {}%
  \global\booltrue{cbx:noidem}}

\AtEveryCitekey{%
  \ifkeyword{blog}
    {\edef\cbxlabelnumber{\thefield{prefixnumber}\thefield{labelnumber}}%
     \restorefield{shorthand}{\cbxlabelnumber}%
     \ifboolexpr{ test {\ifbool{cbx:fullcite}} or
       ( test {\ifbool{cbx:firstfull}} and not test {\ifciteseen} ) }
       {\clearfield{year}}
       {}%
     \DeclareFieldAlias{url}{blogurl}}
    {}}

\defbibenvironment{blog}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\clearfield{year}%
   \DeclareFieldAlias{url}{blogurl}%
   \let\finentrypunct\relax
   \item}

\DeclareFieldFormat{blogurl}{\url{#1}}
\DeclareFieldFormat{labelnumberwidth}{#1\addcolon}

\begin{filecontents}{\jobname.bib}
@online{url1,
  Url = {http://blogname.provider.com/stories/entry/#8360558},
  Keywords = {blog},
  Year = {2010-09-22}}
@online{url2,
  Url = {http://blogname.provider.com/stories/text/#1239877},
  keywords = {blog},
  Year = {2004-04-13}}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{markey,url2,companion,url1}
\printbibheading
\printbibliography[heading=subbibliography,
  title={Main References},notkeyword=blog,omitnumbers]
\printbibliography[heading=subbibliography,
  title={Blog References},keyword=blog,env=blog,prefixnumbers={URL-},sorting=none]
\end{document}

enter image description here