[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: comments begin doc hooks (4ab7a49)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Feb 3 19:06:00 CET 2021


Repository : https://github.com/latex3/pdfresources
On branch  : reworking-annot
Link       : https://github.com/latex3/pdfresources/commit/4ab7a49e4d43bb4372e79efaeaa711d579eb02f7

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

commit 4ab7a49e4d43bb4372e79efaeaa711d579eb02f7
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Feb 3 19:06:00 2021 +0100

    comments begin doc hooks


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

4ab7a49e4d43bb4372e79efaeaa711d579eb02f7
 info/key-list.tex | 371 ++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 232 insertions(+), 139 deletions(-)

diff --git a/info/key-list.tex b/info/key-list.tex
index dfd7221..f2fbebb 100644
--- a/info/key-list.tex
+++ b/info/key-list.tex
@@ -183,95 +183,15 @@ pdfauthor    -> patched?
 pdfkeywords
 
 
-% begin document hook
-Can go is true
-\Hy at AtBeginDocument{%
-  \ifx\HyPsd at LoadUnicode\relax
-  \else
-    \def\HyPsd at LoadUnicode{%
-      \Hy at Error{%
-        Unicode support for bookmarks is not available.\MessageBreak
-        Activate unicode support by using one of the options\MessageBreak
-        `unicode', `pdfencoding=unicode', `pdfencoding=auto'\MessageBreak
-        in the preamble%
-      }\@ehc
-      \global\let\HyPsd at LoadUnicode\relax
-      \global\Hy at unicodefalse
-      \global\let\Hy at unicodetrue\Hy at unicodefalse
-    }%
-  \fi
-}
 
-Can imho go
-\Hy at AtBeginDocument{%
-  \@ifpackageloaded{stringenc}{%
-    \let\HyPsd at LoadStringEnc\relax
-  }{%
-    \def\HyPsd at LoadStringEnc{%
-      \Hy at WarningNoLine{%
-        Missing package `stringenc'. Use `pdfencoding=auto'\MessageBreak
-        in the preamble or load the package there%
-      }%
-    }%
-  }%
-}
 
-Can go
-\Hy at AtBeginDocument{%
-  \begingroup
-    \@ifundefined{OBJ at OCG@view}{%
-      \ifHy at ocgcolorlinks
-        \Hy at Warning{%
-          Driver does not support `ocgcolorlinks',\MessageBreak
-          using `colorlinks' instead%
-        }%
-      \fi
-    }{}%
-  \endgroup
-}
-can go, only used in two other drivers 
-\Hy at AtBeginDocument{%
-  \begingroup
-    \edef\x{\@ifundefined{stockheight}\paperheight\stockheight}%
-    \dimen@=\x\relax
-    \ifdim\dimen@>\z@
-    \else
-      \dimen@=11in\relax
-      \Hy at WarningNoLine{%
-        Height of page (\expandafter\string\x) %
-        is invalid (\the\x),\MessageBreak
-        using 11in%
-      }%
-    \fi
-    \dimen@=0.99626401\dimen@
-    \xdef\Hy at pageheight{\strip at pt\dimen@}%
-  \endgroup
-}
+% begin document hook
 
-% can be donne with package hook:
-\ltx at IfUndefined{xspaceaddexceptions}{%
-  \Hy at AtBeginDocument{%
-    \ltx at IfUndefined{xspaceaddexceptions}{%
-    }{%
-      \def\Hy at xspace@end{%
-        \ltx at gobble{end for xspace}%
-      }%
-      \xspaceaddexceptions{%
-        \Hy at xspace@end,\hyper at linkend,\hyper at anchorend
-      }%
-    }%
-  }%
-}{%
-  \def\Hy at xspace@end{%
-    \ltx at gobble{end for xspace}%
-  }%
-  \xspaceaddexceptions{\Hy at xspace@end,\hyper at linkend,\hyper at anchorend}%
-}
+\@ifpackageloaded{xparse}{%
+  \def\Hy at xspace@end{\ltx at gobble{end for xspace}}%
+  \xspaceaddexceptions{\Hy at xspace@end,\hyper at linkend,\hyper at anchorend}}
   
-%needed
-% draft option
-\Hy at AtBeginDocument{%
-  \ifHy at draft
+\ifHy at draft
     \let\hyper@@anchor\@gobble
     \gdef\hyper at link#1#2#3{#3\Hy at xspace@end}%
     \def\hyper at anchorstart#1#2{#2\Hy at xspace@end}%
@@ -282,18 +202,12 @@ can go, only used in two other drivers
     \def\hyper at linkfile#1#2#3{#1\Hy at xspace@end}%
     \def\hyper at link@[#1]#2#3#4{#4\Hy at xspace@end}%
     \def\Acrobatmenu#1#2{\leavevmode#2\Hy at xspace@end}%
-    \let\PDF at SetupDoc\@empty
-    \let\PDF at FinishDoc\@empty
-    \let\@fifthoffive\@secondoftwo
-    \let\@secondoffive\@secondoftwo
-    \let\ReadBookmarks\relax
-    \let\WriteBookmarks\relax
+ %   \let\PDF at SetupDoc\@empty
+ %   \let\PDF at FinishDoc\@empty
+    \let\@fifthoffive\@secondoftwo %??
+    \let\@secondoffive\@secondoftwo%??
     \Hy at WarningNoLine{Draft mode on}%
-  \fi
-  \Hy at DisableOption{draft}%
-  \Hy at DisableOption{nolinks}%
-  \Hy at DisableOption{final}%
-}
+\fi
 
 %probably unneeded
   \def\MaybeStopEarly{%
@@ -305,54 +219,47 @@ can go, only used in two other drivers
     \endinput
   }%
 
-  This is probably needed:
-  (perhaps color is needed too ...)
-      \Hy at CatcodeWrapper{%
-        \RequirePackage{nameref}[2012/07/28]%
-      }%
-    \fi
-  \fi
-  \DeclareRobustCommand\ref{%
+%should be loaded earlier, not in begindocument
+% check color ...
+
+\RequirePackage{nameref}[2012/07/28]
+
+\DeclareRobustCommand\ref{%
     \@ifstar\@refstar\T at ref
   }%
-  \DeclareRobustCommand\pageref{%
+\DeclareRobustCommand\pageref{%
     \@ifstar\@pagerefstar\T at pageref
   }%
-    \DeclareRobustCommand*{\nameref}{%
+\DeclareRobustCommand*{\nameref}{%
       \@ifstar\@namerefstar\T at nameref
     }%
- \ifHy at implicit
- \else
+\ifHy at implicit
+\else
    \let \@pagerefstar\T at pageref
    \let \@refstar\T at ref
    \let \@namerefstar\T at nameref
- \fi
-}
+\fi
 
-  \Hy at CatcodeWrapper\ReadBookmarks ???
-
-\PDF at SetupDoc
+implicit false:
+  \Hy at AtBeginDocument{%
+    \let\autoref\ref
+    \let\autopageref\pageref
+    \ifx\@pdfpagemode\@empty
+      \gdef\@pdfpagemode{UseNone}%
+    \fi
+    \global\Hy at backreffalse
+  }%
+\PDF at SetupDoc %???
 
 \hyper at anchorstart{Doc-Start}\hyper at anchorend
 
 
-\Hy at AtBeginDocument{%
   \if at filesw
-    \ifHy at typexml
-      \immediate\closeout\@mainaux
-      \immediate\openout\@mainaux\jobname.aux\relax
-      \immediate\write\@auxout{<relaxxml>\relax}%
-    \fi
     \immediate\write\@auxout{%
       \string\providecommand\string\HyperFirstAtBeginDocument{%
         \string\AtBeginDocument}^^J%
       \string\HyperFirstAtBeginDocument{%
         \string\ifx\string\hyper at anchor\string\@undefined^^J%
-          \string\global\string\let\string\oldcontentsline\string\contentsline^^J%
-          \string\gdef\string\contentsline%
-            \string#1\string#2\string#3\string#4{%
-            \string\oldcontentsline%
-              {\string#1}{\string#2}{\string#3}}^^J%
           \string\global\string\let\string\oldnewlabel\string\newlabel^^J%
           \string\gdef\string\newlabel\string#1\string#2{%
              \string\newlabelxx{\string#1}\string#2}^^J%
@@ -361,7 +268,6 @@ can go, only used in two other drivers
              \string\oldnewlabel{\string#1}{{\string#2}{\string#3}}}^^J%
           \string\AtEndDocument{%
             \string\ifx\string\hyper at anchor\string\@undefined^^J%
-              \string\let\string\contentsline\string\oldcontentsline^^J%
               \string\let\string\newlabel\string\oldnewlabel^^J%
             \string\fi%
           }^^J%
@@ -373,24 +279,211 @@ can go, only used in two other drivers
   \fi
   \let\HyperFirstAtBeginDocument\ltx at firstofone
   \ifx\hyper at last\@undefined
-    \def\@starttoc#1{%
+    \def\newlabel#1#2{\@newl at bel r{#1}{#2{}{}{}{}}}%
+  \fi
+}
+
+ \@ifpackageloaded{lastpage}{%
+    \ifHy at pageanchor
+    \else
+      \Hy at WarningNoLine{%
+        The \string\pageref{LastPage} link doesn't work\MessageBreak
+        with disabled option `pageanchor'%
+      }%
+    \fi
+    \def\lastpage at putlabel{%
+      \addtocounter{page}{-1}%
+      \if at filesw
+        \begingroup
+          \let\@number\@firstofone
+          \ifHy at pageanchor
+            \ifHy at hypertexnames
+              \ifHy at plainpages
+                \def\Hy at temp{\arabic{page}}%
+              \else
+                \Hy at unicodefalse
+                \pdfstringdef\Hy at temp{\thepage}%
+              \fi
+            \else
+              \def\Hy at temp{\the\Hy at pagecounter}%
+            \fi
+          \fi
+          \immediate\write\@auxout{%
+            \string\newlabel
+              {LastPage}{{}{\thepage}{}{%
+                \ifHy at pageanchor page.\Hy at temp\fi}{}}%
+          }%
+        \endgroup
+      \fi
+      \addtocounter{page}{1}%
+    }%
+    \@ifclassloaded{revtex4}{%
       \begingroup
-        \makeatletter
-        \ltx at ifpackageloaded{parskip}{\parskip\z@}{}%
-        \IfFileExists{\jobname.#1}{%
-          \Hy at WarningNoLine{%
-            old #1 file detected, not used; run LaTeX again%
+        \toks@\expandafter{\lastpage at putlabel}%
+        \edef\x{\endgroup
+          \def\noexpand\lastpage at putlabel{%
+            \noexpand\stepcounter{page}%
+            \the\toks@
+            \noexpand\addtocounter{page}\noexpand\m at ne
           }%
-        }{}%
-        \if at filesw
-          \expandafter\newwrite\csname tf@#1\endcsname
-          \immediate\openout\csname tf@#1\endcsname \jobname.#1\relax
-        \fi
-        \@nobreakfalse
-      \endgroup
+        }%
+      \x
+    }{}%
+  }{}%
+  
+  
+\Hy at AtBeginDocument{%
+\@ifpackageloaded{cleveref}{%
+\let\Hy at savedthm\@thm
+\def\@thm{\ifhmode\unskip\fi\Hy at savedthm}%
+}{%
+\@ifpackageloaded{amsthm}{%
+  \def\Hy at temp#1#2#3{%
+    \ifhmode\unskip\unskip\par\fi
+    \normalfont
+    \trivlist
+    \let\thmheadnl\relax
+    \let\thm at swap\@gobble
+    \let\thm at indent\indent % indent
+    \thm at headfont{\scshape}% heading font small caps
+    \thm at notefont{\fontseries\mddefault\upshape}%
+    \thm at headpunct{.}% add period after heading
+    \thm at headsep 5\p@ plus\p@ minus\p@\relax
+    \thm at space@setup
+    #1% style overrides
+    \@topsep \thm at preskip               % used by thm head
+    \@topsepadd \thm at postskip           % used by \@endparenv
+    \def\@tempa{#2}\ifx\@empty\@tempa
+      \def\@tempa{\@oparg{\@begintheorem{#3}{}}[]}%
+    \else
+      \refstepcounter{#2}%
+      \def\@tempa{%
+        \@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]%
+      }%
+    \fi
+    \@tempa
+  }%
+  \ifx\Hy at temp\@thm
+    \def\@thm#1#2#3{%
+      \ifhmode
+        \unskip\unskip\par
+      \fi
+      \normalfont
+      \trivlist
+      \let\thmheadnl\relax
+      \let\thm at swap\@gobble
+      \let\thm at indent\indent % indent
+      \thm at headfont{\scshape}% heading font small caps
+      \thm at notefont{\fontseries\mddefault\upshape}%
+      \thm at headpunct{.}% add period after heading
+      \thm at headsep 5\p@ plus\p@ minus\p@\relax
+      \thm at space@setup
+      #1% style overrides
+      \@topsep \thm at preskip               % used by thm head
+      \@topsepadd \thm at postskip           % used by \@endparenv
+      \def\dth at counter{#2}%
+      \ifx\@empty\dth at counter
+        \def\@tempa{%
+          \@oparg{\@begintheorem{#3}{}}[]%
+        }%
+      \else
+        \H at refstepcounter{#2}%
+        \hyper at makecurrent{#2}%
+        \let\Hy at dth@currentHref\@currentHref
+        \def\@tempa{%
+          \@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]%
+        }%
+      \fi
+      \@tempa
+    }%
+  \else
+    \def\@thm#1#2#3{%
+      \ifhmode
+        \unskip\unskip\par
+      \fi
+      \normalfont
+      \trivlist
+      \let\thmheadnl\relax
+      \let\thm at swap\@gobble
+      \thm at notefont{\fontseries\mddefault\upshape}%
+      \thm at headpunct{.}% add period after heading
+      \thm at headsep 5\p@ plus\p@ minus\p@\relax
+      \thm at space@setup
+      #1% style overrides
+      \@topsep \thm at preskip               % used by thm head
+      \@topsepadd \thm at postskip           % used by \@endparenv
+      \def\dth at counter{#2}%
+      \ifx\@empty\dth at counter
+        \def\@tempa{%
+          \@oparg{\@begintheorem{#3}{}}[]%
+        }%
+      \else
+        \H at refstepcounter{#2}%
+        \hyper at makecurrent{#2}%
+        \let\Hy at dth@currentHref\@currentHref
+        \def\@tempa{%
+          \@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]%
+        }%
+      \fi
+      \@tempa
     }%
-    \def\newlabel#1#2{\@newl at bel r{#1}{#2{}{}{}{}}}%
   \fi
+  \dth at everypar={%
+    \@minipagefalse
+    \global\@newlistfalse
+    \@noparitemfalse
+    \if at inlabel
+      \global\@inlabelfalse
+      \begingroup
+        \setbox\z@\lastbox
+        \ifvoid\z@
+          \kern-\itemindent
+        \fi
+      \endgroup
+      \ifx\@empty\dth at counter
+      \else
+        \Hy at raisedlink{%
+          \hyper at anchorstart{%
+            \ltx at ifundefined{Hy at dth@currentHref}%
+            \@currentHref\Hy at dth@currentHref
+          }\hyper at anchorend
+        }%
+      \fi
+      \unhbox\@labels
+    \fi
+    \if at nobreak
+      \@nobreakfalse \clubpenalty\@M
+    \else
+      \clubpenalty\@clubpenalty \everypar{}%
+    \fi
+  }%
+}%
+{%
+\let\Hy at savedthm\@thm
+\def\@thm{\ifhmode\unskip\fi\Hy at savedthm}%
+}%
+}%
 }
+
+\RequirePackage{nameref}[2012/07/28]
+%\def\Hy at AtBeginDocumentHook
+% {
+%  \DeclareRobustCommand\ref{%
+%    \@ifstar\@refstar\T at ref
+%  }%
+%  \DeclareRobustCommand\pageref{%
+%    \@ifstar\@pagerefstar\T at pageref
+%  }%
+% \DeclareRobustCommand*{\nameref}{%
+%      \@ifstar\@namerefstar\T at nameref
+%  }%
+%\ifHy at implicit
+%\else
+%   \let \@pagerefstar\T at pageref
+%   \let \@refstar\T at ref
+%   \let \@namerefstar\T at nameref
+%\fi
+% }  
+
 Hy at AtEndOfPackage
 - driver test (unneeded?)  
\ No newline at end of file





More information about the latex3-commits mailing list.