[tex4ht-commits] [SCM] tex4ht updated: r90 - trunk/lit

cvr at gnu.org.ua cvr at gnu.org.ua
Thu Sep 20 09:21:15 CEST 2012


Author: cvr
Date: 2012-09-20 10:21:15 +0300 (Thu, 20 Sep 2012)
New Revision: 90

Modified:
   trunk/lit/tex4ht-4ht.tex
Log:
 Current version of nameref.4ht configuration has been renamed
 as <nameref v.1 configurations> and kept in the sources as unused
 code.

 Version 2 configurations for nameref.4ht was added consequent to
 bugs reported by Martin Heller <mr_heller at yahoo.dk> and  Denis
 Bitouz? <dbitouze at wanadoo.fr>. A thorough revamping was needed to
 fix the problems. Apparently, in my tests, all reported problems
 seem to have been fixed, though, \label{...} when used inside the
 caption appears when \nameref'ed. Also, \@begintheorem with amsthm
 loaded needs to be tried and tested thoroughly. Otherwise, the fixes
 are OK as vouched by Martin and Denis.

 A new function \defineautorefname has been defined and included in
 the newtheorem definitions so that funny enunciation environment
 names will resolve to the correct printed enunciation name when
 \nameref'd. Users need not separately define the same.



Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2012-07-27 18:08:12 UTC (rev 89)
+++ trunk/lit/tex4ht-4ht.tex	2012-09-20 07:21:15 UTC (rev 90)
@@ -2793,8 +2793,7 @@
 % nameref.4ht                           |version %
 % Copyright (C) |CopyYear.2005.       Eitan M. Gurari         %
 |<TeX4ht copyright|>
-   |<nameref configurations|>
-   |<nameref moved from old hyperref|>
+   |<nameref v.2 configurations|>
 \Hinput{nameref}
 \endinput
 >>>        \AddFile{8}{nameref}
@@ -2812,7 +2811,7 @@
 % CVR 2010/09/4
 % 
 
-\<nameref configurations\><<<
+\<nameref v.1 configurations\><<<
 \def\prf:label{{\ifx \NR:Title\:UnDef \else \NR:Title\fi}%
                {\ifx \NR:Type\:UnDef \else \NR:Type .1\fi}{}}%
 \let\NR:StartSec\:StartSec
@@ -2833,7 +2832,7 @@
 }
 >>>
 
