TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My document:








W rozdziale \ref{rozdzial-bzdety} ze strony \pageref{rozdzial-bzdety}
znajduje się obrazek \ref{obraz-jesien} na stronie \pageref{obraz-jesien}.

The first paragraph.

    \caption[Opcjonalny skrócony opis do spisu obrazków]{Opis}

The second paragraph.

hyerref makes nice hyperlinks to captions of images. I can for example create list of figures. That is nice. But every link is going to caption and image is above it so reader needs to scroll up to see it. How can I change something in preamble so clicking on such hyperrlink leads to the top of image? I don't want to change anything outside preamble unless necessary.

share|improve this question
hyperref should be loaded last but right before hypcap. It means no more \usepackage commands can exist after \usepackage[]{hyperref}\usepackage{hypcap}. – xport Jul 17 '11 at 10:14
That's not precisely true: for example also bookmark should be loaded after hyperref (and it's advised to do this, since bookmark provides better bookmark management). – egreg Jul 17 '11 at 10:20
@Ichibann: The second version of your MWE allowed me to find an answer. Note, however, that the draft option has to be added to the graphicx package to make your example compilable if one lacks the file a.jpg. – lockstep Jul 17 '11 at 10:38
up vote 6 down vote accepted

Load hypcap with the all option: \usepackage[all]{hypcap}. See section 1.1 of the documentation for details.

EDIT: Here's a rather minimal working example (only the code for centering floats is retained):








share|improve this answer
OK, thanks. Why I'm getting ! LaTeX Error: Option clash for package graphicx.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \usepackage when trying to use [draft]? I'm sorry about MWE - I don't know exactly what should I leave and what can be ommitted :( – Ichibann Jul 17 '11 at 10:44
You mean in your "real" document? Possibly another package loads graphicx without options before you try to load it with the draft option. Try to move up \usepackage[draft]{graphics} in your preamble. – lockstep Jul 17 '11 at 10:47
And you shouldn't be sorry about your MWE -- finding out what is relevant for the problem at hand often involves trial and error, and your second MWE version was much better than the first. – lockstep Jul 17 '11 at 10:49
You were right:). I moved it up and it works :). Thanks! – Ichibann Jul 17 '11 at 10:53

Your Answer


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.