# Custom biblatex style for citing images and tables

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}

\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.

• Can you give an example how your bibiliography should look like? It's uncommon to mix appendices (tables, figures) with the bibliography. – musicman Jun 14 '14 at 14:33
• @musicman I've updated my question with more examples. Basically, figures and tables can be from online sources, and in that case, the institution wants to have them cited in the bibliography. – ipavlic Jun 14 '14 at 15:07

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

  \documentclass{scrartcl}

\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}

\DeclareBibliographyDriver{online}{%this defines what will be printed in the bibliography for entries of type 'online'
\usebibmacro{note+pages}
\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}


EDIT:

Adding this will remove URL:

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

• Thank you so much! I spent a lot of time on that oversight. – ipavlic Jun 14 '14 at 23:37
• No problem, see my updated answer to remove URL:. – srao Jun 14 '14 at 23:48