BibTeX, biblatex and biberCitations in figure captions

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
j_kubik
Posts: 7
Joined: Thu Mar 18, 2010 6:25 pm

Citations in figure captions

Post by j_kubik »

Hi,

I am using natbib and hyperref packages. In my latex document i have some figures taken from books in bibliography - i want to have citation reference in figure caption. It all worked well unless i added list of figures - now figures with citations are not linked to the figure placement in the list of figures. The only link that appears is the link to the bibliogrpahy, and i guess this is blocking linking to figure.

I had similar problem with references in captions - fortunately this can be solved by something like that

Code: Select all

\caption[\ref*{123}]{\ref{123}}
Is there any version off cite/citep that doesn't make citations links (like ref*)?
Last edited by j_kubik on Sat Jun 12, 2010 5:47 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Citations in figure captions

Post by localghost »

Usually the citation doesn't appear in the LoF or LoT. So you can use the short of the caption for the list entry and keep your citation.

Code: Select all

\caption[Caption for list entry]{Full caption with citation \cite{key}}

Thorsten
j_kubik
Posts: 7
Joined: Thu Mar 18, 2010 6:25 pm

Re: Citations in figure captions

Post by j_kubik »

I know this one - but requirements for my work are quite strict - captions of figures have to match exactly lines in LoF (and obviously i cannot skip citing data source), so this will not work. Actually nobody requires me to have proper links in my document (or any links at all), but it would be a nice thing to have it working.

Another idea i've had was to access somehow the number of bibliography - i mean something like accessing figure counter with \value{figure}, but for citations. Then i could copy caption twice, and for the second one use this value instead of \cite (i am using numeric citation [1]). After some googling i haven't found anything like that - does anybody know if it's possible?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Citations in figure captions

Post by localghost »

The code below works fine for me.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{blindtext}
\usepackage{hyperref}

\begin{document}
  \listoffigures
  \blinddocument

  \begin{figure}[!ht]
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure with citation \protect\cite{foo}}\label{fig:dummy}
  \end{figure}

  \clearpage
  \begin{thebibliography}{9}
    \bibitem{foo} Foo bar
  \end{thebibliography}
\end{document}
In case of need use the linktocpage option for the hyperref package. This will make the page number of the LoF entry the link to the figure.
j_kubik
Posts: 7
Joined: Thu Mar 18, 2010 6:25 pm

Citations in figure captions

Post by j_kubik »

Thanks - using linktocpage somehow haven't occurred to me. It doesn't do exactly what i want to do, but it keeps the same functionality. What i wanted to do, was to make all the entries in LoF looking like the second one in this example

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{blindtext}
\usepackage{hyperref}

\begin{document}
  \listoffigures
  \blinddocument

  \begin{figure}[!ht]
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure with citation \cite{foo}}\label{fig:dummy}
  \end{figure}

  \begin{figure}[!ht]
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure without citation}\label{fig:dummy2}
  \end{figure}


  \clearpage
  \begin{thebibliography}{9}
    \bibitem{foo} Foo bar
  \end{thebibliography}
\end{document}
I wanted to do it this way, cause on pdf viewers that doesn't colour links (eg. Acrobat Reader) it might be a bit difficult for a reader to figure out that clicking on a number will take him to an image - having whole line as link would be much more intuitive.

Anyway thanks - this solution is good enough.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Citations in figure captions

Post by localghost »

Now I'm a bit irritated. You mentioned something about having a citation in the LoF with working links to the figure as well as to the bibliography entry due to strict demands. And now you are saying that a simple caption is sufficient for you? Very confusing. I gave you this solution in my first reply, a LoF entry without citation. I would like to know what point of the provided solution didn't please you. A complete and minimal example that shows your document setup would help to get a clue.
j_kubik
Posts: 7
Joined: Thu Mar 18, 2010 6:25 pm

Re: Citations in figure captions

Post by j_kubik »

I mentioned that LoF text should match exactly the figure caption - that's all about strict requirements. I have even said that nobody requires any linking at all - paper is supposed to be printed in the end anyway.

I wanted (just for me to get it working:) ) the links in LoF point to figures even if there is citation in the text. That means I wanted to use the same text twice - once as figure caption (with citations as links), and then as LoF entry (with citations, but entire text as link to the figure - which implies that citation itself is not a link anymore).

The solution provided is working - it is creating links. Those links however are only page numbers, and not entire lines in LoF. With Acrobat reader, which is not using any specific marking for links, you can only recognize links by hovering them. Typical user will most likely miss the fact that clicking page number will take him to figure, and functionality while existing, will be largely unused.
Post Reply