% $Id: tex4ht-4ht.tex 1184 2022-08-17 11:45:35Z michal_h21 $
% tex tex4ht-4ht or ht tex tex4ht-4ht
%
% Copyright 2009-2022 TeX Users Group
% Copyright 1996-2009 Eitan M. Gurari
% Released under LPPL 1.3c+.
% See tex4ht-cpright.tex for license text.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input DraTex.sty
\input AlDraTex.sty
\DrawOff
\def\writesixteen#1{\immediate\write1616{#1}}
\writesixteen{----------Verify length of lines (4ht)------------}
\newif\ifalprotex \alprotexfalse
\hbadness=10000 \vbadness=10000 \hfuzz=99in \vfuzz=99in
\def\BREAK{^^J}
\def\Link#1\EndLink{}
\openin15=th4.4ht
\ifeof15
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% replacement for TeX4ht %%%%%%%%%%%%%%%%%%
\csname newif\endcsname\ifHtml \Htmlfalse
\def\-#1{\ifx#1-\expandafter\TEMP\else\expandafter#1\fi}
\expandafter\let\csname bye\endcsname=\end
\def\TEMP#1/#2/#3/{}
\def\HTable#1{}
\def\'#1'{}
\def\`#1'{}
\let\TableOfContents=\relax
\def\Part#1{}
\def\Chapter#1{}
\def\Appendix#1{}
\def\Section#1{}
\def\SubSection#1{}
\def\Margin#1{}
\def\HCode#1{}
\def\LinkPort\<#1\>{}
\def\TagSec#1{}
\def\RefSec#1{}
\def\List#1{} \let\ShortList=\List
\def\EndList{}
\def\item{}
\def\IgnorePar{}
\def\EndP{}
\catcode`\:=11
\csname newcount\endcsname\tmp:cnt
\def\no:catcodes#1#2#3{%
\tmp:cnt=#1
\def\no::catcodes{%
\catcode\tmp:cnt=#3
\ifnum\tmp:cnt<#2
\advance\tmp:cnt by 1 \expandafter\no::catcodes
\fi }%
\no::catcodes }
\let\:oldlq=\`
\let\:oldrq=\'
\def\'{\leavevmode \:cats \::cats}
\def\::cats#1{\if #1"\expandafter\:oldrq
\else \def\:eat##1#1{\tt ##1\egroup}\expandafter\:eat\fi}
\def\`{\leavevmode \:cats \:::cats}
\def\:::cats#1{\if #1"\expandafter\:oldlq
\else \def\:eat##1#1{`{\tt ##1}'\egroup}\expandafter\:eat\fi}
\def\:cats{\bgroup \no:catcodes0{255}{12}\catcode`\ = 10
\catcode`\^^M = 10 \catcode`\^^I = 10
}
\def\HPage{} \def\EndHPage{}
\def\Verbatim{\bgroup\catcode`\\=12 \catcode`\#=12
\catcode`\^=12 \catcode`\_=12
\catcode`\{=12 \catcode`\}=12 \catcode`\%=12 \:vrb}
\long\def\:vrb#1EndVerbatim{\egroup}
\closein15
\def\next{%\input DraTex.sty
\input ProTex.sty
\AlProTex{sty,<<<>>>,|,title,list,[],ClearCode}}
\catcode`\:=12
\else
\closein15
\def\next{%\input DraTex.sty
\input tex4ht.sty
\Preamble{html,th4,family,sections+,xhtml,next}
\Configure{@HEAD}{\HCode{ }}
% \input MyTeX4ht.sty {}%
\input ProTex.sty
\AlProTex{sty,<<<>>>,|,title,list,[],ClearCode}
\EndPreamble
}
\fi
\next
%\CodeLineNo % Set line numbers in the output, using %.
% to change the comment char used: \srclineBOT{some symbol}
% Sadly, this causes compilation to fail in unknown circumstances.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\expandafter \ifx \csname append:def\endcsname \relax
\expandafter\def\csname append:def\endcsname#1#2{%
\def\Xtemp{\def#1}%
\expandafter\expandafter\expandafter\Xtemp\expandafter{#1#2}}
\fi
\expandafter \ifx \csname Verbatim\endcsname \relax
\def\Verbatim{\bgroup
\catcode`\^=10 \catcode`\\=10 \catcode`\%=10
\catcode`\{=10 \catcode`\}=10 \catcode`\#=10 \catcode`\#=10
\XVerbatim}
\long\def\XVerbatim#1EndVerbatim{\egroup}
\fi
\expandafter \ifx \csname Verb\endcsname \relax
\def\Verb{\bgroup \catcode`\^=10 \catcode`\\=10 \catcode`\%=10
\catcode`\{=10 \catcode`\}=10 \catcode`\#=10 \catcode`\#=10
\leavevmode \Xctgs}
\def\Xctgs#1{\def\Xeat##1#1{\egroup}\Xeat }
\fi
\ifx \HAssign\UnDef
\csname newcount\endcsname \tmpXxXcnt
\def\advXxX#1{\def\XxXvar{#1}\futurelet\XxXtemp\AdvancXxX}
\def\AdvancXxX{\ifx [\XxXtemp \expandafter\AdvancXxXe
\else \expandXxXafter{\expandafter\advXxXc\XxXvar}\fi}
\def\AdvancXxXe[#1]{\expandafter\advXxXc\csname
\expandafter\string\XxXvar[#1]\endcsname}
\def\gXxXAdvance#1{\bgroup \def\XxXtemp{#1}%
\tmpXxXcnt#1\afterassignment\XxXgplus \mthXxXop\tmpXxXcnt}
\def\XxXgplus{\expandafter\xdef\XxXtemp{\the\tmpXxXcnt}\egroup}
\def\XxXAdvance#1{\bgroup \def\XxXtemp{#1}%
\tmpXxXcnt#1\afterassignment\XxXaplus \mthXxXop\tmpXxXcnt}
\def\XxXaplus{\xdef\XxXtemp{\def\expandafter\noexpand\XxXtemp{\the\tmpXxXcnt}}%
\egroup \XxXtemp}
\def\HAssign{\XxXssg\edef}
\def\gHAssign{\XxXssg\xdef}
\def\XxXssg#1#2{\let\dXxXfn#1\def\XxXvar{#2}\futurelet\XxXtemp\XxXAssgn}
\def\XxXAssgn{%
\ifx [\XxXtemp
\expandafter\dXxXfn\XxXvar[##1]{%
\noexpand\csname \expandafter
\string\XxXvar[##1]\noexpand\endcsname}%
\expandafter\assgXxXm
\else \afterassignment\assgXxXv \expandafter \tmpXxXcnt \fi }
\def\assgXxXv{\expandafter\dXxXfn\XxXvar{\the\tmpXxXcnt}}
\def\assgXxXm[#1]{%
\def\XxXtemp{\expandafter\dXxXfn
\csname \expandafter\string\XxXvar[#1]\endcsname{\the\tmpXxXcnt}}%
\afterassignment\XxXtemp \tmpXxXcnt}
\fi
\catcode`\:=11
\csname newcount\endcsname\tmp:cnt
\expandafter\ifx \csname no:catcodes\endcsname\relax
\def\no:catcodes#1#2#3{%
\tmp:cnt=#1
\def\no::catcodes{%
\catcode\tmp:cnt=#3
\ifnum\tmp:cnt<#2
\advance\tmp:cnt by 1 \expandafter\no::catcodes
\fi }%
\no::catcodes }
\fi
\let\:oldlq=\`
\let\:oldrq=\'
\def\'{\leavevmode \:cats \::cats}
\def\::cats#1{\if #1"\expandafter\:oldrq
\else \def\:eat##1#1{\tt ##1\egroup}\expandafter\:eat\fi}
\def\`{\leavevmode \:cats \:::cats}
\def\:::cats#1{\if #1"\expandafter\:oldlq
\else \def\:eat##1#1{`{\tt ##1}'\egroup}\expandafter\:eat\fi}
\bgroup
\catcode`\^=7
\gdef\:cats{\bgroup \no:catcodes0{255}{12}\catcode`\ = 10
\catcode`\^^M = 10 \catcode`\^^I = 10
}
\egroup
\catcode`\:=12
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\HOME{/opt/cvr/gurari/tex4ht.dir/texmf/tex/generic/tex4ht/}
\def\SOURCE{/opt/cvr/gurari/main.dir/html.dir}
\newcount\tmpcnt \tmpcnt\time \divide\tmpcnt 60
\edef\temp{\the\tmpcnt}
\multiply\tmpcnt -60 \advance\tmpcnt \time
\edef\version{\the\year-\ifnum \month<10 0\fi
\the\month-\ifnum \day<10 0\fi\the\day
-\ifnum \temp<10 0\fi \temp
:\ifnum \tmpcnt<10 0\fi\the\tmpcnt}
\def\CopyYear.#1.{%
\ifnum #1=\year #1\space\space\space\space\space\space
\else #1-2009\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\ConfigFiles=\empty
\def\AddFile#1#2{\csname append:def\endcsname\ConfigFiles{\AddFile{#1}{#2}}}
\AddFile{0}{Preamble}
\AddFile{0}{tex4ht}
\AddFile{0}{tex4ht2}
\AddFile{0}{etex4ht}
\let\OutFiles=\empty
\def\AddFile{\futurelet\next\contAddFile}
\def\contAddFile{%
\ifx [\next \def\next{\finishAddFile}%
\else \def\next{\finishAddFile[]}\fi
\bgroup \catcode`\_=12 \next
}
\def\finishAddFile[#1]#2#3{\egroup
\writesixteen{ ==> <#1, #2, #3>}%
\csname append:def\endcsname\OutFiles{\OutputCodE\<\if !#1!#3\else #1\fi.4ht\>}%
\csname append:def\endcsname\ConfigFiles{\AddFile{#2}{#3}}%
}
\ifHtml
\def\tocSubSection#1#2#3{\par| #2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% must appear before all TocAt
% that refer to SubSection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\TocAt{Part,Chapter,Section,LikeSection}
\TocAt{Chapter,Section,LikeSection,/Appendix,/Part}
\TocAt{LikeChapter,Section,LikeSection,/Appendix,/Part}
\TocAt{Appendix,Section,LikeSection,/Appendix,/Part}
\TocAt{Section,SubSection,/LikeSection}
\TocAt{LikeSection,SubSection,/Section}
\CutAt{Part}
\CutAt{Chapter,LikeChapter,Appendix,Part}
\CutAt{LikeChapter,Chapter,Appendix,Part}
\CutAt{Appendix,Chapter,LikeChapter,Part}
\CutAt{Section,LikeSection,Appendix,Chapter,LikeChapter,Part}
\CutAt{LikeSection,Section,Appendix,Chapter,LikeChapter,Part}
\CutAt{SubSection,Section,LikeSection,Appendix,Chapter,LikeChapter,Part}
\else
\def\ParentOf#1{}
\csname TableOfContents\endcsname
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\by{by}\def\={=}
\let\pReModifyOutputCode=\ModifyOutputCode
\def\ModifyOutputCode{%
\def\by{}\def\={}%
\pReModifyOutputCode}
\csname NoOutputCode\endcsname
\let\coDE=\<
\def\<{\vfil\par\coDE}
\tracingstats=1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\IgnorePar\EndP \HCode{
A `Literate' View of tex4ht.sty }
\csname TableOfContents\endcsname[ParentOf,Part,Chapter,%
Appendix,LikeChapter%,Section,LikeSection%
]
%%%%%%%%%%%%%%%%%%%%%
\Part{Deeper Toc}
%%%%%%%%%%%%%%%%%%
\csname TableOfContents\endcsname[ParentOf,Part,Chapter,%
Appendix,LikeChapter,Section,LikeSection%
]
%----------------- shared with TeX4ht ------------------------------------
%%%%%%%%%%%%%%%%%%%%%
\Part{Shared}
%%%%%%%%%%%%%%%%%%
\<<<
!*?: >>>
\<<<
|1-\file:id-\TitleCount >>>
\<<<
Q>>>
%------------------------------ start here ------------------------
\Chapter{Outline of the Code}
Keeping all the existing copyright messages in this file unchanged,
hence splitting the text from copyright line.
\<<<
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project .
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version |version}
>>>
This is prepended to the definition in tex4ht-cpright.tex, hence no need
to include the above (new) ``TeX4ht license text''. I don't understand.
\<<<
% Copyright 2009-|the|year|empty TeX Users Group
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
% book.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.1997. Eitan M. Gurari
|
|
|
|
|
|
|
|
|
|
\Hinput{book}
\endinput
>>> \AddFile{2}{book}
\<<<
% report.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.1997. Eitan M. Gurari
|
|
|
|
|
|
|
|
|
|
|
\Hinput{report}
\endinput
>>> \AddFile{2}{report}
\<<<
% article.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.1997. Eitan M. Gurari
|
|
|
|
|
|
|
|
|
|
|
\Hinput{article}
\endinput
>>> \AddFile{2}{article}
\<<<
|
|
| |%after tocs, divs, and cuts|%
>>>
\<<<
|
>>>
\<<<
\long\def\:tempc{\@roman \c@enumiii}
\ifx \theenumiii\:tempc
\def\:tempc{\a:enumiii\@roman\c@enumiii\b:enumiii}
\HLet\theenumiii\:tempc
\fi
\NewConfigure{enumiii}{2}
>>>
\<<<
|
\ConfigureToc{appendix} {\empty}{\ }{}{\newline}
\ConfigureToc{chapter} {\empty}{\ }{}{\newline}
\ConfigureToc{likechapter} {}{\empty}{}{\newline}
>>>
\<<<
\ConfigureToc{likeparagraph} {}{\empty}{}{\newline}
\ConfigureToc{likepart} {}{\empty}{}{\newline}
\ConfigureToc{likesection} {}{\empty}{}{\newline}
\ConfigureToc{likesubparagraph} {}{\empty}{}{\newline}
\ConfigureToc{likesubsection} {}{\empty}{}{\newline}
\ConfigureToc{likesubsubsection} {}{\empty}{}{\newline}
\ConfigureToc{paragraph} {\empty}{\ }{}{\newline}
\ConfigureToc{part} {\empty}{\ }{}{\newline}
\ConfigureToc{section} {\empty}{\ }{}{\newline}
\ConfigureToc{subparagraph} {\empty}{\ }{}{\newline}
\ConfigureToc{subsection} {\empty}{\ }{}{\newline}
\ConfigureToc{subsubsection} {\empty}{\ }{}{\newline}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Package patching handling}
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% tutorial begin
%%%%%%%%%%%%%%%%%%%%%%%%
By default, .4ht files are loaded at begin document. When we need to patch
a package at the moment when it is loaded, we can use the mechanism provided
by usepackage.4ht.
The obsolete way is to use the following construct:
\Verbatim
\<<<
packagename,>>>
\<<<
\def\:temp{packagename}\ifx\@currname\:temp
% package redefinitions
\fi
>>>
\EndVerbatim
The downside of this that it loads usepackage.4ht again for each package
it detects. This can slow down the compilation.
The recommended way is the following:
\Verbatim
\<<<
% use package name as the second argument and name of the file
% that contains redefinitions as the third
\Configure{PackageHooks}{packagename.sty}{packagename-hooks.4ht}
>>>
\<<<
% packagename-hooks.4ht (|version), generated from |jobname.tex
% Copyright 2020 TeX Users Group
|
% package redefinitions
>>>\AddFile{9}{packagename-hooks}
\EndVerbatim
The contents of the hooks file can be following:
\Verbatim
% code before package is loaded
% ...
\:AtEndOfPackage{
% redefine package commands that are used in the preamble
% ...
}
\EndVerbatim
You can use the following special commands in the hooks file:
\Verbatim
\:dontusepackage{packagename} % prevent the package from loading
\:AtEndOfPackage{code} % redefine macros that can be used in the document preamble
\EndVerbatim
%%%%%%%%%%%%%%%%%%%%%%%%
% tutorial end
%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
% usepackage.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.2003. Eitan M. Gurari
|
|
\endinput
>>>
\<<<
\def\:temp{tex4ht}\ifx \:temp\@currname
\:warning{\string\usepackage{tex4ht} again?}
|
\fi
\gdef\a:usepackage{\use:package |,|}
\gdef\use:package#1,{%
\if :#1:\def\:temp##1|{}\else
\def\:temp{#1}\ifx \@currname\:temp
\def\:temp##1|{\input usepackage.4ht }%
\else \let\:temp=\use:package \fi
\fi \:temp}
|
>>>
\<<<
\def\:temp#1htex4ht.def,tex4ht.sty#2|{\def\:temp{#2}}
\expandafter\:temp \@filelist htex4ht.def,tex4ht.sty|%
\ifx \:temp\empty \else
\:warning{if
\string\RequirePackage[tex4ht]{hyperref} or
\string\usepackage[tex4ht]{hyperref} was
used try instead, repectively,
\string\RequirePackage{hyperref} or
\string\usepackage{hyperref}}
\fi
>>>
%%%%%%%%%%%%%%%%%
\Part{latex.ltx}
%%%%%%%%%%%%%%%%
\Link[/usr/local/teTeX/share/texmf/tex/latex/base/latex.ltx]{}{}latex.ltx\EndLink,
\Link[http://ctan.org/tex-archive/macros/latex/base/]{}{}latex
source components\EndLink
\def\1.#1.{\Link[http://ctan.org/tex-archive/macros/latex/base/#1.dtx]{}{}#1\EndLink}
\<<<
% latex.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.1997. Eitan M. Gurari
|
|
|
|
|
| |%|1.ltclass.|%
|%|1.ltdirchk.|%
| |%|1.ltplain.|%
|%|1.ltvers.|%
|%|1.ltdefns.|%
|%|1.ltalloc.|%
|%|1.ltcntrl.|%
|%|1.lterror.|%
|%|1.ltpar.|%
| |%|1.ltspace.|%
|%|1.ltlogos.|%
|%|1.ltfiles.|%
| |%|1.ltoutenc.|%
| |%|1.ltcounts.|%
| |%|1.ltlength.|%
|%|1.ltfssbas.|%
| |%|1.ltfsstrc.|%
|%|1.ltfsscmp.|%
| |%|1.ltfssdcl.|%
|%|1.ltfssini.|%
|%|1.ltfntcmd.|%
|%|1.ltpageno.|%
| |%|1.ltxref.|%
| |%|1.ltmiscen.|%
| |%|1.ltmath.|%
| |%|1.ltlists.|%
| |%|1.ltboxes.|%
| |%|1.lttab.|%
| |%|1.oltpictur.|%
| |%|1.ltthm.|%
| |%|1.ltsect.|%
| |%|1.ltfloat.|%
| |%|1.ltidxglo.|%
| |%|1.ltbibl.|%
| |%|1.ltpage.|%
| |%|1.ltoutput.|%
| |%|1.ltfinal.|%
|
|
\let\:MClass:|=\c:MathClass:
\NewConfigure{MathClass}[5]{\bgroup
\let\@nodocument|=\empty
\let\normalcolor|=\relax
\:MClass:{#1}{#2}{#3}{#4}{#5}\egroup}
\let\:MDelims:|=\c:MathDelimiters:
\NewConfigure{MathDelimiters}[2]{\bgroup
\let\@nodocument|=\empty
\let\normalcolor|=\relax
\:MDelims:{#1}{#2}\egroup}
\Hinput{latex}
\endinput
>>> \AddFile{1}{latex}
\<<<
\edef\:temp{%
\every@math@size={\noexpand\ifx \noexpand\EndPicture\noexpand\:UnDef
\noexpand\else \the\every@math@size \noexpand\fi}%
}
\:temp
>>>
\<<<
\ifx\SaveMkHalignConf:g\:UnDef \else \expandafter\endinput\fi
>>>
Latex prohibits content before the \`'\begin{document}' by putting
\`'\ht:everypar{\@nodocument}' before
\`'\begin{document}' to get an error if text appears before the
beginning. A possible solution is to put sensitive stuff
in, for instance, \`'{ \let\@nodocument=\empty ...}'.
It is unsafe to define \''\romannumeral' because it is used
within immediate definition \''\edef', as well as definitions of macro
names \''\csname ...\romannumeral ...\endcsname'. Consider also
\''\Configure{enumerate}' (e.g.,
\HPage{paralist}
\Verbatim
\documentclass[a4paper]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{10}
% \RequirePackage[nocfg]{paralist}% avoid locals
% \setdefaultenum{a.}{(i)}{A.}{I.}
\begin{document}
\title{Test}
\date
\author{C. Fierro}
Default list:
\begin{enumerate}
\item \label{7-a}$x \underset{\text{(\ref{7-i})}}{\leq }y$
\item \label{7-b} $a\underset{\text{(\ref{7-ii})}}{\geq }b$
\end{enumerate}
Custom list:
\begin{enumerate}%[\itshape (i)]{}
\item \label{7-i}$y\underset{\text{(\ref{7-a})}}{\geq }x$,
\item \label{7-ii}$b \underset{\text{(\ref{7-b})}}{\leq }a$
\end{enumerate}
\end{document}
\EndVerbatim
\EndHPage{})
\<<<
\:CheckOption{enum}\if:Option
\def\:temp#1{\a:romannumeral {\expandafter
\:slowroman\romannumeral #1@}\b:romannumeral}
\HLet\@roman=\:temp
\def\:temp#1{\a:romannumeral {\expandafter
\:Slowroman\romannumeral #1@}\b:romannumeral}
\HLet\@Roman=\:temp
\item
:warning{To configure roman numbers use
the option 'enum' (unsafe)}
\fi
\NewConfigure{romannumeral}{2}
>>>
\<<<
\def\:Slowroman#1{\ifx @#1\else |%\@slowromancap|%
\if i#1\I:rnum\else
\if v#1\V:rnum\else
\if x#1\X:rnum\else
\if l#1\L:rnum\else
\if c#1\C:rnum\else
\if d#1\D:rnum\else
\if m#1\M:rnum\else
#1\fi\fi\fi\fi\fi\fi\fi\expandafter\:Slowroman\fi
}
\NewConfigure{Roman}[7]{%
\def\I:rnum{#1}\def\V:rnum{#2}\def\X:rnum{#3}\def\L:rnum{#4}%
\def\C:rnum{#5}\def\D:rnum{#6}\def\M:rnum{#7}}
\Configure{Roman}{I}{V}{X}{L}{C}{D}{M}
>>>
\<<<
\def\:slowroman#1{\ifx @#1\else
\if i#1\i:rnum\else
\if v#1\v:rnum\else
\if x#1\x:rnum\else
\if l#1\l:rnum\else
\if c#1\c:rnum\else
\if d#1\d:rnum\else
\if m#1\m:rnum\else
#1\fi\fi\fi\fi\fi\fi\fi\expandafter\:slowroman\fi
}
\NewConfigure{roman}[7]{%
\def\i:rnum{#1}\def\v:rnum{#2}\def\x:rnum{#3}\def\l:rnum{#4}%
\def\c:rnum{#5}\def\d:rnum{#6}\def\m:rnum{#7}}
\Configure{roman}{i}{v}{x}{l}{c}{d}{m}
>>>
\Chapter{Classes and Packages}
\Link[http://ctan.tug.org/ctan/tex-archive/macros/latex/base/ltdirchk.dtx]{}{}ltdirchk.dtx\EndLink
An option \`'no_#1' asks not to load the style file \`'#1.4ht'.
\<<<
\ifx \@ifpackageloaded\:UnDef
\long\def\@ifpackageloaded#1#2#3{}
\fi
\def\:ifpackageloaded#1#2#3{%
\:CheckOption{no_#1}\if:Option \:Optionfalse
\else \@ifpackageloaded{#1}{#2}{#3}\fi}
>>>
\<<<
\def\:ifclassloaded#1#2#3{%
\:CheckOption{no_#1}\if:Option \:Optionfalse
\else \@ifclassloaded{#1}{#2}{#3}\fi}
\def\:iffileloaded#1#2#3{%
\:CheckOption{no_#1}\if:Option \:Optionfalse
\else | \expandafter \:tempa\fi }
>>>
\<<<
\def\:temp{#1}\expandafter
\:iffil\@filelist,,|%
\ifx \:tempa\:temp \def\:tempa{#2}\else \def\:tempa{#3}\fi
>>>
\<<<
\def\:iffil#1,#2|{\def\:tempa{#1}\ifx \:temp\:tempa
\let\:tempb=\empty
\else
\ifx \:tempa\empty \let\:tempb=\empty
\else \def\:tempb{\:iffil#2|}\fi
\fi \:tempb}
>>>
We need the follwoing for definition of fonts that are introduced late, e.e.,
\Verbatim
\documentclass{amsart}
\usepackage{textcomp}
\usepackage{amssymb}
\begin{document}
\csname Configure\endcsname{mathfrak}{[[[[}{]]]}
\csname Configure\endcsname{mathbb}{[[[[}{]]]}
$\mathfrak{A}a^{\mathfrak{A}}$
\end{document}
\EndVerbatim
\<<<
\let\document:select:group\document@select@group
\def\document@select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\document:select:group{#1}{#2}{#3}{}%
\expandafter\ifx \csname n:\expandafter
\:gobble\string#1:\endcsname\relax\else
\expandafter\let\csname o:\expandafter\:gobble
\string#1:\endcsname\:UnDef
\expandafter\HLet\expandafter#1\csname
n:\expandafter\:gobble\string#1:\endcsname
\expand:after{\global\expandafter\let
\csname o:\expandafter\:gobble\string#1:\endcsname}%
\csname o:\expandafter\:gobble\string#1:\endcsname
\global\let#1=#1%
\fi
#1{#4}%
}}
>>>
%%%%%%%%%%%%%%%%%%
\Section{titlesec}
\<<<
% titlesec.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.2000. Eitan M. Gurari
|
\ifx \ttl@assign@ii\:Undef
\ifx \ttl@sect\:UnDef\else
|
\fi
\ifx \ttl@useclass\:UnDef\else
|
\fi
|
\else
|
\fi
\Hinput{titlesec}
\endinput
>>> \AddFile{9}{titlesec}
\<<<
\pend:defII\ttl@useclass{%
\@ifstar {}{\SkipRefstepAnchor}}
\let\ttl:select|=\ttl@select
\def\ttl@select#1{%
\edef\sc:tp{\ifttl@label\else like\fi
#1}\def\c:secnumdepth{\@nameuse{ttll@#1}}%
\ttl:select{#1}}
\let\ttl@write|=\:gobbleII
\let\ttl@glcmds\relax
\let\ttl@beginlongest\@empty
\let\ttl@midlongest\@empty
\let\ttl@endlongest\@empty
>>>
\<<<
\pend:defII\ttl@sect{%
\@ifstar {}{\SkipRefstepAnchor}}
\let\ttl:select=\ttl@select
\def\ttl@select#1#2#3#4#5{%
\edef\sc:tp{\ifttl@label\else like\fi #1}\def\c:secnumdepth{#5}%
\ttl:select{#1}{#2}{#3}{#4}{#5}}
\let\ttl@write|=\:gobbleIII
>>>
\<<<
\let\ttlh:hang|=\ttlh@hang
\def\ttlh@hang#1#2#3#4#5#6#7#8{%
\HtmlEnv
\expandafter\def\csname thetitle\sc:tp\endcsname{#2}%
\csname no:\sc:tp\endcsname{#8}%
\par \ttlh:hang{}{}{#3}{}{}{#6}{#7}{}}
>>>
\<<<
\let\:seccntformat=\@seccntformat
\def\@seccntformat#1{\ifnum 0=0\the\csname c@#1\endcsname\else
\:seccntformat{#1}\fi}
>>>
\<<<
\let\ttl:straight@i\ttl@straight@i
\def\ttl@straight@i#1[#2]#3{%
|%
\ifttl@label \else
|%
\fi
\edef\sc:tp{\ifttl@label\else like\fi #1}%
\ttl:straight@i{#1}[{#2}]{#3}%
}
\def\ttlh@hang#1#2#3#4#5#6#7#8{%
\def\c:secnumdepth{\@nameuse{ttll@\sc:tp}}%
\:StartSec {\sc:tp}{%
\ifttl@label \ifnum \c:secnumdepth >\c@secnumdepth
\else \csname the\sc:tp\endcsname \fi \fi
}{#8}%
}
\def\:tempc#1#2#3#4{%
\begingroup
\let\everypar\@gobble% don't let titlesec to break our paragraph handling
\edef\sc:tp{\ifttl@label\else like\fi #1}%
\let\ttl@savewrite\empty
\o:ttl@select:{#1}{#2}{#3}{#4}
\endgroup
}
\HLet\ttl@select\:tempc
>>>
% runin and display formats ruin tex4ht section patching
% letting them to the \ttl@hang format seems to fix that
% https://tex.stackexchange.com/q/451077/2891
\<<<
\let\ttlh@runin\ttlh@hang
\let\ttlh@display\ttlh@hang
>>>
\<<<
\def\:temp{#1}\edef\:tempa{\expandafter
\expandafter\expandafter\:gobble
\expandafter\string\csname section\endcsname}\ifx \:temp\:tempa \else
|%
\fi
>>>
\<<<
\edef\:tempa{\expandafter\expandafter\expandafter\:gobble
\expandafter\string\csname subsection\endcsname}\ifx \:temp\:tempa \else
{\ttl@labeltrue \ttl@addcontentsline{like#1}{#3}}%
\fi
>>>
\<<<
\gdef\NR:Title{\a:newlabel{#3}}%
>>>
% \def\ttlh@display#1#2#3#4#5#6#7#8{{[111]#1\ifttl@label #2\fi #4{#8}[/111]}}
% \def\ttlh@runin#1#2#3#4#5#6#7#8{{[333]#1\ifttl@label #2\fi #4{#8}[/333]}}
TeX4ht handles stuff written to TOC itself, Titlesec caused duplicated entries in TOC,
so we just disable it's TOC handling.
\<<<
\def\ttl@addcontentsline#1#2{\nobreak}
>>>
I've found that it is probably best to save definitions of sectioning commands before Titlesec
is loaded, and then load the saved versions back to the original commands.
\<<<
\Configure{PackageHooks}{titlesec.sty}{titlesec-hooks.4ht}
>>>
\<<<
% titlesec-hooks.4ht (|version), generated from |jobname.tex
% Copyright 2022 TeX Users Group
|
|
\endinput
>>> \AddFile{9}{titlesec-hooks}
\<<<
\let\ttl:chapter\chapter
\let\ttl:section\section
\let\ttl:subsection\subsection
\let\ttl:subsubsection\subsubsection
\let\ttl:paragraph\paragraph
\let\ttl:subparagraph\subparagraph
\:AtEndOfPackage{
\let\chapter\ttl:chapter
\let\section\ttl:section
\let\subsection\ttl:subsection
\let\subsubsection\ttl:subsubsection
\let\paragraph\ttl:paragraph
\let\subparagraph\ttl:subparagraph
}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Scientific Word}
\Link[ftp://ftp.mackichan.com/]{}{}mackichan\EndLink,
\Link[http://cutter.ship.edu/\string
~ensley/tci/]{}{}tci\EndLink
\<<<
% tcilatex.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.2000. Eitan M. Gurari
|
|
\expandafter\ifx \csname @TCItagstar\endcsname\relax
|
\else
|
\ifx \@msidraft\:Undef
|
\fi \fi
|
\Hinput{tcilatex}
\endinput
>>> \AddFile{2}{tcilatex}
\<<<
\let\tci:ProvidesPackage=\ProvidesPackage
\def\ProvidesPackage#1{%
\tci:ProvidesPackage{#1}%
\def\:temp{swpframe}\def\:tempa{#1}\ifx \:temp\:tempa
\ifx \GRAPHICSHP\:UnDef\else
\let\swp:GRAPHICSHP=\GRAPHICSHP
\:AtEndOfPackage{\let\GRAPHICSHP\swp:GRAPHICSHP}%
\fi
\ifx \graffile\:UnDef\else
\let\swp:graffile=\graffile
\:AtEndOfPackage{\let\graffile\swp:graffile}%
\fi
\ifx \GRAPHIC\:UnDef\else
\let\swp:GRAPHIC=\GRAPHIC
\:AtEndOfPackage{\let\GRAPHIC\swp:GRAPHIC}%
\fi
\fi
}
>>>
% \ifx \BOXEDSPECIAL\:UnDef\else
% \let\swp:BOXEDSPECIAL=\BOXEDSPECIAL
% \AtEndOfPackage{\let\BOXEDSPECIAL\swp:BOXEDSPECIAL}%
% \fi
%
%
The \`'\protect' in \`'\section{The second Section
\protect\label{two}}' is problematic because of double labels when
the toc is on. The problem can be solved with the code.
\<<<
\def\label:gobble{\futurelet\:temp\lbl:gobble}
\def\lbl:gobble#1{\ifx\:temp\relax \expandafter\label:gobble\fi}
\AtBeginDocument{\immediate\write\:tocout{%
\let\string\label \string\label:gobble }}
>>>
\<<<
\def\:temp#1#2#3#4{#2\ref{#4}#3}
\ifx \:temp\hyperref
\def\hyperref{\bgroup
\catcode`\#=12 \catcode`\~=12 \catcode`\_=12 \h:pref}%
\def\h:pref#1#2#3#4{\egroup\Link[#4]{}{}#1\EndLink}%
\fi
>>>
In version 4 \''\hyperref' is aliased to \''\x@hyperref'.
\<<<
\def\y@hyperref#1#2#3#4{%
\Link[#4]{}{}#1\EndLink
\catcode`\~ = 13
\catcode`\$ = 3
\catcode`\_ = 8
\catcode`\# = 6
\catcode`\& = 4
}
>>>
\<<<
\let\:tempc=\GRAPHICSPS
\pend:defI\:tempc{\a:GRAPHICSPS}
\append:defI\:tempc{\b:GRAPHICSPS}
\HLet\GRAPHICSPS=\:tempc
\NewConfigure{GRAPHICSPS}{2}
>>>
\<<<
\let\:tempc=\GRAPHICSHP
\pend:defI\:tempc{\a:GRAPHICSHP}
\append:defI\:tempc{\b:GRAPHICSHP}
\HLet\GRAPHICSHP=\:tempc
\NewConfigure{GRAPHICSHP}{2}
>>>
\<<<
\let\:tempc=\BOXTHEFRAME
\pend:defI\:tempc{\hbox\bgroup\a:BOXTHEFRAME}
\append:defI\:tempc{\b:BOXTHEFRAME\egroup}
\HLet\BOXTHEFRAME=\:tempc
\NewConfigure{BOXTHEFRAME}{2}
\let\:IFRAME=\IFRAME
\let\:DFRAME=\DFRAME
\let\:FFRAME=\FFRAME
\def\IFRAME#1#2#3#4#5#6{\a:IFRAME\leavevmode
\IgnorePar\:IFRAME{#1}{#2}{#3}{#4}{#5}{#6}\b:IFRAME}
\def\DFRAME#1#2#3#4#5{\a:DFRAME\leavevmode
\IgnorePar\:DFRAME{#1}{#2}{#3}{#4}{#5}\b:DFRAME}
\def\FFRAME#1#2#3#4#5#6#7#8{\a:FFRAME\leavevmode
\IgnorePar\:FFRAME{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}\b:FFRAME}
\NewConfigure{IFRAME}{2}
\NewConfigure{DFRAME}{2}
\NewConfigure{FFRAME}{2}
>>>
% \def\mailto{\bgroup \catcode`\#=12 \catcode`\~=12 \catcode`\_=12 \mlto}%
% \def\mlto#1{\egroup \Link[mailto:#1]{}{}\texttt{#1}\EndLink}%
\<<<
\def\:tempc#1#2{\o:QATOP:{\a:QATOP #1\b:QATOP}{\c:QATOP #2\d:QATOP}}
\HLet\QATOP=\:tempc
\NewConfigure{QATOP}{4}
\def\:tempc#1#2{\o:QDATOP:{\a:QDATOP #1\b:QDATOP}{\c:QDATOP #2\d:QDATOP}}
\HLet\QDATOP=\:tempc
\NewConfigure{QDATOP}{4}
\def\:tempc#1#2{\o:QTATOP:{\a:QTATOP #1\b:QTATOP}{\c:QTATOP #2\d:QTATOP}}
\HLet\QTATOP=\:tempc
\NewConfigure{QTATOP}{4}
>>>
\<<<
\expandafter\ifx \csname o:dfrac:\endcsname \relax
|
\fi
>>>
The following protection, e.g., for titles of sections.
\<<<
\let\o:Greekmath:|=\Greekmath
\def\Greekmath{\protect\o:Greekmath:}
>>>
\<<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% seslideb.4ht |version %
% Copyright (C) |CopyYear.2001. Eitan M. Gurari %
|
|
\Hinput{seslideb}
\endinput
>>> \AddFile{7}{seslideb}
\<<<
\NewSection\swSlide{}{}
\def\PageBreak{\swSlide{\swTitle}}
\let\swTitle|=\relax
>>>
\<<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% jeep.4ht |version %
% Copyright (C) |CopyYear.2002. Eitan M. Gurari %
|
|
\Hinput{jeep}
\endinput
>>> \AddFile{9}{jeep}
\<<<
\let\jeep:@sect|=\no@sect
\def\no@sect#1#2#3#4#5{%
\jeep:@sect{#1}{#2}{#3}{#4}{#5\let\@svsec=\empty}}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Chapter{Common to Plain and LaTeX-Plain}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Link[http://ctan.tug.org/ctan/tex-archive/macros/latex/base/ltplain.dtx]{}{}ltplain.dtx\EndLink
\<<<
|
|
>>>
plain.tex and latex.
The following is assumed to be within a group.
\<<<
\def\:temp{\o:obeylines:
\let\obeylines|=\o:obeylines:
\a:obyln \global\let\x:obln|=\end:obeylines \aftergroup\x:obln
\def\:temp{%
\ifx\:tempa\par \ht:everypar{\ht:everypar{\b:obyln}}%
\else \ht:everypar{\b:obyln}\fi}%
\futurelet\:tempa\:temp }
\HLet\obeylines|=\:temp
\NewConfigure{obeylines}[3]{\c:def\a:obyln{#1}\c:def\b:obyln{#3}%
\c:def\end:obeylines{#2}}
>>>
\ifHtml[\HPage{more}\Verbatim
xxxxxxxxxxxxxxxxxxxxx
{\obeylines neither do
things too high for me.}
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
{\obeylines neither do
things too high for me.}
xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
{\obeylines neither do
things too high for me.}
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
neither do
things too high for me.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx neither do
things too high for me. xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx neither do
things too high for me.
xxxxxxxxxxxxxxxxxxxxxxxxxx
\EndVerbatim\EndHPage{}]\fi
The \''\%' command needs to be redefined for TeX4ht source files,
but this redefinition causes compilation errors when it is used in
titles or captions. So we redefine it to the original LaTeX
definition. We can detect if we are in the literate sources by checking
if the \''\MAKETITLE' command is defined.
See \Link[https://tex.stackexchange.com/q/652848/2891]{}{}
this question on TeX.sx for more details\EndLink.
\<<<
\ifdefined\MAKETITLE\else
\chardef\%=`\%
\fi
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Chapter{ltspace (Horizontal Spaces)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Link[http://ctan.tug.org/ctan/tex-archive/macros/latex/base/ltspace.dtx]{}{}ltspace.dtx\EndLink
\<<<
\NewConfigure{hspace}{3}
\Configure{hspace}{}{}{ }
\def\:temp#1{\tmp:dim|=#1\relax
\a:hspace \hsp:c\hskip #1\relax\b:hspace}
\HLet\@hspace|=\:temp
\def\:temp#1{\tmp:dim|=#1\relax
\a:hspace \hsp:c\vrule \@width\z@\nobreak
\hskip #1\hskip \z@skip\b:hspace}
\HLet\@hspacer|=\:temp
\def\hsp:c{\ifdim \tmp:dim<1em\else\c:hspace\fi
\ifdim \tmp:dim<2em\else\c:hspace\fi
\ifdim \tmp:dim<3em\else\c:hspace\fi
\ifdim \tmp:dim<4em\else\c:hspace\fi
\ifdim \tmp:dim<5em\else\c:hspace\fi}
>>>
We need the assignment to \''\tmp:dim' because of commands like
\''\hspace{0.25em plus 0.125em minus 0.08em}'.
\<<<
\let\:tempc\@vspace
\append:defI\:tempc{\a:vspace{#1}}
\HLet\@vspace\:tempc
\let\:tempc\@vspacer
\append:defI\:tempc{\a:vspace{#1}}
\HLet\@vspacer\:tempc
\NewConfigure{vspace}[1]{\def\a:vspace##1{#1}}
\Configure{vspace}{}
>>>
%%%%%%%%%%%%%%%%%%
\Chapter{ltlength}
%%%%%%%%%%%%%%%%%%
\Link[http://ctan.tug.org/ctan/tex-archive/macros/latex/base/ltlength.dtx]{}{}ltlength.dtx\EndLink
%
%>>>
The commands \''\settoheight', \''\settodepth', and \''\settowidth'
invoke \''\setbox' without producing output. To avoid fake pictures,
we do the following.
\<<<
\let\:settodim|=\@settodim
\def\@settodim#1#2#3{\PictureOff \:settodim#1{#2}{#3}\PictureOn}
>>>
%%%%%%%%%%%%%
\Chapter{Cross References}
%%%%%%%%%%%%%
\Link[http://ctan.tug.org/ctan/tex-archive/macros/latex/base/ltxref.dtx]{}{}ltxref.dtx\EndLink
%%%%%%%%%%%%%
\Section{LaTeX}
%%%%%%%%%%%%%
\<<<
|
|
>>>
%%%%%%%%%%%%%
\SubSection{Index Labels}
%%%%%%%%%%%%%
Try to delete, or at least contain, \''\no:lbl:idx'.
\<<<
\def\no:lnk#1#2#3\EndLink{#3}
\let\:ref|=\ref
\let\:index|=\index
\def\no:lbl:idx{\let\label|=\@gobble }
\def\toc:lbl:idx{\a:NoSection}
>>>
%%%%%%%%%%%%%
\SubSection{ref, label, newlabel: Usage}
%%%%%%%%%%%%%
\<<<
\def\:tempc#1{\a:pageref\o:pageref:{#1}\b:pageref}
\HLet\pageref\:tempc
\NewConfigure{pageref}[3]{%
\def\a:pageref{#1\bgroup \Configure{ref}{\Link}{\EndLink}{#3}}%
\def\b:pageref{\egroup #2}%
}
\Configure{pageref}{}{}{}
>>>
\<<<
\NewConfigure{@newlabel}[1]{\concat:config\a:@newlabel{#1}}
\let\a:@newlabel|=\relax
|
\NewConfigure{newlabel}[2]{%
\def\a:newlabel{#1}\ifx \a:newlabel\empty
\def\label:addr{\cur:th \:currentlabel}%
\else
\def\label:addr{#1}%
\fi
\def\a:newlabel##1{\expandafter\string\c:rEfLiNK{\label:addr}{#2}}}
\NewConfigure{ref}[3]{%
\def\a:rEfLiNK{#1}\def\b:rEfLiNK{#3}%
\ifx \a:rEfLiNK\empty
\ifx \b:rEfLiNK\empty
\expandafter\def\c:rEfLiNK##1##2{##2}%
\else
\expandafter\def\c:rEfLiNK##1##2{#3}%
\fi
\else
\ifx \b:rEfLiNK\empty
\expandafter\def\c:rEfLiNK##1##2{#1{##1}{}##2#2}%
\else
\expandafter\def\c:rEfLiNK##1##2{#1{##1}{}#3#2}%
\fi
\fi
\def\b:rEfLiNK{#2}%
}
\Configure{newlabel}{\cur:th \:currentlabel}{#1}
\NewConfigure{newlabel-ref}[1]{\def\c:rEfLiNK{#1}%
\ifx \at:startdoc\:UnDef \dflt:ref{#1}\else
\pend:def\at:startdoc{\dflt:ref{#1}}\fi
}
\def\dflt:ref#1{\if@filesw\immediate\write\@auxout{\string\ifx
\string#1\string\UnDef\gdef\string#1\#1\#2{\#2}\string\fi}\fi}
\Configure{newlabel-ref}{\rEfLiNK}
\let\:writefile|=\@writefile
\def\@writefile#1{\bgroup \catcode`\:|=11 \:wrtfile{#1}}
\def\:wrtfile#1#2{\egroup\:writefile{#1}{#2}}
>>>
\List{*}
\item
\`'\Configure{ref}{\Link}{\EndLink}{anchor}' tells what \''\Link'-type command
should be on insertions of \''\ref'. If the third parameter is empty,
the anchor is the one provided by the system. If the first parameter
is empty, no Link is assumed.
\item
\''\Configure{newlabel}{\cur:th \:currentlabel}{#1}' supplies the
target address and the anchor.
\item
\''\Configure{newlabel}{}{#1}'
is equivalent to
\''\Configure{newlabel}{\cur:th \:currentlabel}{#1}'
\item
The
\''\Configure{newlabel-ref}{\rEfLiNK}' command provides an
intermediate link command for the aux command, which
\`'\Configure{ref}{\Link}{\EndLink}{anchor}' configures. If the first
field of the last configuration command is empty, than the anchor is
provided without its surrounding.
\EndList
\Verbatim
> One more thing. You will notice from `minitoc.tex' that the HTML
> anchors given to the sections depend on the value of \@currentlabel,
> be it set explicitely or implicitly (e.g., by the previous section).
> Is it what you want ?
Yes. I believe the reason was to avoid ambiguities--unfortunately,
I can't locate now where they could occur.
{\makeatletter \gdef\@currentlabel{XxX}}
\section*{first section/First chapter}
\section{second section/First chapter}
\section*{third section/First chapter}
\EndVerbatim
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\SubSection{ref, label, newlabel: Hooking into Label}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
\let\:label|=\label
\def\label{\relax
\expandafter\ifx \csname cur:th\endcsname\relax \expandafter\:label
\else \expandafter\l:bel \fi}
\let\lb:l|=\label
\def\l:bel#1{\@bsphack\if@filesw {\let\thepage|=\relax
|%
\let\protect|=\@unexpandable@protect \cur:lbl{}%
\ifx \EndPicture\:UnDef
\ifx \cur:th\skip:anchor
|%
\else \ifx \:currentlabel\empty
|%
\fi \fi
\else
|%
\fi
\a:@newlabel
\edef\@tempa{\write\@auxout{\string
\newlabel{#1}{{|}%
{|}|}}}%
\expandafter}\@tempa
\if@nobreak \ifvmode\nobreak\fi\fi\fi
|%
\@esphack}
|
>>>
\<<<
\Configure{@newlabel}{\def\%{\string\%}}
>>>
We had before \`'\ifx \EndPicture\:UnDef...\else...\fi' embeded within
\`'\ifx \cur:th\skip:anchor' but that eliminated the anchors for
eqnarray of pictures.
To save memory, we try to get anchors only when refered by labels.
For instance, this is the case for \''\@thm'.
\<<<
\bgroup \a:@newlabel
\Make:Label{\label:addr}{}\egroup
>>>
\<<<
\let\skip:anchor|=\:UnDef
>>>
The following deals with labels \''\label' provided before sectioning commands.
\<<<
\def\:currentlabel{doc}%
|%
>>>
\<<<
\def\AutoRefstepAnchor{\SkipRefstepAnchor}
>>>
The following is to ensure anchors for labels in pictures.
\<<<
\begingroup
\a:@newlabel
\edef\:temp{\noexpand\AfterPicture{%
\noexpand\Make:Label{\label:addr}{}%
\noexpand\uno:lbl{\label:addr}}%
}\:temp
\endgroup
>>>
The following is to avoid eliminated anchors as is the case in, for instance, \`'\[xx\label{a}\label{b}\] '.
\<<<
\def\uno:lbl#1{\def\:temp{#1}\futurelet\:tempa\I:lbl}
\def\I:lbl{\ifx \:tempa\Make:Label \expandafter\no:mklbl \fi}
\def\no:mklbl#1#2#3{\def\:tempa{#2}\ifx \:temp\:tempa \else
\Make:Label{#2}{#3}\fi}
>>>
\<<<
\a:newlabel\@currentlabel
>>>
The anchor for the page is approximated to the anchor of the logical unit.
This is so to solve the possible problem of having a \`'label' in a position
where \`'' links are not allowed.
\<<<
\a:newlabel\thepage
>>>
\<<<
\let\:currentlabel|=\empty
>>>
In pure latex, \''\Configure{newlabel}{##1}'.
The following is treated in a similar manner to cite.
It provides the means to disable nested links in
entries of tocs. The \''\Link' doesn't seem to need
the \''[]' option there, so a \''\:gobbleII' can do the job.
A better def is given to \''\l:bel' in AmsLaTeX .
\<<<
\let\l:bel:|=\l:bel
\def\l::bel#1{{\:SUBOff\:SUPOff\xdef\:temp{\noexpand\l:bel:{#1}}}\:temp}
\def\l:bel{\Protect\l::bel}
\let\o:ref|=\:ref
\def\::ref#1{{\:SUBOff\:SUPOff\xdef\RefArg{#1}}\expandafter\o:ref
\expandafter{\RefArg}}
\DeclareDocumentCommand\:ref{s}{\IfBooleanTF{#1}{\Protect\::ref}{\Protect\::ref}}
\let\ref|=\:ref
>>>
Support for the \''\Ref' command. It is variant of \''\ref' that uppercases
first letter of the referenced label.
\<<<
\def\::Ref#1{%
\let\olda:rEfLiNK\rEfLiNK%%
\def\rEfLiNK##1##2{\Link{##1}{}\edef\:ref:currentlabel{##2}\expandafter\MakeUppercase\:ref:currentlabel\EndLink}%
\::ref{#1}%
\let\rEfLiNK\olda:rEfLiNK%
}
\DeclareDocumentCommand\:Ref{s}{\IfBooleanTF{#1}{\Protect\::Ref}{\Protect\::Ref}}
\let\Ref\:Ref
>>>
Without the \'''\expandafter' we may get \''\RefArg' passed
as the first argument to \''\T@arg',
resulting in \''\def\RefArg{\RefArg}'.
\<<<
\let\:newl@bel|=\@newl@bel
\let\n:wlbl|=\@newl@bel
\def\@newl@bel#1#2{{\:SUBOff\:SUPOff
\xdef\:temp{\noexpand\n:wlbl{#1}{#2}}}\:temp}
>>>
\<<<
\let\:testdef|=\@testdef
\def\@testdef #1#2{{\:SUBOff\:SUPOff
\xdef\:temp{\noexpand\:testdef{#1}{#2}}}\:temp}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\SubSection{@currentlabel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The second parameter of \''\anc:lbl' is a counter name, when such is know.
The \`'\@currentlabel' comes sometimes with font info. Normally, it
comes from \''\refstepcounter' in the form of
\''\the..counter-name..'. In such cases, we can take the counter
name which is provided in the parameter of \''\cur:lbl'.
\<<<
\NewConfigure{@:currentlabel}[1]{\concat:config\a:@:currentlabel{#1}}
\let\a:@:currentlabel|=\relax
\def\cur:lbl#1{{\let\saved:currentlabel\:currentlabel\a:@:currentlabel
|\expandafter}\:currentlabel}
>>>
\<<<
\def\:currentlabel{\par}%
\ifx\@currentlabel\:currentlabel
\def\:currentlabel{\let\:currentlabel|=\empty}%
\else \def\:currentlabel{#1}%
\edef\:currentlabel{\def\noexpand
\:currentlabel{\ifx\:currentlabel\empty
\ifx \:@currentlabel\:UnDef
\ifx\saved:currentlabel \@currentlabel\@currentlabel\else\saved:currentlabel\fi
\else \:@currentlabel \fi
\else
\expandafter\ifx\csname #1:Count\endcsname\relax
\expandafter\the\csname c@#1\endcsname
\else \csname #1:Count\endcsname\fi
\fi}}%
\fi
>>>
The \''\label' command of latex invokes \''\cur:lbl{}'. If
\''\:@currentlabel' is deined, it is the to be used for the current label.
The \''\ltx@label' command of amsmath.sty ignores it.
Whenever \''\@currentlabel' is redefined, we also want to redefine
\''\:@currentlabel'. It is redefined in
\List{*}
\item latex.ltx within
\''\refstepcounter', \''\eqnarray', \''\@mpfootnotetext',
and \''\@footnotetext';
\item amsart.cls, amsbook.cls, and amsproc.cls
within \''eqnarray' and \''\@footnotetext';
\item amsmath.sty within
\''\df@tag' and \''\make@df@tag@@';
\item amstex.sty within
\''\@currentlabel', \''\@seteqlabel', and \''multline*'.
\EndList
\<<<
\let\cnt:currentlabel|=\@currentlabel
\def\:@currentlabel{\ifx \cnt:currentlabel\@currentlabel
\expandafter\the\csname c@equation\endcsname\else \@currentlabel\fi}%
>>>
\<<<
\let\cnt:currentlabel|=\@currentlabel
\def\:@currentlabel{\ifx \cnt:currentlabel\@currentlabel
\expandafter\the\csname c@#1\endcsname\else \@currentlabel\fi}%
>>>
\<<<
\html:addr \edef\cur:th{|\last:haddr r}%
>>>
\<<<
\anc:lbl r{}%
>>>
\<<<
|
\def\cnt:currentlabel{\p@equation\theequation}%
\def\:@currentlabel{\ifx \cnt:currentlabel\@currentlabel
\expandafter\the\csname c@equation\endcsname\else \@currentlabel\fi}%
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\SubSection{/link for /label from /refstepcounter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following is late arrival into TeX4ht, inserted for handling
\''\newtheorem', and possibly other structures. It might cause
duplicated anchors. At least in the case of figures and lists they
are overided by other anchors, and hence not needed. In case of
lists and new theorems we ended to delete the overriden case. Still
need to do it
for pictures, and amybe also other cases.
The \''\refstepcounter' may appear in places (e.g., before first item
of a list) where no text is allowed, hence we have to ensure that
\''\anc:lbl' will not break this restriction.
How about within pictures?
\<<<
\append:defI\refstepcounter{%
|%
\anc:lbl r{#1}}
\def\anc:lbl#1#2{%
\html:addr \xdef\cur:th{|\last:haddr #1}%
\ifx \EndPicture\:UnDef
{\let\leavevmode|=\empty \cur:lbl{#2}%
\Make:Label{\cur:th\:currentlabel}{}}%
\else \ifx \label\@gobble \else \cur:lbl{#2}%
\edef\:temp{\noexpand\AfterPicture{%
\noexpand\Make:Label{\cur:th\:currentlabel}{}}}\:temp
\fi \fi}
\let\onc:lbl|=\anc:lbl
\def\SkipRefstepAnchor{\def\anc:lbl##1##2{\html:addr
\edef\cur:th{|\last:haddr}\ShowRefstepAnchor
\let\skip:anchor|=\cur:th}}
\def\ShowRefstepAnchor{\let\anc:lbl|=\onc:lbl}
|
\html:addr \edef\cur:th{|\last:haddr}
>>>
% \def\AutoRefstepAnchor{\def\anc:lbl##1##2{\onc:lbl{##2}{}%
% \ShowRefstepAnchor}}
We can't use ref- below, because
The MakeLabel removes duplicates such as in
\Verbatim
\documentclass{article}
\begin{document}
\begin{equation}\label{jh}
c
\end{equation}
\end{document}
\EndVerbatim
For memory conservation, a maximum is placed on the number of labels
recorded.
\<<<
\def\Make:Label#1#2{%
\def\:tempb##1|{%
\xdef\Made:Labels{{#1}\Made:Labels}%
\set:label{\hbox{\Link{}{#1}#2\EndLink}}%
\trim:Labels
}%
\def\:tempc##1|{\hbox{#2}}%
\let\:next=\check:labels \edef\:tempa{#1}%
\expandafter\:next\Made:Labels{}|%
}
\let\set:label=\empty
>>>
\<<<
\let\Made:Labels=\empty
\def\check:labels#1{%
\def\:temp{#1}\ifx\:temp\empty \let\:next=\:tempb
\else\ifx \:temp\:tempa \let\:next=\:tempc
\fi \fi
\:next }
>>>
\<<<
\HAssign\Labels:Cnt |= 0
\def\trim:Labels{%
\ifnum \Labels:Cnt>100
\def\:tempa##1|{}%
\gHAssign\Labels:Cnt = 0
\let\:tempb\Made:Labels
\let\Made:Labels\empty
\expandafter\keep:Labels\:tempb|%
\else \gHAdvance\Labels:Cnt by 1 \fi
}
\def\keep:Labels#1{\relax
\ifnum \Labels:Cnt<50
\xdef\Made:Labels{\Made:Labels{#1}}\gHAdvance\Labels:Cnt |by 1
\expandafter\keep:Labels
\else \expandafter\:tempa \fi }
>>>
We need the \''\hbox' above because \''\label' complains if vertical
mode is replaced with horizontal mode.
\`' \let\Link:Labe|=\Make:Label
\def\Tag:Label#1#2{\Tag{fR\label:Count}{#1}#2\GetLabel}
\def\LinkLabels{\let\Make:Label|=\Link:Label}
\def\SendLabels{\let\Make:Label|=\Tag:Label}'
\ifHtml[\HPage{test data}\Verbatim
\newtheorem{example}{Example}[section]
\begin{example}
\label{E}
\end{example}
Example \ref{E}
\EndVerbatim\EndHPage{}]\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\SubSection{divisions in tex4ht.sty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
\def\Get:SecAnchor#1#2#3{%
|%
\xdef\cur:th{|\last:haddr}%
|%
\xdef\:currentlabel{#2}%
\edef\:SecAnchor{\cur:th\:currentlabel}%
}
>>>
We redefine \''\@Roman' for \''\thepart' to have the same number
of entries as \''\Alph'.
\<<<
\bgroup \def\@Roman##1{%
\ifcase##1\or I\or II\or III\or IV\or V\or VI\or
VII\or VIII\or IX\or X\or XI\or XII\or XIII\or
XIV\or XV\or XVI\or XVII\or XVIII\or XIX\or XX\or
XXI\or XXII\or XXIII\or XXIV\or XV\or XVI\else
\expandafter\uppercase\expandafter{\romannumeral ##1}\fi}%
\a:currentlabel
\expandafter\ifcsname p@#1\endcsname%
\edef\:temp{\csname p@#1\expandafter\endcsname\csname the#1\endcsname}\ifx \:temp\empty
\else \global\let\@currentlabel|=\:temp\fi\fi
\egroup
>>>
\<<<
\NewConfigure{currentlabel}{1}
>>>
The \''\@currentlabel' may hold a \''\uppercase' due to \''\thepart'
that has a \''\@Roman' in it.
Tried to go for \`'\cur:lbl{#1}%', but that was a problem for cross
references with labels of sections, because \''\label' uses \`'\cur:lbl{}'.
\<<<
\let\:tempa|=\uppercase \def\uppercase##1{##1}\cur:lbl{}%
\let\uppercase|=\:tempa
>>>
How the above \`'\global\let\cur:th|=\last:haddr'
work with the change in \''\refstepcounter'?
%%%%%%%%%%%%%%%%%%
\SubSection{ref-}
%%%%%%%%%%%%%%%%%%
To reduce conflicts, we deal with labels indirectly
through a counter. The counter is increased before
\''\getlabel' and after \''ref'. That is, this pair is assured
consistency of a label. The separation between \''\GetLabel' and
\''\PutLabel' is
to allow the latter one into immediate arguments such as \''\HCode'
and \''\Tg'.
\''\label' sends its info to \''\getlabel'. It insert a
\`'' iff it is a target of a \''\pageref'.
\Verbatim
\:info{\string\Configure{label}{\string#1}{\string#1}}
\:info{\string\Configure{pageref}{\string#1}}
\:info{\string\Configure{ref}{\string#1}}
\Configure{label}{#1}{\HCode{[pagelabel label="#1"/]}}
\Configure{pageref}{\HCode{[pageref label="#1"/]}}
\Configure{ref}{\HCode{[ref label="#1"/]}}
\GetLabel \PutLabel \ref{a} \pageref{a} \label{a}
\EndVerbatim
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{apacite.sty bibtex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% apacite.4ht |version %
% Copyright (C) |CopyYear.2000. Eitan M. Gurari %
|
|
\ifx \@@citeNP\:UnDef
|
\else
|
\fi
\Hinput{apacite}
\endinput
>>> \AddFile{9}{apacite}
\<<<
\def\B:my@dummy{\B@my@dummy}
\def\:citeP{\@citeP}
\def\:tempc<#1>[#2]#3{%
\start:cite\a:cite \o:@@cite:<#1>[#2]{#3}\b:cite \end:cite
}
\HLet\@@cite=\:tempc
>>>
\<<<
\def\@lbibitem[#1]#2{%
\def\BBA{\BBAA}%
\item[\@biblabel{#1}]%
\if@filesw{%
\a:bibcite
\def\BBA{\string\BBA}%
\def\protect##1{\string ##1}%
\immediate\write\@auxout{\string\bibcite{#2}{#1}}%
\def\BBA{\BBAA}%
}%
\fi%
\ignorespaces%
}
>>>
\<<<
\def\start:cite{%
\let\sv:edef\edef
\let\gobble:cite=\:gobble
\def\edef##1{\def\:temp{##1}%
\ifx \:temp\B:my@dummy
\ifx \o:BCA\:UnDef
\ifx \BCA\:UnDef\else
\let\o:BCA=\BCA
\def\BCA####1####2{\Protect\cIteLink{X\@citeb}{}%
\o:BCA{####1}{####2}\Protect\EndcIteLink}%
\fi
\fi
\fi
\sv:edef##1}%
}
\def\end:cite{%
\let\edef=\sv:edef
\let\BCA=\o:BCA \let\o:BCA=\:UnDef
}
>>>
\<<<
\def\start:cite{%
\let\sv:edef\edef
\let\gobble:cite=\:gobble
\def\edef##1{\def\:temp{##1}%
\ifx \:temp\B:my@dummy
\cIteLink{X\@citeb}{}\let\gobble:cite=\empty
\ifx \o:@BBOP\:UnDef
\let\o:@BBOP=\@BBOP
\let\o:@BBAY=\@BBAY
\pend:def\@BBOP{\gobble:cite\EndcIteLink
\let\gobble:cite=\:gobble}%
\pend:def\@BBAY{\gobble:cite\EndcIteLink
\let\gobble:cite=\:gobble}%
\fi
\fi
\ifx \:temp\:citeP
\gobble:cite\EndcIteLink \let\gobble:cite=\:gobble
\fi
\sv:edef##1}%
}
\def\end:cite{%
\let\edef=\sv:edef
\let\@BBOP=\o:@BBOP \let\o:@BBOP=\:UnDef
\let\@BBAY=\o:@BBAY \let\o:@BBAY=\:UnDef
}
\def\:tempc[#1]#2{%
\start:cite\a:cite \o:@citeA:[#1]{#2}\b:cite \end:cite
}
\HLet\@citeA=\:tempc
\def\:tempc[#1]#2{%
\start:cite\a:cite \o:@citeyear:[#1]{#2}\b:cite \end:cite
}
\HLet\@citeyear=\:tempc
\def\:tempc<#1>[#2]#3{%
\start:cite\a:cite \o:@@citeNP:<#1>[#2]{#3}\b:cite \end:cite
}
\HLet\@@citeNP=\:tempc
\def\:tempc#1{%
\start:cite\a:cite \o:@citeauthor:{#1}\b:cite \end:cite
}
\HLet\@citeauthor=\:tempc
\def\:tempc[#1]#2{%
\start:cite\a:cite \o:@citeyearNP:[#1]{#2}\b:cite \end:cite
}
\HLet\@citeyearNP=\:tempc
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{mla.sty bibtex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mla.4ht |version %
% Copyright (C) |CopyYear.2002. Eitan M. Gurari %
|
|
\Hinput{mla}
\endinput
>>> \AddFile{9}{mla}
\<<<
\catcode`\:=12
\def\@citedatax[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
\def\@citea{}\csname a:cite\endcsname
\@cite{\@for\@citeb:=#2\do%
{\@citea\def\@citea{, }\@ifundefined% by Young
{b@\@citeb}{{\bf ?}%
\@warning{Citation `\@citeb' on page \thepage \space undefined}}%
{\cIteLink {X\@citeb}{}\csname b@\@citeb\endcsname \EndcIteLink
}}}{#1}\csname b:cite\endcsname}
\catcode`\:=11
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Biblatex}
\SubSection{biblatex.sty}
\<<<
% biblatex.4ht (|version), generated from |jobname.tex
% Copyright |CopyYear.2007. Eitan M. Gurari
|
|
|
|
|
|
\Hinput{biblatex}
\endinput
>>> \AddFile{6}{biblatex}
\