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.

Right now I embed images like that:

\begin{figure}[htb]
    \centering 
    \includegraphics[width=0.5\textwidth]{images/some.pdf}
    \caption[Description in LOF, taken from~\cite{source}]{Caption for Image}
    \label{fig:sample_image}
\end{figure}

Using \listoffigures and hyperref this provides a nice list with every entry linked to the image position. As a requirement the source of the image has to be mentioned in the listoffigures it would be convenient to have the images or their caption linked to the matching entry so see the source without scrolling down the whole pdf.

So how do I link images to their entry in list of figures?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

If I understood your question correctly, you could use the \hyperlink, \hypertarget mechanism provided by hyperref; a little example:

\begin{filecontents*}{mybib.bib}
@book{goossens93,
    author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
    title = "The Latex Companion A",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}    
\end{filecontents*}

\documentclass{article} 
\usepackage[demo]{graphicx}
\usepackage{hyperref}

\newcounter{mycntr}
\makeatletter
\newcommand\LCaption{%
  \stepcounter{mycntr}\@dblarg\@LCaption}
\def\@LCaption[#1]#2{%
  \caption[\protect\hypertarget{image\themycntr}{#1}]%
    {\hyperlink{image\themycntr}{#2}}}
\makeatother

\begin{document}
\listoffigures

\begin{figure}[htb]
    \centering 
    \includegraphics[width=0.5\textwidth]{images/some.pdf}
    \LCaption[Description in LOF, taken from~\cite{goossens93}]{Caption for Image}
    \label{fig:sample_image}
\end{figure}

\bibliographystyle{plain}
\bibliography{mybib}

\end{document}

EDIT: I updated my answer with an improved version of \LCaption suggested by egreg. This version works like the original \caption command with respect to a missing optional argument: calling \LCaption{Caption} will write "Caption" also in the list of figures; \LCaption[Short]{Long caption} will write "Short" in the list of figures.

share|improve this answer
    
This works fine for me, as there are only a few figures to add the links manually. For existing documents with some dozens of figures it might be a job for a script or a macro. –  mbx Jul 28 '11 at 0:48
2  
@mbx: of course, you can easily define a command: something like \newcommand\LCaption[3][]{\caption[\protect\hypertarget{#3}{#1}]{\hyperlink{#3}‌​{#2}}} and then use \LCaption[Description in LOF, taken from~\cite{goossens93}]{Caption for Image}{sample} intead of \caption inside the figure environment. –  Gonzalo Medina Jul 28 '11 at 0:56
    
@mbx: see my updated answer. –  Gonzalo Medina Jul 28 '11 at 12:49
    
Nice piece of work, both of you. Works perfectly. Now it's really easy to add this feature even to existing papers. –  mbx Jul 28 '11 at 19:08
    
Just for completeness: Just found a minor (as nearly irrelevant) drawback when using TeXnicCenter2. The object view now cannot parse the caption and uses the label name instead. Maybe other GUI editors are affected as well. Not an issue to me :-) –  mbx Jul 28 '11 at 19:41
show 4 more comments

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.