Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion hyperref and figures
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Heiko Oberdiek  
View profile  
 More options May 29 2000, 3:00 am
Newsgroups: comp.text.tex
From: Heiko Oberdiek <oberd...@ruf.uni-freiburg.de>
Date: 2000/05/29
Subject: Re: hyperref and figures
Sebastian Rahtz <sebastian.ra...@computing-services.oxford.ac.uk>
wrote:

>Gekke Eekhoorn <ge...@beneden.pandora.be> writes:

>> Is there some way to make the reference to the label point to the beginning
>> of the bounding box of the figure?

>In a word, "no". Its a complicated business, because a `figure' can
>contain several captions and pictures.  In the general case, working
>out what the caption actually refers to (in the way of bounding box)
>is pretty damned hard.

I agree with Sebastian, in general it is not possible.
In limited and special cases you can try package `hypcap',
that I have written last year. But have to mark the
begin of the figure with \capstart or you can use
option `figure', but then each figure environment
has to use a \caption command, ...
It does not work with package `subfigure' and I expect
problems with similar packages.

Yours sincerely
  Heiko <oberd...@ruf.uni-freiburg.de>

%%% cut %%% hypcap.sty %%% cut %%%
% hypcap.sty
%
% Author: Heiko Oberdiek
% Copyright (c) 1999 by Heiko Oberdiek.
%
% Function: Setting the anchor for the link of \caption separatly
%           This package tries a solution of the problem with
%           hyperref that links to figures points below the
%           caption.
%
% Use:
%  * In short, if you want to fix all figure environments that
%    have all one \caption, try:
%      \usepackage[figure]{hypcap}% after \usepackage{hyperref}
%
%  * Important: Load package _AFTER_ hyperref
%
%  * \caption is divided into two parts:
%    a) If a \capstart is present, then it increments the counter
%       and sets the link anchor.
%    b) Then \caption  performs then the rest and omits the tasks,
%       that are done by \capstart.
%    Example:
%    \usepackge{hypcap} % _AFTER_ hyperref!
%    \begin{figure}
%      \capstart        
%      ...
%      \caption{...}
%    \end{figure}
%    ==> The link from \ref or \listoffigures points now to the
%        top of the figure not below.
%  
%    several \captions in a figure environment:
%    \capstart...\caption...\capstart...\caption
%
%  * In order not to specify \capstart at the begin of a
%    float environment, you can use the options:
%      figure, figure*, table, table*
%    The the correspondending environment is overloaded to
%    execute \capstart automatically. Then there must be a
%    \caption in every environment of this type.
%    For another \captions in the environment you need
%    \capstart again.
%  
%  * Because it looks poor, if the link points exactly at top of
%    the figure, there is additional space: \hypcapspace
%    the default is "0.5\baselineskip".
%    \renewcommand{\hypcapspace}{0pt} removes it
%    \renewcommand{\hypcapspace}{1pt} sets a fix value.
%
%  Please send bugreports, suggested improvements to the author:
%  Heiko Oberdiek <oberd...@ruf.uni-freiburg.de>
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hypcap}[1999/02/13 v1.0 Adjusting caption anchor
(HO)]

\@ifundefined{hyper@@anchor}{%
  \PackageError{hypcap}{You have to load 'hyperref' first}%
  \endinput

}{}

\newcommand*\hc@org@caption{}
\let\hc@org@caption\caption

\newcommand*\hc@caption{%
  \@dblarg{\@caption\@captype}% second part of caption

}

\newif\if@capstart

\newcommand*\hypcapspace{.5\baselineskip}

\newcommand*\capstart{%
  \H@refstepcounter\@captype % first part of caption
  \hyper@makecurrent\@captype
  \vspace*{-\hypcapspace}%
  \hyper@@anchor\@currentHref\relax
  \vspace*{\hypcapspace}%
  \let\caption\hc@caption
  \@capstarttrue

}

\def\hc@caption{%
  \@dblarg{\hc@@caption\@captype}%

}

\long\def\hc@@caption#1[#2]#3{%
  \let\caption\hc@org@caption
  \@capstartfalse
  \hyper@makecurrent\@captype
  \par\addcontentsline{%
    \csname ext@#1\endcsname}{#1}{%
    \protect\numberline{%
      \csname the#1\endcsname
    }{\ignorespaces #2}%
  }%
  \begingroup
    \@parboxrestore
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{%
      \ignorespaces#3%
    }%
    \par
  \endgroup

}

\def\hc@redef#1{%
  \expandafter\hc@@redef\csname hc@org#1\expandafter\endcsname
                        \csname hc@orgend#1\expandafter\endcsname
                        \expandafter{#1}%
}

\def\hc@@redef#1#2#3{%
  \expandafter\let\expandafter#1\csname#3\endcsname
  \expandafter\let\expandafter#2\csname end#3\endcsname
  \renewenvironment*{#3}[1][]{%
    \ifx\\##1\\%
      #1\relax
    \else
      #1[##1]%
    \fi
    \capstart
  }{%
    \if@capstart
      \PackageError{hypcap}{You have forgotten to use
\string\caption}%
    \else
    \fi
    #2%
  }

}

\DeclareOption{figure}{\hc@redef{\CurrentOption}}
\DeclareOption{figure*}{\hc@redef{\CurrentOption}}
\DeclareOption{table}{\hc@redef{\CurrentOption}}
\DeclareOption{table*}{\hc@redef{\CurrentOption}}
\ProcessOptions\relax
\let\hc@redef\@undefined
\let\hc@@redef\@undefined
\endinput
%%% cut %%% hypcap.sty %%% cut %%%

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google