[Tex/LaTex] Custom biblatex style for citing images and tables

biblatexciting

I need to cite tables and images with a very specific style to satisfy a requirement from the institution. The resulting output of the \printbibliography should look like this for those citations:

Figure 3. http://www.example.com/img/name.jpg, visited on 6.3.2014

Table 6. http://www.example.com/tables/tables.pdf, visited on 9.3.2014.

Manually, this would be something like:

\newcommand{\tablebib}[3]{%
    Table \ref{#1} \url{#2}, visited on \displaydate{date}%
}

I'm using biblatex for other citations and would like to use it for those references as well. How can biblatex output such a format?

The final bibliography result should a mix between a more-or-less standard authoryear style (I managed to do this), and the above style for citing image and table sources from the Internet (I don't know how to do this):

Tomplinson, D., Baeyer, C.L., Stinson, J.N., Sung, L. (2010): A
Systematic Review of Faces Scales for the Self-report of Pain
Intensity in Children, Pediatrics, Vol.126, 5

Figure 3. http://www.example.com/img/name.jpg, visited on 6.3.2014.

Another manual try would be:

% arara: xelatex
% arara: biber
% arara: xelatex
\documentclass{scrartcl}
\usepackage[backend=biber,style=authoryear,sorting=nty]{biblatex}
\addbibresource{mwe.bib}

\begin{document}
\begin{table}[htb]
\begin{tabular}{l}
test
\end{tabular}
\caption{Description\cite{tab:test}}
\end{table}

\printbibliography
\end{document}

with the bibliography:

@Online{tab:test,
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab:test}}
}

This outputs:

(2014) Table ??. URL: http://www.example.com/images/image.jpg (visited on 02/25/2014)

Year should not be visible. The reference should be resolved. URL: should not be displayed, but the url itself should be visible.

Best Answer

Your \ref should point to the label of the table caption, not to the bibitem itself. This should resolve the reference:

  \documentclass{scrartcl}
\usepackage[colorlinks, urlcolor=black, linkcolor=black]{hyperref} %if you want the link to be clickable

\usepackage{filecontents} 
\begin{filecontents} {mwe.bib}
@online{tab:test,
  author                   = {Doe, John},
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab1}}, %<== this should point to your table caption label
  year                     = {2014}, %this is necessary for the in-text citation to work
}
\end{filecontents}

\usepackage[backend=biber, backref=true, style=authoryear, sorting=nty]{biblatex}
\addbibresource{mwe.bib}

\DeclareBibliographyDriver{online}{%this defines what will be printed in the bibliography for entries of type 'online'
  \usebibmacro{note+pages}
  \setunit{\addperiod\addspace}%Period+space after 'Note' field
  \usebibmacro{url+urldate}
  \usebibmacro{finentry}}


\begin{document}
\begin{table}
\caption{Figure legend here (\citeyear{tab:test})}{\label{tab1}} %<== this is what your \ref should be pointing to
\end{table}
Example \citeyear{tab:test} %This lets you cite only the year even if there is an author listed in your bib file, as opposed to \cite

\printbibliography
\end{document}

result

EDIT:

Adding this will remove URL:

\DeclareFieldFormat{url}{%
    {\url{#1}}}