-\<nameref configurations\><<<
+\<nameref v.1 configurations\><<<
 \def\:tempc#1#2#3#4#5#6[#7]#8{%
    \gdef\NR:Title{\a:newlabel{#7}}%
    \gdef\NR:Type{#1}%
@@ -2894,7 +2893,6 @@
 }
 >>>
 
-
 \<star ch title\><<<
 \gdef\sch:ttl{#1}%
 >>>
@@ -2903,9 +2901,7 @@
 \gdef\ssect:ttl{##5}%
 >>>
 
-
-
-\<nameref configurations\><<<
+\<nameref v.1 configurations\><<<
 \let\T:ref=\::ref
 \def\::ref{\protect\T at ref}
 \def\T at ref#1{% 
@@ -2917,6 +2913,141 @@
 }
 >>>
 
+% Version 2 configurations for nameref.4ht was added consequent to
+% bugs reported by Martin Heller <mr_heller at yahoo.dk> and  Denis
+% Bitouzé <dbitouze at wanadoo.fr>. A thorough revamping was needed to
+% fix the problems. Apparently, in my tests, all reported problems
+% seem to have been fixed, though, \label{...} when used inside the
+% caption appears when \nameref'ed. Also, \@begintheorem with amsthm
+% loaded needs to be tried and tested thoroughly. Otherwise, the fixes
+% are OK as vouched by Martin and Denis.
+%
+% A new function \defineautorefname has been defined and included in
+% the newtheorem definitions so that funny enunciation environment
+% names will resolve to the correct printed enunciation name when
+% \nameref'd. Users need not separately define the same.
+%
+% CVR 2012-09-20-12:48
+% 
+
+\<nameref v.2 configurations\><<<
+\let\ltx at label\label
+\def\prf:label{{\ifx \NR:Title\:UnDef \else \NR:Title\fi}%
+               {\ifx \NR:Type\:UnDef \else \NR:Type .1\fi}{}}%
+\let\NR:StartSec\:StartSec
+\let\NR:no at sect\no at sect
+\def\no at sect#1#2#3#4#5#6[#7]#8{\gdef\NR:Title{\a:newlabel{#7}}%
+    \gdef\NR:Type{#1}%
+    \NR:no at sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}}
+\def\:StartSec#1#2#3{%
+   \gdef\NR:Title{\a:newlabel{#3}}%
+   \gdef\NR:Type{#1}%
+   \NR:StartSec{#1}{#2}{#3}%
+}
+
+\def\:tempc#1#2#3#4#5#6[#7]#8{%
+   \gdef\NR:Title{\a:newlabel{#7}}%
+   \gdef\NR:Type{#1}%
+   \o:NR at sect:{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}}
+\HLet\NR at sect\:tempc
+
+\def\:tempc#1#2#3#4#5{%
+   \gdef\NR:Title{\a:newlabel\ssect:ttl}%
+   \gdef\NR:Type{#1}%
+   \o:NR at ssect:{#1}{#2}{#3}{#4}{#5}%
+}
+\HLet\NR at ssect\:tempc
+
+\def\:tempc[#1]#2{%
+   \gdef\NR:Title{\a:newlabel{#1}}%
+   \gdef\NR:Type{part}%
+   \o:no at part:[{#1}]{#2}}
+\HLet\no at part\:tempc
+
+\def\:tempc#1{%
+   \gdef\NR:Title{\a:newlabel{#1}}%
+   \gdef\NR:Type{part}%
+   \o:no at spart:{#1}}
+\HLet\no at spart\:tempc
+
+\def\:tempc[#1]#2{%
+   \gdef\NR:Title{\a:newlabel{#1}}%
+   \gdef\NR:Type{chapter}%
+   \o:NR at chapter:[#1]{#2}}
+\HLet\NR at chapter\:tempc
+
+\def\:tempc#1{%
+   \gdef\NR:Title{\a:newlabel\sch:ttl}%
+   \o:NR at schapter:{#1}%
+   \gdef\NR:Type{chapter}%
+}
+\HLet\NR at schapter\:tempc
+
+\let\o:NR@@caption\@caption
+
+\long\def\@caption#1[#2]{%
+    \gdef\NR:Type{\@captype}%
+    \gdef\NR:Title{\a:newlabel{#2}}%
+   \o:NR@@caption{#1}[{#2}]%
+}      
+
+\let\o:NRorg at opargbegintheorem\@opargbegintheorem
+  \def\@opargbegintheorem#1#2#3{%
+    \gdef\NR:Title{\a:newlabel{#3}}%
+    \gdef\NR:Type{\@currenvir}%
+    \NR at gettitle{#3}%
+    \defineautorefname{\@currenvir}{#1}%
+    \o:NRorg at opargbegintheorem{#1}{#2}{#3}%
+  }%
+
+\let\o:NRorg at begintheorem\@begintheorem
+  \def\@begintheorem#1#2{%
+    \gdef\NR:Title{\a:newlabel{#1 #2}}%
+    \gdef\NR:Type{\@currenvir}%
+    \defineautorefname{\@currenvir}{#1}%
+    \NR at gettitle{}%
+    \o:NRorg at begintheorem{#1}{#2}%
+  }%
+
+\AtBeginDocument{%
+  \@ifpackageloaded{listings}{%
+      \def\:tempc#1{%
+         \gdef\NR:Title{\a:newlabel{listing}}%
+         \gdef\NR:Type{lstlisting}%
+         \o:NROrg at lst@MakeCaption:{#1}%
+         \gdef\@currentlabelname{listing}}
+      \HLet\NROrg at lst@MakeCaption\:tempc
+  }{}%
+}
+\let\T:ref=\::ref
+\def\::ref{\protect\T at ref}
+\def\T at ref#1{%
+  \@safe at activestrue
+  \let\::ref \T:ref
+  \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}%
+  \def\::ref{\protect\T at ref}%
+  \@safe at activesfalse
+}
+
+\gdef\defineautorefname#1#2{%
+    \expandafter\gdef\csname #1autorefname\endcsname{#2}}
+\defineautorefname{theorem}{Theorem}
+
+\Configure{newlabel}
+   {\csname cur:th\endcsname \csname :currentlabel\endcsname}
+   {\string\csname\space :autoref\string\endcsname 
+     {\NR:Type}#1}
+
+\ifx \@currentlabelname\:UnDef
+   \let\@currentlabelname\empty
+\fi
+
+\pend:defIII\@setref{\edef\RefArg{##3}}
+\append:defIII\@setref{\let\:autoref\:gobble}
+\let\:autoref\:gobble
+
+>>>
+
 %%%%%%%%%%%%%%%%%%
 \Section{by name}
 %%%%%%%%%%%%%%%%%%



More information about the tex4ht-commits mailing list