| 1 |
%% |
| 2 |
%% This is file `hypcap.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% hypcap.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Project: hypcap |
| 12 |
%% Version: 2024-07-26 v1.13 |
| 13 |
%% |
| 14 |
%% Copyright (C) |
| 15 |
%% 1999-2001, 2006-2008, 2011 Heiko Oberdiek |
| 16 |
%% 2016-2024 Oberdiek Package Support Group |
| 17 |
%% |
| 18 |
%% This work may be distributed and/or modified under the |
| 19 |
%% conditions of the LaTeX Project Public License, either |
| 20 |
%% version 1.3c of this license or (at your option) any later |
| 21 |
%% version. This version of this license is in |
| 22 |
%% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 23 |
%% and the latest version of this license is in |
| 24 |
%% https://www.latex-project.org/lppl.txt |
| 25 |
%% and version 1.3 or later is part of all distributions of |
| 26 |
%% LaTeX version 2005/12/01 or later. |
| 27 |
%% |
| 28 |
%% This work has the LPPL maintenance status "maintained". |
| 29 |
%% |
| 30 |
%% The Current Maintainers of this work are |
| 31 |
%% Heiko Oberdiek and the Oberdiek Package Support Group |
| 32 |
%% https://github.com/ho-tex/hypcap/issues |
| 33 |
%% |
| 34 |
%% This work consists of the main source file hypcap.dtx |
| 35 |
%% and the derived files |
| 36 |
%% hypcap.sty, hypcap.pdf, hypcap.ins, hypcap.drv. |
| 37 |
%% |
| 38 |
\NeedsTeXFormat{LaTeX2e} |
| 39 |
\ProvidesPackage{hypcap}% |
| 40 |
[2024-07-26 v1.13 Adjusting the anchors of captions (HO)] |
| 41 |
\@ifundefined{hyper@@anchor}{% |
| 42 |
\PackageError{hypcap}{You have to load 'hyperref' first}\@ehc |
| 43 |
\endinput |
| 44 |
}{} |
| 45 |
\RequirePackage{letltxmacro}[2008/06/24] |
| 46 |
\newcommand*\hc@org@caption{} |
| 47 |
\let\hc@org@caption\caption |
| 48 |
\newif\if@capstart |
| 49 |
\newcommand*\hypcapspace{.5\baselineskip} |
| 50 |
\newif\ifcapstart |
| 51 |
\capstarttrue |
| 52 |
\newcommand*\capstart{% |
| 53 |
\ifcapstart |
| 54 |
\H@refstepcounter\@captype % first part of caption |
| 55 |
\hyper@makecurrent\@captype |
| 56 |
\global\let\hc@currentHref\@currentHref |
| 57 |
\vspace*{-\hypcapspace}% |
| 58 |
\begingroup |
| 59 |
\let\leavevmode\relax |
| 60 |
\hyper@@anchor\@currentHref\relax |
| 61 |
\endgroup |
| 62 |
\vspace*{\hypcapspace}% |
| 63 |
\hc@hyperref{\let\caption\hc@caption}% |
| 64 |
\global\@capstarttrue |
| 65 |
\global\advance\csname c@\@captype\endcsname\m@ne |
| 66 |
\fi |
| 67 |
} |
| 68 |
\@ifpackagelater{hyperref}{2007/04/09}{% |
| 69 |
\let\hc@hyperref\@gobble |
| 70 |
}{% |
| 71 |
\let\hc@hyperref\@firstofone |
| 72 |
} |
| 73 |
\def\hc@caption{% |
| 74 |
\global\advance\csname c@\@captype\endcsname\@ne |
| 75 |
\@dblarg{\hc@@caption\@captype}% |
| 76 |
} |
| 77 |
\long\def\hc@@caption#1[#2]#3{% |
| 78 |
\let\caption\hc@org@caption |
| 79 |
\global\@capstartfalse |
| 80 |
\ifHy@hypertexnames |
| 81 |
\hyper@makecurrent\@captype |
| 82 |
\else |
| 83 |
\global\let\@currentHref\hc@currentHref |
| 84 |
\fi |
| 85 |
\par\addcontentsline{% |
| 86 |
\csname ext@#1\endcsname}{#1}{% |
| 87 |
\protect\numberline{% |
| 88 |
\csname the#1\endcsname |
| 89 |
}{\ignorespaces #2}% |
| 90 |
}% |
| 91 |
\begingroup |
| 92 |
\@parboxrestore |
| 93 |
\normalsize |
| 94 |
\@makecaption{\csname fnum@#1\endcsname}{% |
| 95 |
\ignorespaces#3% |
| 96 |
}% |
| 97 |
\par |
| 98 |
\endgroup |
| 99 |
} |
| 100 |
\def\hypcapredef#1{% |
| 101 |
\expandafter\hc@redef\csname hc@org#1\expandafter\endcsname |
| 102 |
\csname hc@orgend#1\expandafter\endcsname |
| 103 |
\expandafter{#1}% |
| 104 |
} |
| 105 |
\def\hc@redef#1#2#3{% |
| 106 |
\newcommand#1{}% |
| 107 |
\expandafter\LetLtxMacro\expandafter#1\csname#3\endcsname |
| 108 |
\expandafter\LetLtxMacro\expandafter#2\csname end#3\endcsname |
| 109 |
\renewenvironment*{#3}[1][]{% |
| 110 |
\ifx\\##1\\% |
| 111 |
#1\relax |
| 112 |
\else |
| 113 |
#1[##1]% hash-ok (compatibility for float) |
| 114 |
\fi |
| 115 |
\capstart |
| 116 |
}{% |
| 117 |
\if@capstart |
| 118 |
\PackageWarning{hypcap}{You have forgotten to use \string\caption}% |
| 119 |
\global\@capstartfalse |
| 120 |
\else |
| 121 |
\fi |
| 122 |
#2% |
| 123 |
}% |
| 124 |
} |
| 125 |
\DeclareOption{figure}{\hypcapredef{\CurrentOption}} |
| 126 |
\DeclareOption{figure*}{\hypcapredef{\CurrentOption}} |
| 127 |
\DeclareOption{table}{\hypcapredef{\CurrentOption}} |
| 128 |
\DeclareOption{table*}{\hypcapredef{\CurrentOption}} |
| 129 |
\DeclareOption{all}{% |
| 130 |
\hypcapredef{figure}% |
| 131 |
\hypcapredef{figure*}% |
| 132 |
\hypcapredef{table}% |
| 133 |
\hypcapredef{table*}% |
| 134 |
} |
| 135 |
\ProcessOptions\relax |
| 136 |
\endinput |
| 137 |
%% |
| 138 |
%% End of file `hypcap.sty'. |