[latex3-commits] [git/LaTeX3-latex3-hyperref] ltxcmds: Hy at ifpaclageloaded, allowed after begin document (0af7837)

David Carlisle d.p.carlisle at gmail.com
Mon Dec 16 15:56:32 CET 2019


Repository : https://github.com/latex3/hyperref
On branch  : ltxcmds
Link       : https://github.com/latex3/hyperref/commit/0af78375f6c9225ad065ce89b6d1f433c01a2a75

>---------------------------------------------------------------

commit 0af78375f6c9225ad065ce89b6d1f433c01a2a75
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Mon Dec 16 14:56:32 2019 +0000

    Hy at ifpaclageloaded, allowed after begin document


>---------------------------------------------------------------

0af78375f6c9225ad065ce89b6d1f433c01a2a75
 hyperref.dtx | 110 +++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 61 insertions(+), 49 deletions(-)

diff --git a/hyperref.dtx b/hyperref.dtx
index f7e1f72..3e6247e 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -628,6 +628,18 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+\def\Hy at ifpackageloaded#1{%
+  \@ifundefined{ver@#1.sty}\@secondoftwo\@firstoftwo
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\def\Hy at ifclassloaded#1{%
+  \@ifundefined{ver@#1.cls}\@secondoftwo\@firstoftwo
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \def\Hy at space{ }
 %    \end{macrocode}
 %
@@ -1077,7 +1089,7 @@
     \fi
   }%
   \def\HyCal at do#1#2\@nil{%
-    \@ifpackageloaded{calc}{}{%
+    \Hy at ifpackageloaded{calc}{}{%
       \Hy at Warning{%
         For calculations \string\hypercalcbp\space needs\MessageBreak
         package calc or e-TeX%
@@ -2085,7 +2097,7 @@
 % \subsubsection{Workaround for package linguex}
 %
 %    \begin{macrocode}
-\@ifpackageloaded{linguex}{%
+\Hy at ifpackageloaded{linguex}{%
   \let\HyLinguex at OrgB\b
   \let\HyLinguex at OrgC\c
   \let\HyLinguex at OrgD\d
@@ -2416,7 +2428,7 @@
   }%
 \fi
 \def\Hy at temp{%
-  \@ifpackageloaded{babel}{%
+  \Hy at ifpackageloaded{babel}{%
     \@ifpackagelater{babel}{2008/03/16}{%
       \let\Hy at temp\@empty
     }{%
@@ -4668,7 +4680,7 @@
 % \subsection{Class memoir}
 %
 %    \begin{macrocode}
-\@ifclassloaded{memoir}{%
+\Hy at ifclassloaded{memoir}{%
   \Hy at AtEndOfPackage{\RequirePackage{memhfixc}}%
 }{}
 %    \end{macrocode}
@@ -4676,7 +4688,7 @@
 % \subsection{Package subfigure}
 %    Added fix for version 2.1. Here \cmd{\sub at label} is defined.
 %    \begin{macrocode}
-\@ifpackageloaded{subfigure}{%
+\Hy at ifpackageloaded{subfigure}{%
   \@ifundefined{sub at label}{%
     \Hy at hypertexnamesfalse
   }{%
@@ -5272,7 +5284,7 @@
   \let\HyPsd at LoadStringEnc\relax
 }
 \Hy at AtBeginDocument{%
-  \@ifpackageloaded{stringenc}{%
+  \Hy at ifpackageloaded{stringenc}{%
     \let\HyPsd at LoadStringEnc\relax
   }{%
     \def\HyPsd at LoadStringEnc{%
@@ -6196,11 +6208,11 @@
 \def\toclevel at subparagraph{5}
 \def\toclevel at figure{0}
 \def\toclevel at table{0}
-\@ifpackageloaded{listings}{%
+\Hy at ifpackageloaded{listings}{%
   \providecommand*\theHlstlisting{\thelstlisting}%
   \providecommand*\toclevel at lstlisting{0}%
 }{}
-\@ifpackageloaded{listing}{%
+\Hy at ifpackageloaded{listing}{%
   \providecommand*\theHlisting{\thelisting}%
   \providecommand*\toclevel at listing{0}%
 }{}
@@ -7124,7 +7136,7 @@
 %    \begin{macrocode}
 \@ifpackagewith{hyperref}{tex4ht}{%
 }{%
-  \@ifpackageloaded{tex4ht}{%
+  \Hy at ifpackageloaded{tex4ht}{%
     \PassOptionsToPackage{tex4ht}{hyperref}%
   }{%
     \@ifundefined{HCode}{%
@@ -7379,7 +7391,7 @@
 %
 %    \begin{macrocode}
 \Hy at AtEndOfPackage{%
-  \@ifpackageloaded{tex4ht}{%
+  \Hy at ifpackageloaded{tex4ht}{%
     \def\Hy at driver{htex4ht}%
     \Hy at texhttrue
   }{}%
@@ -7741,7 +7753,7 @@
   \DeclareRobustCommand\pageref{%
     \@ifstar\@pagerefstar\T at pageref
   }%
-%  \@ifclassloaded{memoir}{%
+%  \Hy at ifclassloaded{memoir}{%
 %    \@ifundefined{@mem at titlerefnolink}\@secondoftwo{%
 %      \@ifundefined{@mem at titleref}\@secondoftwo\@firstoftwo
 %    }%
@@ -10000,7 +10012,7 @@
     \def\@starttoc#1{%
       \begingroup
         \makeatletter
-        \@ifpackageloaded{parskip}{\parskip\z@}{}%
+        \Hy at ifpackageloaded{parskip}{\parskip\z@}{}%
         \IfFileExists{\jobname.#1}{%
           \Hy at WarningNoLine{%
             old #1 file detected, not used; run LaTeX again%
@@ -10216,7 +10228,7 @@
 %
 %    \begin{macrocode}
   \let\HyPL at SlidesSetPage\@empty
-  \@ifclassloaded{slides}{%
+  \Hy at ifclassloaded{slides}{%
     \def\HyPL at SlidesSetPage{%
       \advance\c at page\@ne
       \ifnum\value{page}>\@ne
@@ -10826,7 +10838,7 @@
 % that the hyper stuff is not executed twice, so we use the AMS
 % |\ifmeasuring@|, initialized if AMS math is not used.
 %    \begin{macrocode}
-\@ifpackageloaded{amsmath}{}{\newif\ifmeasuring@\measuring at false}
+\Hy at ifpackageloaded{amsmath}{}{\newif\ifmeasuring@\measuring at false}
 %    \end{macrocode}
 %
 %    \begin{macro}{\hyper at refstepcounter}
@@ -11067,7 +11079,7 @@
 %    \end{macro}
 %
 %    \begin{macrocode}
-\@ifpackageloaded{fancyvrb}{%
+\Hy at ifpackageloaded{fancyvrb}{%
   \@ifpackagelater{fancyvrb}{1998/05/20}{}{%
     \def\FV at StepLineNo{%
       \FV at SetLineNo
@@ -11091,10 +11103,10 @@
 %    \begin{macro}{\lastpage at putlabel}
 %    \begin{macrocode}
 \Hy at AtBeginDocument{%
-  \@ifclassloaded{revtex4}{%
+  \Hy at ifclassloaded{revtex4}{%
     \@namedef{ver at lastpage.sty}{1994/06/25}%
   }{}%
-  \@ifpackageloaded{lastpage}{%
+  \Hy at ifpackageloaded{lastpage}{%
     \ifHy at pageanchor
     \else
       \Hy at WarningNoLine{%
@@ -11128,7 +11140,7 @@
       \fi
       \addtocounter{page}{1}%
     }%
-    \@ifclassloaded{revtex4}{%
+    \Hy at ifclassloaded{revtex4}{%
       \begingroup
         \toks@\expandafter{\lastpage at putlabel}%
         \edef\x{\endgroup
@@ -11177,7 +11189,7 @@
 %
 %    Package titlesec support:
 %    \begin{macrocode}
-\@ifpackageloaded{titlesec}{%
+\Hy at ifpackageloaded{titlesec}{%
   \def\ttl at Hy@steplink#1{%
     \Hy at MakeCurrentHrefAuto{#1*}%
     \edef\ttl at Hy@saveanchor{%
@@ -11214,7 +11226,7 @@
 %
 %    Package titletoc support:
 %    \begin{macrocode}
-\@ifpackageloaded{titletoc}{%
+\Hy at ifpackageloaded{titletoc}{%
   \def\ttl at gobblecontents#1#2#3#4{\ignorespaces}%
 }{}
 %    \end{macrocode}
@@ -11226,7 +11238,7 @@
 %    \begin{macrocode}
 \AtBeginDocument{%
 \def\Hy at varioref@undefined{{??}{??}{}{}{}}
-\@ifpackageloaded{varioref}{%
+\Hy at ifpackageloaded{varioref}{%
   \def\vref at pagenum#1#2{%
     \@ifundefined{r@#2}{%
       \expandafter\let\csname r@#2\endcsname\Hy at varioref@undefined
@@ -11263,7 +11275,7 @@
 %    replace \cmd{\refstepcounter} by the original
 %    \cmd{\H at refstepcounter} without anchor generation
 %    \begin{macrocode}
-\@ifpackageloaded{longtable}{%
+\Hy at ifpackageloaded{longtable}{%
   \begingroup
     \def\y{\LT at array}%
     \@ifundefined{scr at LT@array}{%
@@ -11315,7 +11327,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\@ifpackageloaded{amsmath}{%
+\Hy at ifpackageloaded{amsmath}{%
   \long\def\Hy at temp{%
     \incr at eqnum
     \mathdisplay at push
@@ -11478,11 +11490,11 @@
 % also \texttt{cleveref}.
 %    \begin{macrocode}
 \Hy at AtBeginDocument{%
-\@ifpackageloaded{cleveref}{%
+\Hy at ifpackageloaded{cleveref}{%
 \let\Hy at savedthm\@thm
 \def\@thm{\ifhmode\unskip\fi\Hy at savedthm}%
 }{%
-\@ifpackageloaded{amsthm}{%
+\Hy at ifpackageloaded{amsthm}{%
 %    \end{macrocode}
 % Class amsbook uses a different definition of \cs{@thm},
 % where two lines are added (thanks to Dan Luecking for
@@ -11728,7 +11740,7 @@
 % Since v6.82i footnotes are only disabled inside the environment
 % `tabularx'.
 %    \begin{macrocode}
-  \@ifpackageloaded{tabularx}{%
+  \Hy at ifpackageloaded{tabularx}{%
     \let\HyOrg at TX@endtabularx\TX at endtabularx
     \def\Hy at tabularx@hook{%
       \let\@footnotetext\H@@footnotetext
@@ -11753,7 +11765,7 @@
 %    by hyperref. The result is a link by \verb+\footnotemark+
 %    without valid anchor
 %    \begin{macrocode}
-  \@ifpackageloaded{longtable}{%
+  \Hy at ifpackageloaded{longtable}{%
     \CheckCommand*{\LT at p@ftntext}[1]{%
       \edef\@tempa{%
         \the\LT at p@ftn
@@ -11797,7 +11809,7 @@
 %
 %    Footnotes for fancyvrb (Fix by Manuel P\'egouri\'e-Gonnard).
 %    \begin{macrocode}
-  \@ifpackageloaded{fancyvrb}{%
+  \Hy at ifpackageloaded{fancyvrb}{%
     \def\V@@footnotetext{%
       \insert\footins\bgroup
       \csname reset at font\endcsname
@@ -12012,7 +12024,7 @@
     \fi
   }%
 }%
-\@ifpackageloaded{float}{%
+\Hy at ifpackageloaded{float}{%
   \def\Hy at float@caption{%
     \ifx\Hy at float@currentHref\@undefined
       \hyper at makecurrent{\@captype}%
@@ -12203,7 +12215,7 @@
 % and it goes ape. Therefore, make an anodyne result first, call
 % its business, then go back to the real thing.
 %    \begin{macrocode}
-\@ifclassloaded{revtex}{%
+\Hy at ifclassloaded{revtex}{%
   \Hy at Info{*** compatibility with revtex **** }%
   \def\revtex at checking#1#2{%
     \expandafter\let\expandafter\T at temp\csname b@#1\endcsname
@@ -12288,7 +12300,7 @@
 % of harvard.sty, and the |\newcommand| macros causes error
 % messages.
 %    \begin{macrocode}
-\@ifpackageloaded{harvard}{%
+\Hy at ifpackageloaded{harvard}{%
   \Hy at AtBeginDocument{%
     \Hy at Info{*** compatibility with harvard **** }%
     \Hy at raiselinksfalse
@@ -12379,7 +12391,7 @@
 %    include the closing parentheses.
 %
 %    \begin{macrocode}
-\@ifpackageloaded{chicago}{%
+\Hy at ifpackageloaded{chicago}{%
 %    \end{macrocode}
 %    \begin{macro}{\citeN}
 %    \begin{macrocode}
@@ -12439,7 +12451,7 @@
 %
 % This where we supply a destination for each page.
 %    \begin{macrocode}
-\@ifclassloaded{slides}{%
+\Hy at ifclassloaded{slides}{%
   \def\Hy at SlidesFormatOptionalPage#1{(#1)}%
   \def\Hy at PageAnchorSlidesPlain{%
     \advance\c at page\@ne
@@ -12696,7 +12708,7 @@
 %
 % Version 6.77p uses a patch by Ross Moore.
 %    \begin{macrocode}
-\@ifpackageloaded{amsmath}{%
+\Hy at ifpackageloaded{amsmath}{%
   \def\Hy at make@anchor{%
     \Hy at MakeCurrentHrefAuto{AMS}%
     \Hy at raisedlink{\hyper at anchorstart{\@currentHref}\hyper at anchorend}%
@@ -12785,7 +12797,7 @@
 }%
 %</check>
 %<*package>
-\@ifpackageloaded{amsmath}{%
+\Hy at ifpackageloaded{amsmath}{%
   \@ifpackagelater{amsmath}{1999/12/14}{%
     \renewcommand*{\numberwithin}[3][\arabic]{%
       \@ifundefined{c@#2}{\@nocounterr{#2}}{%
@@ -12849,9 +12861,9 @@
     \let\hyperpage\HyOrg at hyperpage
   }%
   \Hy at nextfalse
-  \@ifpackageloaded{multind}{\Hy at nexttrue}{}%
-  \@ifpackageloaded{index}{\Hy at nexttrue}{}%
-  \@ifpackageloaded{amsmidx}{\Hy at nexttrue}{}%
+  \Hy at ifpackageloaded{multind}{\Hy at nexttrue}{}%
+  \Hy at ifpackageloaded{index}{\Hy at nexttrue}{}%
+  \Hy at ifpackageloaded{amsmidx}{\Hy at nexttrue}{}%
   \begingroup
     \lccode`\|=\expandafter`\HyInd at EncapChar\relax
     \lccode`\/=`\\\relax
@@ -13040,7 +13052,7 @@
 % \section{Compatibility with foiltex}
 %
 %    \begin{macrocode}
-\@ifclassloaded{foils}{%
+\Hy at ifclassloaded{foils}{%
   \providecommand*\ext at table{lot}%
   \providecommand*\ext at figure{lof}%
 }{}
@@ -13050,13 +13062,13 @@
 %    This requires \texttt{seminar.bg2}, version 1.6 or later.
 %    Contributions by Denis Girou (\Email{denis.girou at idris.fr}).
 %    \begin{macrocode}
-\@ifclassloaded{seminar}{%
+\Hy at ifclassloaded{seminar}{%
   \Hy at seminarslidestrue
   \providecommand\theHslide{\arabic{slide}}%
 }{%
   \Hy at seminarslidesfalse
 }
-\@ifpackageloaded{slidesec}{%
+\Hy at ifpackageloaded{slidesec}{%
   \providecommand\theHslidesection   {\arabic{slidesection}}%
   \providecommand\theHslidesubsection{%
     \theHslidesection.\arabic{slidesubsection}%
@@ -13342,7 +13354,7 @@
 }
 
 \Hy at AtBeginDocument{%
-  \@ifpackageloaded{varioref}{%
+  \Hy at ifpackageloaded{varioref}{%
     \def\@Refstar#1{%
       \HyRef at StarSetRef{#1}\HyRef at MakeUppercaseFirstOfFive
     }%
@@ -13539,11 +13551,11 @@
     \fi
   \fi
 }
-\@ifpackageloaded{showkeys}{%
+\Hy at ifpackageloaded{showkeys}{%
   \HyRef at ShowKeysInit
 }{%
   \Hy at AtBeginDocument{%
-    \@ifpackageloaded{showkeys}{%
+    \Hy at ifpackageloaded{showkeys}{%
       \HyRef at ShowKeysInit
     }{}%
   }%
@@ -14401,7 +14413,7 @@
     \expandafter\@gobble
   \fi
   {%
-    \@ifclassloaded{seminar}{%
+    \Hy at ifclassloaded{seminar}{%
 %<*pdftex>
       \setlength{\pdfhorigin}{1truein}%
       \setlength{\pdfvorigin}{1truein}%
@@ -17954,7 +17966,7 @@
 %<*tex4ht>
 \providecommand*{\XR at ext}{html}
 \let\Hy at raisedlink\@empty
-\@ifpackageloaded{tex4ht}{%
+\Hy at ifpackageloaded{tex4ht}{%
   \Hy at InfoNoLine{tex4ht is already loaded}%
 }{%
   \RequirePackage[htex4ht]{tex4ht}%
@@ -18936,7 +18948,7 @@
 \let\Fld at pageobjref\@empty
 \@ifundefined{pdfpageref}{%
 }{%
-  \@ifpackageloaded{zref-abspage}{%
+  \Hy at ifpackageloaded{zref-abspage}{%
     \newcount\HyAnn at Count
     \HyAnn at Count=\z@
     \def\HyAnn at AbsPageLabel{%
@@ -20852,12 +20864,12 @@
     \addcontentsline{toc}{chapter}{##1}%
   }%
 }
-\@ifclassloaded{scrbook}{%
+\Hy at ifclassloaded{scrbook}{%
   \@ifclasslater{scrbook}{2001/01/01}{%
     \let\Hy at tempa\@empty
   }{}%
 }{%
-  \@ifclassloaded{scrreprt}{%
+  \Hy at ifclassloaded{scrreprt}{%
     \@ifclasslater{scrreprt}{2001/01/01}{%
       \let\Hy at tempa\@empty
     }{}%





More information about the latex3-commits mailing list