|
| 1 | +% nameref.4ht (2024-06-15-13:36), generated from tex4ht-4ht.tex |
| 2 | +% Copyright 2005-2009 Eitan M. Gurari |
| 3 | +% Copyright 2009-2024 TeX Users Group |
| 4 | +% |
| 5 | +% This work may be distributed and/or modified under the |
| 6 | +% conditions of the LaTeX Project Public License, either |
| 7 | +% version 1.3c of this license or (at your option) any |
| 8 | +% later version. The latest version of this license is in |
| 9 | +% http://www.latex-project.org/lppl.txt |
| 10 | +% and version 1.3c or later is part of all distributions |
| 11 | +% of LaTeX version 2005/12/01 or later. |
| 12 | +% |
| 13 | +% This work has the LPPL maintenance status "maintained". |
| 14 | +% |
| 15 | +% The Current Maintainer of this work |
| 16 | +% is the TeX4ht Project <http://tug.org/tex4ht>. |
| 17 | +% |
| 18 | +% If you modify this program, changing the |
| 19 | +% version identification would be appreciated. |
| 20 | +\immediate\write-1{version 2024-06-15-13:36} |
| 21 | + |
| 22 | + \let\NR:Type\relax |
| 23 | +\let\ltx@label\label |
| 24 | +\def\prf:label{{\ifx \NR:Title\:UnDef \a:newlabel{\@currentlabelname}\else \NR:Title\fi}% |
| 25 | + {\ifx \NR:Type\relax \else \NR:Type .1\fi}{}}% |
| 26 | + |
| 27 | +\append:defI\label{\let\NR:Title\undefined} |
| 28 | + |
| 29 | +\let\NR:StartSec\:StartSec |
| 30 | +\let\NR:no@sect\no@sect |
| 31 | +\def\no@sect#1#2#3#4#5#6[#7]#8{\gdef\NR:Title{\a:newlabel{#7}}% |
| 32 | + \gdef\NR:Type{#1}% |
| 33 | + \NR:no@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}} |
| 34 | +\def\:StartSec#1#2#3{% |
| 35 | + \gdef\NR:Title{\a:newlabel{#3}}% |
| 36 | + \gdef\NR:Type{#1}% |
| 37 | + \NR:StartSec{#1}{#2}{#3}% |
| 38 | +} |
| 39 | + |
| 40 | +\def\:tempc#1#2#3#4#5#6[#7]#8{% |
| 41 | + \gdef\NR:Title{\a:newlabel{#7}}% |
| 42 | + \gdef\NR:Type{#1}% |
| 43 | + \o:NR@sect:{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}} |
| 44 | +\HLet\NR@sect\:tempc |
| 45 | + |
| 46 | +\def\:tempc#1#2#3#4#5{% |
| 47 | + \gdef\NR:Title{\a:newlabel\ssect:ttl}% |
| 48 | + \gdef\NR:Type{#1}% |
| 49 | + \o:NR@ssect:{#1}{#2}{#3}{#4}{#5}% |
| 50 | +} |
| 51 | +\HLet\NR@ssect\:tempc |
| 52 | + |
| 53 | +\def\:tempc[#1]#2{% |
| 54 | + \gdef\NR:Title{\a:newlabel{#1}}% |
| 55 | + \gdef\NR:Type{part}% |
| 56 | + \o:no@part:[{#1}]{#2}} |
| 57 | + |
| 58 | +% this definition clashes with asmart and amsproc classes, so we |
| 59 | +% need to skip if these are active |
| 60 | +\@ifundefined{opt@amsart.cls}{% |
| 61 | +\@ifundefined{opt@amsproc.cls}{% |
| 62 | +\HLet\no@part\:tempc |
| 63 | +}{}}{} |
| 64 | + |
| 65 | + |
| 66 | +\def\:tempc#1{% |
| 67 | + \gdef\NR:Title{\a:newlabel{#1}}% |
| 68 | + \gdef\NR:Type{part}% |
| 69 | + \o:no@spart:{#1}} |
| 70 | +\HLet\no@spart\:tempc |
| 71 | + |
| 72 | +\def\:tempc[#1]#2{% |
| 73 | + \gdef\NR:Title{\a:newlabel{#1}}% |
| 74 | + \gdef\NR:Type{chapter}% |
| 75 | + \o:NR@chapter:[{#1}]{#2}} |
| 76 | +\HLet\NR@chapter\:tempc |
| 77 | + |
| 78 | +\def\:tempc#1{% |
| 79 | + \gdef\NR:Title{\a:newlabel\sch:ttl}% |
| 80 | + \o:NR@schapter:{#1}% |
| 81 | + \gdef\NR:Type{chapter}% |
| 82 | +} |
| 83 | +\HLet\NR@schapter\:tempc |
| 84 | + |
| 85 | +\let\o:NR@@caption\@caption |
| 86 | + |
| 87 | +\ifdefined\scr@makechapterhead |
| 88 | +% fixes for Komascript |
| 89 | +\def\:tempa[#1]#2{% |
| 90 | + \gdef\NR:Title{\a:newlabel{#1}}% |
| 91 | + \gdef\NR:Type{chapter}% |
| 92 | + \o:@chapter:[#1]{#2}% |
| 93 | +} |
| 94 | +\HLet\@chapter\:tempa |
| 95 | + |
| 96 | +\def\:tempa#1{% |
| 97 | + \gdef\NR:Title{\a:newlabel{#1}}% |
| 98 | + \gdef\NR:Type{chapter}% |
| 99 | + \o:@schapter:{#1}% |
| 100 | +} |
| 101 | +\HLet\@schapter\:tempa |
| 102 | + |
| 103 | +\fi |
| 104 | +% |
| 105 | +% |
| 106 | +% Keith Andrews <kandrews@iicm.edu> reported that \@captype as |
| 107 | +% \NR:Type threw an undefined control sequence error. I think |
| 108 | +% \@currenvir is safe, there is nothing special about \@captype. |
| 109 | +% |
| 110 | +% use of \index and \label inside caption results in a fatal error |
| 111 | +% we need to disable them in \NR:Title |
| 112 | + |
| 113 | +% there can be more problematic commands, so we provide a configuration |
| 114 | +% that can be used multiple times - the default value fixes known commands |
| 115 | +% but a user can add more of them |
| 116 | + |
| 117 | +\def\a:captioncommandsfix{} |
| 118 | +\NewConfigure{CaptionCommandsFix}[1]{\concat:config\a:captioncommandsfix{#1}} |
| 119 | +\Configure{CaptionCommandsFix}{ |
| 120 | + \let\index\:gobble% |
| 121 | + \let\label\:gobble% |
| 122 | + \let\\\relax% causes issues when \centering is active |
| 123 | +} |
| 124 | + |
| 125 | +\long\def\@caption#1[#2]{% |
| 126 | + \gdef\NR:Type{\@currenvir}% |
| 127 | + \begingroup% |
| 128 | + \a:captioncommandsfix |
| 129 | + \protected@xdef\NR:Title{\a:newlabel{#2}}% |
| 130 | + \endgroup% |
| 131 | + \o:NR@@caption{#1}[{#2}]% |
| 132 | +} |
| 133 | + |
| 134 | +\let\o:NRorg@opargbegintheorem\@opargbegintheorem |
| 135 | + \def\@opargbegintheorem#1#2#3{% |
| 136 | + \gdef\NR:Title{\a:newlabel{#3}}% |
| 137 | + \gdef\NR:Type{\@currenvir}% |
| 138 | + \NR@gettitle{#3}% |
| 139 | + \defineautorefname{\@currenvir}{#1}% |
| 140 | + \o:NRorg@opargbegintheorem{#1}{#2}{#3}% |
| 141 | + }% |
| 142 | + |
| 143 | +\let\o:NRorg@begintheorem\@begintheorem |
| 144 | + \def\@begintheorem#1#2{% |
| 145 | + \gdef\NR:Title{\a:newlabel{#1 #2}}% |
| 146 | + \gdef\NR:Type{\@currenvir}% |
| 147 | + \defineautorefname{\@currenvir}{#1}% |
| 148 | + \NR@gettitle{}% |
| 149 | + \o:NRorg@begintheorem{#1}{#2}% |
| 150 | + }% |
| 151 | + |
| 152 | +% I don't know if this was useful for anything |
| 153 | +% but we cannot use it anymore |
| 154 | +% \AtBeginDocument{% |
| 155 | +\@ifpackageloaded{listings}{% |
| 156 | + \def\:tempc#1{% |
| 157 | + \gdef\NR:Title{\a:newlabel{listing}}% |
| 158 | + \gdef\NR:Type{lstlisting}% |
| 159 | + \o:NROrg@lst@MakeCaption:{#1}% |
| 160 | + \gdef\@currentlabelname{listing}} |
| 161 | + \HLet\NROrg@lst@MakeCaption\:tempc |
| 162 | +}{}% |
| 163 | + % bug [348] |
| 164 | +\def\:tempams{% |
| 165 | + \gdef\NR:Title{\a:newlabel{equation}}% |
| 166 | + \gdef\NR:Type{equation}% |
| 167 | + \gdef\@currentlabelname{equation}% |
| 168 | +} |
| 169 | + |
| 170 | +% https://tex.stackexchange.com/a/581856/2891 |
| 171 | +\@ifpackageloaded{caption}{ |
| 172 | + \pend:defIII\caption@beginex{% |
| 173 | + \gdef\NR:Type{\@currenvir}% |
| 174 | + % handle \label and \index in Caption's package |
| 175 | + % version of \caption |
| 176 | + \begingroup% |
| 177 | + \a:captioncommandsfix |
| 178 | + \protected@xdef\NR:Title{\a:newlabel{##2}}% |
| 179 | + \endgroup% |
| 180 | + } |
| 181 | +}{} |
| 182 | + |
| 183 | + |
| 184 | +\@ifpackageloaded{amsmath}{% |
| 185 | + \Configure{@begin}{align}{\:tempams} |
| 186 | + \Configure{@begin}{multline}{\:tempams} |
| 187 | + \Configure{@begin}{equation}{\:tempams} |
| 188 | + \Configure{@begin}{boxed}{\:tempams} |
| 189 | + \Configure{@begin}{equations}{\:tempams} |
| 190 | + \Configure{@begin}{equation}{\:tempams} |
| 191 | + \Configure{@begin}{gather*}{\:tempams} |
| 192 | + \Configure{@begin}{gather}{\:tempams} |
| 193 | + \Configure{@begin}{genfrac}{\:tempams} |
| 194 | + \Configure{@begin}{measure@}{\:tempams} |
| 195 | + \Configure{@begin}{multline*}{\:tempams} |
| 196 | + \Configure{@begin}{multline}{\:tempams} |
| 197 | + \Configure{@begin}{overset}{\:tempams} |
| 198 | + \Configure{@begin}{smallmatrix}{\:tempams} |
| 199 | + \Configure{@begin}{split}{\:tempams} |
| 200 | + \Configure{@begin}{subarray}{\:tempams} |
| 201 | + \Configure{@begin}{substack}{\:tempams} |
| 202 | + \Configure{@begin}{underset}{\:tempams} |
| 203 | + \Configure{@begin}{xleftarrow}{\:tempams} |
| 204 | + \Configure{@begin}{xrightarrow}{\:tempams} |
| 205 | + }{ |
| 206 | + \Configure{@begin}{equation}{\:tempams} |
| 207 | +} |
| 208 | + |
| 209 | +\let\T:ref=\::ref |
| 210 | +\def\::ref{\@ifstar{\protect\T@ref}{\protect\T@ref}} |
| 211 | +\def\T@ref#1{% |
| 212 | + \@safe@activestrue% |
| 213 | + \let\::ref\T:ref% |
| 214 | + \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}% |
| 215 | + \def\::ref{\@ifstar{\protect\T@ref}{\protect\T@ref}}% |
| 216 | + \@safe@activesfalse% |
| 217 | +} |
| 218 | + |
| 219 | +\gdef\defineautorefname#1#2{% |
| 220 | + \expandafter\gdef\csname #1autorefname\endcsname{#2}} |
| 221 | +\defineautorefname{theorem}{Theorem} |
| 222 | + |
| 223 | +\Configure{newlabel} |
| 224 | + {\csname cur:th\endcsname \csname :currentlabel\endcsname} |
| 225 | + {\string\csname\space :autoref\string\endcsname |
| 226 | + {\NR:Type}#1} |
| 227 | + |
| 228 | +\ifx \@currentlabelname\:UnDef |
| 229 | + \let\@currentlabelname\empty |
| 230 | +\fi |
| 231 | + |
| 232 | +\pend:defIII\@setref{\edef\RefArg{##3}} |
| 233 | +\append:defIII\@setref{\let\:autoref\:gobble} |
| 234 | +\let\:autoref\:gobble |
| 235 | + |
| 236 | + |
| 237 | +\Hinput{nameref} |
| 238 | +\endinput |
0 commit comments