From e4d4904298ee719365fa5b67fa5fbd366ba966e3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 5 Dec 2013 07:32:47 -0700 Subject: [PATCH] scriblib/figure: fix figures as ref targets Merge to v6.0 original commit: a794ef862ec462bcc43d30d9f1b4829cbf53f1ba --- pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex b/pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex index 961aff38..22d7bdc4 100644 --- a/pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex +++ b/pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex @@ -20,10 +20,14 @@ \newlength{\FigOrigskip} \FigOrigskip=\parskip -\newenvironment{Figure}{\begin{figure}}{\end{figure}} -\newenvironment{FigureMulti}{\begin{figure*}[t!p]}{\end{figure*}} -\newenvironment{FigureMultiWide}{\begin{FigureMulti}}{\end{FigureMulti}} -\newenvironment{Herefigure}{\begin{figure}[ht!]\centering}{\end{figure}} +% Put this before the figure content, so that a hyperref goes to +% the start of the content: +\newcommand{\FigureSetRef}{\refstepcounter{figure}} + +\newenvironment{Figure}{\begin{figure}\FigureSetRef}{\end{figure}} +\newenvironment{FigureMulti}{\begin{figure*}[t!p]\FigureSetRef}{\end{figure*}} +\newenvironment{FigureMultiWide}{\begin{FigureMulti}\FigureSetRef}{\end{FigureMulti}} +\newenvironment{Herefigure}{\begin{figure}[ht!]\FigureSetRef\centering}{\end{figure}} \newenvironment{Centerfigure}{\begin{Xfigure}\centering\item}{\end{Xfigure}} \newenvironment{Leftfigure}{\begin{Xfigure}\item}{\end{Xfigure}}