Debian Codegraph @

texmf-dist/source/generic/tex4ht/tex4ht-sty.tex

raw
1 % $Id: tex4ht-sty.tex 1795 2026-03-11 16:18:18Z michal_h21 $
2 % tex tex4ht-sty or ht tex tex4ht-sty
3 %
4 % Copyright 2009-2022 TeX Users Group
5 % Copyright 1996-2009 Eitan M. Gurari
6 % Released under LPPL 1.3c+.
7 % See tex4ht-cpright.tex for license text.
8
9 \input common
10 \input DraTex.sty
11 \input AlDraTex.sty
12
13 \DrawOff
14
15 \writesixteen{----------Verify length of lines (sty)------------}
16
17 \newif\ifalprotex \alprotexfalse
18
19 \hbadness=10000 \vbadness=10000 \hfuzz=99in \vfuzz=99in
20
21
22 \def\Link#1\EndLink{}
23
24 \openin15=./tex4ht.sty
25 \ifeof15
26
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% replacement for TeX4ht %%%%%%%%%%%%%%%%%%
28 \writesixteen{........dvi mode}
29 \csname newif\endcsname\ifHtml \Htmlfalse
30 \def\-#1{\ifx#1-\expandafter\TEMP\else\expandafter#1\fi}
31 \expandafter\let\csname bye\endcsname=\end
32 \def\TEMP#1/#2/#3/{}
33 \def\HTable#1{}
34 \def\'#1'{}
35 \def\`#1'{}
36 \let\TableOfContents=\relax
37 \def\Part#1{}
38 \def\Chapter#1{}
39 \def\Appendix#1{}
40 \def\Section#1{}
41 \def\SubSection#1{}
42 \def\Margin#1{}
43 \def\HCode#1{}
44 \def\LinkPort#1\EndLink{}
45 \def\EndLink{}
46 \expandafter\let\csname bye\endcsname=\end
47 \def\TagSec#1{}
48 \def\RefSec#1{}
49 \def\List#1{} \let\ShortList=\List
50 \def\EndList{}
51 \def\item{}
52 \expandafter\let\expandafter\ifOption\csname iffalse\endcsname
53 \let\IgnorePar\empty
54 \let\EndP\empty
55 \catcode`\:=11
56 \def\Verb{\bgroup \catcode`\^=10 \catcode`\\=10 \catcode`\%=10
57 \catcode`\{=10 \catcode`\}=10 \catcode`\#=10 \catcode`\#=10
58 \leavevmode \:ctgs}
59 \def\:ctgs#1{\def\:eat##1#1{\egroup}\:eat }
60 \csname newcount\endcsname\tmp:cnt
61 \def\no:catcodes#1#2#3{%
62 \tmp:cnt=#1
63 \def\no::catcodes{%
64 \catcode\tmp:cnt=#3
65 \ifnum\tmp:cnt<#2
66 \advance\tmp:cnt by 1 \expandafter\no::catcodes
67 \fi }%
68 \no::catcodes }
69 \let\:oldlq=\`
70 \let\:oldrq=\'
71 \def\'{\leavevmode \:cats \::cats}
72 \def\::cats#1{\if #1"\expandafter\:oldrq
73 \else \def\:eat##1#1{\tt ##1\egroup}\expandafter\:eat\fi}
74 \def\`{\leavevmode \:cats \:::cats}
75 \def\:::cats#1{\if #1"\expandafter\:oldlq
76 \else \def\:eat##1#1{`{\tt ##1}'\egroup}\expandafter\:eat\fi}
77 \def\:cats{\bgroup \no:catcodes0{255}{12}\catcode`\ = 10
78 \catcode`\^^M = 10 \catcode`\^^I = 10
79 }
80
81 \def\HPage{} \def\EndHPage{}
82 \def\Verbatim{\bgroup\catcode`\\=12 \catcode`\#=12
83 \catcode`\^=12 \catcode`\_=12
84 \catcode`\{=12 \catcode`\}=12 \catcode`\%=12 \:vrb}
85 \long\def\:vrb#1EndVerbatim{\egroup}
86
87
88 \closein15
89 \def\next{%\input DraTex.sty
90 \writesixteen{.................requesting non-html mode}%
91 \input ProTex.sty
92 \AlProTex{sty,<<<>>>,|,title,list,[],ClearCode}}
93 \catcode`\:=12
94 \else
95 \closein15
96 \def\next{%\input DraTex.sty
97 \writesixteen{.................requesting html mode}%
98 \input tex4ht.sty
99 \Preamble{xhtml,th4,family,sections+}
100 \Configure{@HEAD}{\HCode{<link rev="made"\Hnewline
101 href="mailto:[email protected]" />}}
102 %%
103 \input ProTex.sty
104 \AlProTex{sty,<<<>>>,|,title,list,[],ClearCode}
105 \EndPreamble}
106
107 \fi
108
109 \next
110
111
112 \def\`{\Verb}
113 \def\'{\Verb}
114
115
116 \ifHtml
117 \TocAt{Chapter,Section,SubSection,LikeSection,/Appendix,/Part}
118 \TocAt{LikeChapter,Section,SubSection,LikeSection,/Appendix,/Part}
119 \TocAt{Appendix,Section,SubSection,LikeSection,/Appendix,/Part}
120 \CutAt{Chapter,LikeChapter,Appendix,Part}
121 \CutAt{LikeChapter,Chapter,Appendix,Part}
122 \CutAt{Appendix,Chapter,LikeChapter,Part}
123 \else
124 \def\ParentOf#1{}
125 \csname TableOfContents\endcsname
126 \fi
127
128
129 %%%%%%%%%%%%%%%%%%%%%%%%%
130 \def\by{by}\def\={=}
131 \let\pReModifyOutputCode=\ModifyOutputCode
132 \def\ModifyOutputCode{%
133 \def\by{}\def\={}%
134 \pReModifyOutputCode}
135
136 \csname NoOutputCode\endcsname
137
138 \let\coDE=\<
139 \def\<{\vfil\par\coDE}
140
141 \tracingstats=1
142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143
144
145 \IgnorePar \EndP
146 \HCode{<h1>A Literate View of tex4ht.sty</h1>}
147
148
149
150
151
152
153 \csname TableOfContents\endcsname[ParentOf,Part,Chapter,%
154 Appendix,LikeChapter,Section,LikeSection]
155
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 \Chapter{Outline of the Code}
158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
159
160
161
162 \Section{TeX4ht}
163
164 \<tex4ht\><<<
165 \ifnum\the\catcode`\%=14\else\expandafter\edef\csname
166 \string:RestoreCatcodes\endcsname{\catcode`\%|=\the
167 \catcode`\%}\catcode`\%|=14\fi
168 |<copyright|>
169 \ifx \Preamble\UnDef \else
170 % fix for LaTeX hook system, \AtBeginDocument is not available at this moment
171 \let\origatbegindocument\AtBeginDocument
172 \def\AtBeginDocument#1{\AddToHook{begindocument/end}{#1}}
173 \csname expand:after\endcsname{\csname
174 BeforeTeXIVht\endcsname\let\BeforeTeXIVht|=\UnDef}
175 \let\AtBeginDocument\origatbegindocument
176
177 \fi
178
179 % we used to disable new LaTeX's tagging support,
180 % because it clashed with TeX4ht and caused fatal errors
181 % we fixed the fatal errors, so it should be possible to
182 % fix other issues as well. The upside will be that we
183 % should be able to coordinate the projects and reuse some code.
184 % https://github.com/michal-h21/make4ht/issues/145
185 % \ifdefined\DocumentMetadata
186 % \def\DocumentMetadata#1{\def\:DocumentMetadata{#1}}
187 % \fi
188
189 % This is new TeX primitive which is set by the current LaTeX to produce
190 % more paragraphs. The problem is that it can lead to infinite loops with TeX4ht
191 % especially in tables. I've found several of these cases, which are not easy to fix sometimes.
192 % For example, I've found such infinite loop when using \vbox inside tabular.
193 % So for now, we just disable it.
194 \partokencontext=0
195
196 \def\writesixteen#1{\immediate\write99999{#1}}
197 |<save cat codes|>
198 |<ifs for TeX4ht|>
199 |<check if latex|>
200 \ifx \Preamble\UnDef
201 \ifx \PLATFORM\:UnDef \else
202 \message{ [\PLATFORM] }\let\PLATFORM|=\:UnDef\fi
203 |<early utilities|>
204 |<first pass|>
205 |<first pass for latex|>
206 \expandafter\ifx \csname tex4ht\endcsname\relax
207 \let\:temp|=\empty
208 \else
209 |<temp := auto load Preamble|>
210 \fi
211 \let\:tempc|=\:temp
212 |<def early latex ifOption|>
213 \pend:def\:tempc{\:RestoreCatcodes }
214 \append:def\:tempc{\endinput}
215 \let\:temp|=\:tempc
216 \expandafter\:temp
217 \fi
218 |<second pass|>
219 \ifx \Hinput\:UnDef \else
220 \Hinput{tex4ht2}
221 |<load protex|>
222 \fi
223 |<TeXivht = user file requests|>
224 |<html-end of style file|>
225 \rmv:ifs \let\rmv:ifs|=\:UnDef
226 \:RestoreCatcodes \TeXivht
227 \endinput
228 >>>
229
230
231
232
233
234
235
236
237
238
239 \<load sub tex4ht styles\><<<
240 \ifHtml \def\:tempa{\:Hinclude}
241 \else
242 \:CheckOption{th4}\if:Option \def\:tempa{\input th4.4ht}
243 \else \let\:tempa|=\empty \fi
244 \fi
245 \:CheckOption{core} \if:Option \let\:tempa|=\empty \fi
246 \:CheckOption{base} \if:Option \let\:tempa|=\empty \fi
247 \:tempa
248 >>>
249
250
251
252
253
254
255
256
257
258 We have in amsmath
259
260
261 \<utilities\><<<
262 \def\HLet#1{%
263 \expandafter\ifx
264 \csname o:\expandafter\:gobble\string#1:\endcsname\relax
265 |<save old def of macro|>%
266 \fi
267 |<selector between old and new def|>%
268 \expandafter\let
269 \csname n:\expandafter\:gobble\string#1:\endcsname}
270 >>>
271
272
273 The original definition of \`'\.....' is stored in \`'\o:...:', and
274 the new one in \`'\n:....:'.
275 The selector is outside the \''\ifx' so that the \''\HLet' will
276 work also on macros restored with \''\HRestore'.
277
278
279 \<utilities\><<<
280 \def\HRestore#1{\relax
281 \expandafter\ifx
282 \csname o:\expandafter\:gobble\string#1:\endcsname\relax
283 \:warning{\string\HRestore\noexpand#1?}%
284 \else
285 \expand:after{\let#1|=}\csname o:\expandafter
286 \:gobble\string#1:\endcsname
287 \fi}%
288 >>>
289
290 Don't erase the \`'o:...:', just in case a saving with let
291 is done before restoring.
292
293
294 \<save old def of macro\><<<
295 \expandafter\let
296 \csname o:\expandafter\:gobble\string#1:\endcsname|=#1%
297 >>>
298
299 \<selector between old and new def\><<<
300 \edef#1{\noexpand\ifx \noexpand\EndPicture\noexpand\:UnDef
301 \noexpand\expandafter \expandafter\noexpand
302 \csname n:\expandafter\:gobble\string#1:\endcsname
303 \noexpand\else \noexpand\expandafter \expandafter\noexpand
304 \csname o:\expandafter\:gobble\string#1:\endcsname
305 \noexpand\fi}%
306 >>>
307
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309 \Section{Support for ProTex}
310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311
312 \<first pass\><<<
313 \NewConfigure{ProTex}[1]{\def\a:ProTex{#1}}
314 >>>
315
316
317 \<load protex\><<<
318 \ifx \a:ProTex\:UnDef
319 \else \input ProTex.4ht \fi
320 >>>
321
322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323 \Section{Support for httex}
324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325
326
327 \<temp := auto load Preamble\><<<
328 |<util for extracting options|>
329 |<options from /tex4ht|>
330 \expandafter\expandafter\expandafter
331 \:temp\csname tex4ht\endcsname |<par del|>%
332 \ifx \:temp\relax
333 |<temp := load tex /Preample|>
334 \if:latex \let\:temp|=\empty \fi
335 \else
336 \if:latex
337 \let\config:file|=\:temp \let\:temp|=\empty
338 \else
339 \edef\:temp{\noexpand\input \:temp\space}
340 \fi \fi
341 >>>
342
343
344 \<extract tex4ht options\><<<
345 \ifx \:temp\relax
346 \let\:tempd|=\:temp
347 \let\:tempc|=\empty \config:opt #1,#2,|<par del|>%
348 \else \:temp
349 \let\:tempd|=\:temp
350 \let\:tempc|=\empty \config:opt #2,|<par del|>%
351 \fi
352 \let\config:opt|=\:tempc
353 \let\:temp|=\:tempd
354 >>>
355
356 \<util for extracting options\><<<
357 \def\:tempc#1#2.#3|<par del|>{\edef\:tempa{#3}\edef\:temp{%
358 #1\ifx \:tempa\empty .cfg\fi}}
359 \def\config:opt#1,#2|<par del|>{\def\:temp{#1}\ifx \:temp\empty
360 \else \ifx \:tempc\empty
361 \def\:tempc{#1}%
362 \else
363 \append:def\:tempc{,#1}
364 \fi\fi
365 \def\:temp{#2}\ifx \:temp\empty
366 \else \def\:temp{\config:opt #2|<par del|>}\fi
367 \:temp}
368 >>>
369
370
371
372 \<temp := load tex /Preample\><<<
373 \ifx \config:opt\:UnDef
374 \edef\config:opt{\ifx \config:file\empty html\fi}\fi
375 \def\:temp{\expandafter\expandafter\expandafter
376 \Preamble\expandafter{\config:opt}\EndPreamble}
377 >>>
378
379
380 \Section{First Pass}
381
382 \<first pass\><<<
383 \ifx \Log:Needs\:UnDef \else
384 \:warning{Again `\noexpand\input tex4ht.sty'?}\fi
385 |<check that TeX4ht is not loaded after protex|> |%still necessary?|%
386 |<define for /Preamble|>
387 |<define /Preamble|>
388 >>>
389
390
391
392 \<check if latex\><<<
393 \expandafter\ifx \csname @latex@error\endcsname\relax
394 \:latexfalse \tracingstats|=1
395 \else
396 \if:latex\else |<usepackage for latex|>\fi
397 \:latextrue
398 \ifx \:providesfile \:UnDef
399 \let\:providesfile\@providesfile
400 \def\@providesfile#1{%
401 \expandafter\ifx\csname @filelist\endcsname\relax
402 \let\@providesfile\:providesfile
403 \else \xdef\@filelist{\@filelist,#1}%
404 \fi
405 \:providesfile{#1}%
406 }
407 \fi
408 \fi
409 >>>
410
411
412
413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414 \SubSection{Start Preamble}
415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
416
417
418 \<define /Preamble\><<<
419 \def\:Preamble{\ifx \:next[%
420 \def\Preamble[##1]##2{\egroup
421 |</def/Preamble(@@2)|>\input ##1
422 }
423 \else
424 \def\Preamble##1{\egroup |</def/Preamble(@@1)|>%
425 \input |<TeX4ht name|>.sty }
426 \fi \let\:Preamble|=\:UnDef \Preamble }
427 \def\Preamble{\bgroup \catcode`\@|=12 \catcode`\_|=8 \catcode`\^|=7
428 \futurelet\:next\:Preamble}
429 >>>
430
431
432 With the following definitions we can replace
433 \`'\input tex4ht.sty \Htmltrue .... \Htmlfalse \Preamble{html,...}'
434 with \`'\input tex4ht.sty \Htmltrue .... \Preamble{...}'
435 for defining html-enabled code between the \''\input' and the
436 \''\Preamble'. That is, for using code that employs the
437 \''\ifHtml' command.
438
439
440
441 \</def/Preamble(@@1)\><<<
442 |<def :CheckOption|>%
443 \ifHtml \Htmlfalse
444 \def\Preamble{html,##1}\else \def\Preamble{##1}\fi
445 |<config options for /usepackage and httex|>%
446 |<extract Hinclude|>%
447 >>>
448
449 \</def/Preamble(@@2)\><<<
450 |<def :CheckOption|>%
451 \ifHtml \Htmlfalse
452 \def\Preamble{html,##2}\else \def\Preamble{##2}\fi
453 |<config options for /usepackage and httex|>%
454 |<extract Hinclude|>%
455 >>>
456
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 \SubSection{End Preamble}
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460
461 \<define /Preamble\><<<
462 \def\EndPreamble{\b:Preamble \global\let\missing:endpream\empty
463 \csname |<live|>\file:id\endcsname \B:DY}
464 \def\B:DY{|<html paragraph breaks at entry to file|>%
465 \HtmlEnv \IgnorePar \IgnoreIndent {\ht:everypar{}\leavevmode}\a:BODY
466 \csname a:@BODY\endcsname}
467 \def\missing:endpream{\:warning{Missing \string\EndPreamble}}
468 >>>
469
470
471 \<close html doc\><<<
472 \missing:endpream
473 >>>
474
475 \<define /Preamble\><<<
476 \NewConfigure{@HTML}[1]{\concat:config\a:@HTML{#1}}
477 \let\a:@HTML|=\empty
478 >>>
479
480 \<needs preamble\><<<
481 \:tempb
482 >>>
483
484
485 \<html config util\><<<
486 \NewConfigure{Preamble}{2}
487 >>>
488
489
490
491 \<remove garbage\><<<
492 \ifHtml \else \let\EndPreamble|=\empty \fi
493 >>>
494
495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
496 \SubSection{Selecting Preamble}
497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
498
499
500
501 \<def :CheckOption\><<<
502 \def\:CheckOption####1{\def\:temp{####1}%
503 \:Optionfalse
504 \expandafter\:ScanOptions\Preamble,,//}
505 \def\:ScanOptions####1,####2//{\def\:next{####1}%
506 \ifx \:next\empty
507 \else \ifx \:temp\:next \:Optiontrue \let\:next|=\relax
508 \else \def\:next{\:ScanOptions####2//}%
509 \fi \fi \:next }
510 >>>
511
512
513
514
515
516 \<Hinput Configs\><<<
517 \def\:temp{\def\ifOption##1}
518 \expandafter\expandafter\expandafter\:temp
519 \expandafter{\Preamble,,//\if:Option
520 |<ifOption true|>\else |<ifOption false|>\fi \tmp:toks=}
521 \pend:defI\ifOption{\def\:temp{##1}\:Optionfalse\:ScanOptions}
522 >>>
523
524
525 \<ifOption false\><<<
526 \def\:temp{%
527 \def\:temp{\the\tmp:toks}%
528 \afterassignment\:temp \tmp:toks=}%
529 \afterassignment\:temp
530 >>>
531
532
533 \<ifOption true\><<<
534 \def\:temp{\the\tmp:toks
535 \def\:temp{\tmp:toks={}}%
536 \afterassignment\:temp \tmp:toks=}%
537 \afterassignment\:temp
538 >>>
539
540
541
542 The \''\ifOption' is implemented through a token list variable to
543 allow for nesting in macros and if statements. The older definition
544 hid the \''\if' under \''\ifOption' and exposed just the
545 \''\else' and \''\fi'.
546
547
548
549
550 \<new ifs\><<<
551 \:tempa{if:Option}
552 >>>
553
554
555
556 The following code defines \`'\ifOption' just for flags defined in the
557 comamnd line (that is, flags known the first time tex4ht.sty is
558 loaded). It doesn't yet see those options introduced by \`'\Preamble'
559 and the *.4ht files.
560
561
562 \<def early latex ifOption\><<<
563 \ifx \config:opt\:UnDef \else
564 \ifx\tmp:toks\:UnDeF \csname newtoks\endcsname\tmp:toks\fi
565 \def\:temp{\def\ifOption##1}
566 \expandafter\expandafter\expandafter\:temp
567 \expandafter{\config:opt,,//\if:Option
568 |<ifOption true|>\else |<ifOption false|>\fi \tmp:toks=}
569 \pend:defI\ifOption{\def\:temp{##1}\:Optionfalse\:ScanOptions}
570 \fi
571 >>>
572
573
574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
575 \Section{LaTeX at First Pass}
576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577
578 \<first pass for latex\><<<
579 \if:latex
580 |<try taking care of hyperref.sty|>
581 |<early latex subs/sups|>
582 \fi
583 |<block package loading|>
584 |<xetex active characters|>
585 |<hook at usepackage|>
586 >>>
587
588 The following is a temporary patch, waiting fo a fix in hyperref.sty.
589
590
591 \<try taking care of hyperref.sty\><<<
592 \expandafter\def\csname [email protected]\endcsname{tex4ht}
593 >>>
594
595 \<block package loading\><<<
596 \def\:dontusepackage#1{%
597 \typeout{tex4ht warning: package #1 was prevented from loading}
598 \@namedef{ver@#1.sty}{9999/12/31}%
599 \@namedef{opt@#1.sty}{\:currentoptions}
600 }
601 >>>
602
603 Input definitions for Unicode blocks in XeLaTeX. It loads full Latin by
604 default, others must be activated using \`'xeuniuseblock{blockname}'
605
606 \<xetex active characters\><<<
607 \ifx\XeTeXversion\@undefined\else
608 \ifx\xeuniuseblock\@undefined
609 \input tuenc-xetex-input.4ht
610 \fi\fi
611 >>>
612
613 Add support for package commands redefining
614
615 \<hook at usepackage\><<<
616 \def\:AtEndOfPackage{\expandafter\g@addto@macro\csname pkg:end:hook:\@currname.sty\endcsname}
617 \def\init:package:hooks#1{\expandafter\def\csname pkg:end:hook:#1\endcsname{}}
618 \def\package:hooks#1{\csname pkg:end:hook:#1\endcsname}
619 >>>
620
621 \<hook at usepackage\><<<
622 \let\:onefilewithoptions\@onefilewithoptions
623 \def\@onefilewithoptions#1[#2][#3]#4{%
624 \init:package:hooks{#1.#4}%
625 \let\:temp\@reset@ptions
626 \def\@reset@ptions{%
627 \let\@reset@ptions\:temp
628 |<cats for usepackage|>\a:usepackage%
629 \a:usepackage:lthooks{#1}{#4}
630 |<recall usepackage cats|>}%
631 \def\:currentoptions{#2}
632 \:onefilewithoptions#1[#2][#3]{#4}\package:hooks{#1.#4}}
633 \def\a:usepackage{\input usepackage.4ht }
634 >>>
635 \<cats for usepackage\><<<
636 \edef\TivhTcats{%
637 \catcode`:=\the\catcode`:%
638 \catcode`@=\the\catcode`@}%
639 \catcode`\:=11 \catcode`\@=11
640 >>>
641
642 \<recall usepackage cats\><<<
643 \TivhTcats
644 >>>
645
646 In October 2020, LaTeX kernel added new hook support. It can be used
647 for lot of stuff, including execution of code when a package is loaded.
648 It is more efficient and clean than the current TeX4ht system of package
649 handling. We can use it to execute code before and after package loading.
650
651 Files that contain code that should be executed before the package is loaded
652 can be requested using PackageHooks configuration. It needs to be included
653 in the "add to usepackage" placeholder that is available in tex4ht-4ht.tex.
654
655 Example:
656
657 \Verbatim
658 \<add to usepackage\><<<
659 \Configure{PackageHooks}{packagename.sty}{packagename-hooks.4ht}
660 >>>
661
662 \<packagename-hooks.4ht\><<<
663 % Some stuff executed before the package is loaded
664 \:AtEndOfPackage{
665 % stuff executed after package is loaded
666 % macro redefinitions and so on
667 }
668 >>> \AddFile{9}{packagename-hooks}
669
670 \EndVerbatim
671
672 \<hook at usepackage\><<<
673 \NewConfigure{PackageHooks}[2]{\expandafter\def\csname package:hooks:#1\endcsname{\input #2}}
674 \def\a:usepackage:lthooks#1#2{%
675 \expandafter\ifcsname package:hooks:#1.#2\endcsname
676 \csname package:hooks:#1.#2\endcsname
677 \fi
678 }
679 >>>
680
681
682 %%%%%%%%%%%%%%%%%%%%%%%%%
683 \Section{Second Pass}
684 %%%%%%%%%%%%%%%%%%%%%%%%%
685
686
687 The definitions of the configurations should be ready before
688 \''\Hinput' is called for loading their values. The cross references
689 also need to be resolved at that point (for the TITLE+, and possibly
690 other usages).
691
692 \<second pass\><<<
693 |<html option|> |%should be first|%
694 |<html+nohtml common to TeX4ht and protex|>
695 |<utilities|>
696 |<cross references|>
697 \ifHtml
698 |<Hinput Configs|>
699 \Hinput{Preamble} \ht:special{t4ht.\:html}
700 |<scripting commands|>
701 |<html Configure's|>
702 \Hinput{tex4ht}
703 |<hook on end|>
704 \fi
705 |<divisions|>
706 |<files|>
707 |<cut points|>
708 |<imports|>
709 |<lists|>
710 |<blocs for tocs|>
711 \ifHtml
712 |<halign-based tables|>
713 \fi
714 |<streams|>
715 |<gif|>
716 |<fonts|>
717 |<math|>
718 |<core tex|>
719 |<at doc start|> |%after Preamble|%
720 \ifHtml
721 |<dvi-based hooks|>
722 |<more html tex|>
723 \fi
724 |<local env|> |% after accents, {\vrb:tt\`} in particular|%
725 \ifx\beginL\@undefined \else
726 \ifHtml
727 |<e tex|>
728 \Hinput{etex4ht}
729 \fi\fi
730 |<load sub tex4ht styles|>
731 |<debug|>
732 |<remove garbage|>
733 \ifHtml |<start html doc|> \fi |%should be last|%
734 >>>
735
736
737
738 \Section{Copyright Note}
739
740 \input tex4ht-cpright.tex
741
742 \<copyright\><<<
743 % tex4ht.sty (|version), generated from |jobname.tex
744 % Copyright 2009-|the|year|empty TeX Users Group
745 % Copyright |CopyYear.1996. Eitan M. Gurari
746 |<TeX4ht copywrite|>
747 >>>
748
749
750
751 \Section{Category Codes}
752
753
754 \<save cat codes\><<<
755 \expandafter\edef\csname :RestoreCatcodes\endcsname{%
756 \expandafter\ifx \csname :RestoreCatcodes\endcsname\relax\else
757 \csname :RestoreCatcodes\endcsname \fi
758 \ifnum \the\catcode`\ =10 \else
759 \catcode`\noexpand\ =\the\catcode`\ \fi
760 \ifnum \the\catcode`<=12 \else
761 \catcode`\noexpand <|=\the\catcode`<\fi
762 \ifnum \the\catcode`>=12 \else
763 \catcode`\noexpand >|=\the\catcode`>\fi
764 \ifnum \the\catcode`\?=12 \else
765 \catcode`\noexpand \?|=\the\catcode`\?\fi
766 \ifnum \the\catcode`+=12 \else
767 \catcode`\noexpand +|=\the\catcode`+\fi
768 \ifnum \the\catcode`*=12 \else
769 \catcode`\noexpand *|=\the\catcode`*\fi
770 \ifnum \the\catcode`;=12 \else
771 \catcode`\noexpand ;|=\the\catcode`;\fi
772 \ifnum \the\catcode`~=13 \else
773 \catcode`\noexpand ~|=\the\catcode`~\fi
774 \ifnum \the\catcode`$=3 \else
775 \catcode`\noexpand $|=\the\catcode`$\fi
776 \ifnum \the\catcode`&=4 \else
777 \catcode`\noexpand &|=\the\catcode`&\fi
778 \ifnum \the\catcode`\#=6 \else
779 \catcode`\noexpand \#|=\the\catcode`\#\fi
780 \catcode`\noexpand :|=\the\catcode`:%
781 \catcode`\noexpand "|=\the\catcode`"%
782 \catcode`\noexpand @|=\the\catcode`@%
783 \catcode`\noexpand _|=\the\catcode`_%
784 \catcode`\noexpand ^|=\the\catcode`^%
785 \catcode`\noexpand |||=\the\catcode`||%
786 \csname no:restore\endcsname
787 |<sp and sb for catcode 13|>%
788 \let\expandafter\noexpand\csname :RestoreCatcodes\endcsname|=
789 \noexpand\UnDefcS}
790 \catcode`~|=13 \catcode`$|=3 \catcode`&|=4 \catcode`\#|=6
791 \catcode`\:|=11 \catcode`\@|=11 \catcode`;|=12 \catcode`\ |=10
792 \catcode`\<|=12 \catcode`\>|=12 \catcode`+|=12 \catcode`*|=12
793 \catcode`\?|=12
794 |<record external sub-sup|>
795 \catcode`\^|=7 \catcode`\||=12 \catcode`"|=12
796 >>>
797
798
799
800
801
802
803 \Section{Ifs}
804
805
806 \<ifs for TeX4ht\><<<
807 \def\:temp{\csname newif\endcsname}
808 \def\:tempa#1{%
809 \expandafter\ifx \csname #1\endcsname\relax
810 \expandafter\:temp \csname #1\endcsname
811 \fi}
812 |<new ifs|>
813 \def\:tempa#1{%
814 \expandafter\ifx \csname #1\endcsname\relax
815 \expandafter\:temp \csname #1\endcsname
816 \expandafter\expandafter\expandafter\expandafter\expandafter
817 \def\expandafter\expandafter\expandafter
818 \rmv:ifs\expandafter{\rmv:ifs
819 \expandafter\let \csname #1\endcsname |= \:UnDef}
820 \fi}
821 \let\rmv:ifs|=\empty
822 |<temp tex ifs|>
823 >>>
824
825
826 The temporary ifs are needed only for loading time to allow
827 TeX to scan material that will not be loaded.
828
829
830
831 \<new ifs\><<<
832 \:tempa{if:latex}
833 >>>
834
835 \Section{User File Requests}
836
837 \<TeXivht = user file requests\><<<
838 \def\:usersty#1,#2|<par del|>{\def\:temp{#1}%
839 \ifx \:temp\empty \else
840 \expandafter\ifx \csname #1\endcsname\relax
841 \expandafter\let \csname #1\endcsname=\empty
842 \input #1
843 \fi
844 \def\:temp{#2}\expandafter\:temp
845 \fi}
846 \edef\TeXivht{\expandafter\ifx \csname TeXivht\endcsname\relax
847 \else \noexpand\:usersty\TeXivht,|<par del|>\fi
848 \let\noexpand\TeXivht|=\noexpand\:UnDef
849 \let\noexpand\:usersty|=\noexpand\:UnDef }
850 >>>
851
852
853
854
855 \Section{Usepackage Interface for LaTeX}
856
857
858 \<usepackage for latex\><<<
859 \ifx \@currname\empty
860 |<requires /Preamble.../EndPreamble|>
861 \else
862 |<TeX4ht loaded with /usepackage|>
863 \fi
864 >>>
865
866 Three ways for loading TeX4ht in LaTeX
867
868 \List{a}
869 \item With \`'\usepackage{tex4ht}'.
870
871 \Verbatim
872 \usepackage{tex4ht}
873 \begin{document}
874 \EndVerbatim
875
876 It assumes a configuration file named \`latex4ht.cfg'. If none
877 is offered, the following code is available.
878
879
880 \Verbatim
881 \Preamble{html}
882 \begin{document}
883 \EndPreamble
884 \EndVerbatim
885
886
887 \item With \`'\usepackage[file-name]{tex4ht}'. As before, but with a
888 configuration file \`'file-name', instead of in \`'latex4ht.cfg'.
889 The extension \`'.cfg' is assumed, if none is provided.
890
891 \item With inline (instead of off-line) configurartion file, e.g.,
892 like \`'\input tex4ht.sty \Preamble{html}
893 \begin{document}
894 \EndPreamble'
895
896 \EndList
897
898 The indirection below on \''\enddocument' is needed for AmsTeX; there
899 the command is defined as outer.
900
901
902
903 \<TeX4ht loaded with /usepackage\><<<
904 \ProvidesPackage{tex4ht}
905 \let\config:file|=\empty
906 |<options from /usepackage|>
907 \DeclareOption*{\load:cfg}
908 \ProcessOptions
909 \let\o:document|=\document
910 \def\document{%
911 |<check irregularities|>%
912 \ifdefined\AddToHook%
913 \def\document{\endgroup\o:document}%
914 % use new LaTeX hook system to execute \Configure{AtBeginDocument}
915 \AddToHook{begindocument/before}[tex4ht]{\csname a:AtBeginDocument\endcsname}
916 \AddToHook{begindocument/end}[tex4ht]{\csname b:AtBeginDocument\endcsname}
917 \else%
918 %\expandafter\let\csname enddocument\endcsname|=\empty
919 %\end{document}%
920 %\let\document|=\o:document
921 |<protect AtBeginDocument|>%
922 \let\document\o:document%
923 \fi%
924 \let\:latex@error|=\@latex@error
925 \def\@latex@error##1{\:latex@error{##1 in `\config:file'}}%
926 |<load latex /Preample|>%
927 \let\@latex@error|=\:latex@error
928 }
929 >>>
930
931 \<check irregularities\><<<
932 \let\ht:empty|=\:UnDef
933 \def\:temp{}\ifx \:temp\empty \else
934 \gdef\:temp{}\ifx \:temp\empty \else
935 \:warning{Redefined \string\empty?}
936 \global\let\ht:empty|=\empty \gdef\empty{}%
937 \fi\fi
938 >>>
939
940
941
942
943 \<load latex /Preample\><<<
944 |</document recall sub/sup|>%
945 \ifx \config:file\empty
946 \def\:temp{|<default latex cfg file|>}%
947 \else
948 \def\:temp{|<user config file|>}%
949 \fi \:temp
950 >>>
951
952
953
954
955
956
957 \<early Configure\><<<
958 |<concat config|>
959 \NewConfigure{AtBeginDocument}[2]{%
960 \def\:temp{#1#2}\ifx \:temp\empty
961 \concat:config\a:AtBeginDocument{}
962 \concat:config\b:AtBeginDocument{}%
963 \else
964 \concat:config\a:AtBeginDocument{#1\relax}%
965 \concat:config\b:AtBeginDocument{#2\relax}%
966 \fi
967 \global\let\a:AtBeginDocument=\a:AtBeginDocument
968 \global\let\b:AtBeginDocument=\b:AtBeginDocument
969 }
970 \Configure{AtBeginDocument}{}{}
971 >>>
972
973 \<protect AtBeginDocument\><<<
974 \let\:begindocumenthook|=\@begindocumenthook
975 \def\@begindocumenthook{\csname a:AtBeginDocument\endcsname
976 \:begindocumenthook \csname b:AtBeginDocument\endcsname }%
977 >>>
978
979
980
981
982 In optional parameters, the first one is assumed to be a
983 file name. A fake file name should be inserted, when we
984 want none.
985
986 \<default latex cfg file\><<<
987 \ifx \config:opt\:UnDef
988 \edef\config:opt{\ifx \config:file\empty html\fi}\fi
989 \expandafter\Preamble\expandafter{\config:opt
990 }\csname begin\endcsname{document}\EndPreamble
991 >>>
992
993 \''\begin' is defined as outer in texi, hence thr \''\csname'.
994
995 \<default tex cfg file\><<<
996 \ifx \config:opt\:UnDef
997 \edef\config:opt{\ifx \config:file\empty html\fi}\fi
998 \expandafter\Preamble\expandafter{\config:opt
999 }\EndPreamble
1000 >>>
1001
1002
1003 \<user config file\><<<
1004 \input \config:file\relax
1005 >>>
1006
1007 \<config options for /usepackage and httex\><<<
1008 \ifx \config:opt\:UnDef
1009 \let\:temp|=\Preamble
1010 \else
1011 \expandafter\expandafter\expandafter\def
1012 \expandafter\expandafter\expandafter\:temp
1013 \expandafter\expandafter\expandafter{%
1014 \expandafter\config:opt\expandafter,\Preamble}%
1015 \fi
1016 \let\Preamble|=\empty
1017 \expandafter\set:Preamble\:temp,|<par del|>%
1018 >>>
1019
1020
1021 The following removes duplications in \''\Preamble'. Important, in
1022 particular, when 4ht configuration files are included in the
1023 list of options.
1024
1025 \<define for /Preamble\><<<
1026 \def\set:Preamble#1,#2|<par del|>{%
1027 \def\:temp{#1}\ifx \:temp\empty \else
1028 \:CheckOption{#1}\if:Option \else
1029 \ifx \Preamble\empty \def\Preamble{#1}%
1030 \else \append:def\Preamble{,#1}%
1031 \fi \fi \fi
1032 \def\:temp{#2}\ifx \:temp\empty \let\set:Preamble|=\:UnDef
1033 \else \expand:after{\set:Preamble#2|<par del|>}\fi
1034 }
1035 >>>
1036
1037
1038 \''\ProcessOptions' calls \''\cfg:fl' repeatedly for each option.
1039
1040 \List{}
1041 \item{Empty, or Cfg File}
1042
1043 \<options from /usepackage\><<<
1044 \def\load:cfg{|<2nd option|>%
1045 \def\:temp{\expandafter\cfg:fl\CurrentOption.|<par del|>}%
1046 \def\:tempa{html}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1047 \def\:tempa{xhtml}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1048 \def\:tempa{htm}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1049 \def\:tempa{htm3}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1050 \def\:tempa{htm4}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1051 \def\:tempa{htm5}\ifx \:tempa\CurrentOption \let\:temp|=\load:cfg \fi
1052 \:temp
1053 }
1054 \def\cfg:fl#1.#2|<par del|>{\edef\:tempa{#2}\edef\config:file{%
1055 \CurrentOption \ifx \:tempa\empty .cfg\fi}}
1056 >>>
1057
1058 \<options from /tex4ht\><<<
1059 \def\:temp#1,#2|<par del|>{%
1060 \def\:temp{\:tempc{#1}#1.|<par del|>}%
1061 \def\:tempb{#1}\ifx \:tempb\empty \let\:temp|=\relax \fi
1062 \def\:tempa{html}\ifx \:tempa\:tempb \let\:temp|=\relax \fi
1063 \def\:tempa{xhtml}\ifx\:tempa\:tempb \let\:temp|=\relax \fi
1064 \def\:tempa{htm}\ifx \:tempa\:tempb \let\:temp|=\relax \fi
1065 \def\:tempa{htm3}\ifx \:tempa\:tempb \let\:temp|=\relax \fi
1066 \def\:tempa{htm4}\ifx \:tempa\:tempb \let\:temp|=\relax \fi
1067 \def\:tempa{htm5}\ifx \:tempa\:tempb \let\:temp|=\relax \fi
1068 |<extract tex4ht options|>%
1069 }
1070 >>>
1071
1072
1073 \item{First Option for /Preamble}
1074
1075 \<2nd option\><<<
1076 \def\load:cfg{\let\config:opt|=\CurrentOption
1077 |<options 3...|>}%
1078 >>>
1079
1080 \item{Non-First Option for /Preamble}
1081
1082 \<options 3...\><<<
1083 \def\load:cfg{\edef\config:opt{\config:opt,\CurrentOption}}%
1084 >>>
1085
1086 \EndList
1087
1088
1089
1090 \def\gt:laopt#1,#2|<par del|>{\def\:temp{#1}\ifx \:temp\empty
1091 \else \cfg:fl#1.|<par del|>\fi
1092 \def\:temp{#2}\ifx \:temp\empty \else \let\config:opt|=\:temp \fi}
1093
1094
1095
1096
1097 The following case arises for loading the
1098 file with the \`'\input tex4ht.sty' command.
1099
1100 \<requires /Preamble.../EndPreamble\><<<
1101 \def\:temp{\ifx \HCode\:UnDef
1102 \:warning{Missing \string\Preamble...\string\EndPreamble?}\fi}
1103 \edef\:tempa{%
1104 \noexpand\expandafter
1105 \noexpand\expandafter
1106 \noexpand\expandafter
1107 \noexpand \def
1108 \noexpand\expandafter
1109 \noexpand\expandafter
1110 \noexpand\expandafter
1111 \expandafter\noexpand\csname enddocument\endcsname
1112 \noexpand\expandafter
1113 \noexpand\expandafter
1114 \noexpand\expandafter
1115 {\noexpand \expandafter
1116 \noexpand \:temp
1117 \expandafter\noexpand \csname enddocument\endcsname
1118 }%
1119 } \:tempa
1120 >>>
1121
1122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 \Section{Utilities}
1124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1125
1126
1127 \<html utilities\><<<
1128 \csname newskip\endcsname\tmp:dim
1129 >>>
1130
1131
1132 \<early utilities\><<<
1133 |<def Configure|>
1134 |<early Configure|>
1135 >>>
1136
1137
1138
1139
1140 \<utilities\><<<
1141 |<general utilities|>
1142 \ifHtml |<html utilities|> \fi
1143 >>>
1144
1145 There are files, like mathml.4ht, that need to be loaded piecewise
1146 because the configuration commands might vary during the loading time.
1147 For instance, the \`'\Configure{cases}' uses two parameters in plain
1148 tex, and the go up into four parameters in amstex.
1149
1150 \<first pass\><<<
1151 \let\:Hincl|=\empty
1152 \def\Hinclude[#1]#2{\xdef\:Hincl{\:Hincl{#1}{#2}}}
1153 >>>
1154
1155
1156
1157 The following extracts \''\Hinclude' frm preamble. For instance,
1158 \''\Preamble{mathml.4ht,foo.4ht,...}' is the same as
1159 \''\Hinclude[*]{mathml.4ht}\Hinclude{foo.4ht}\Preamble{...}'. The
1160 file extensions must be \''.4ht'.
1161
1162 \<extract Hinclude\><<<
1163 \def\:temp####1.4ht####2|<par del|>{\def\:temp{####2}%
1164 \ifx \:temp\empty
1165 \def\:temp{th4}\ifx \:temp\Preamble \else
1166 \ht:special{t4ht@[}%
1167 \input tex4ht.4ht \ht:special{t4ht@]}%
1168 \fi \fi}%
1169 \expandafter\:temp\Preamble.4ht|<par del|>%
1170 \expandafter\xtrct:hin\Preamble,,|<par del|>%
1171 |<redefine Hinclud|>%
1172 >>>
1173
1174
1175
1176 \<define for /Preamble\><<<
1177 \def\xtrct:hin#1,{\def\:temp{#1}\ifx \:temp\empty
1178 \def\xtrct:hin##1|<par del|>{\let\xtrct:hin|=\:UnDef}\else
1179 \def\:tempa##1.4ht##2|<par del|>{%
1180 \def\:temp{\Hinclude[*]{##1.4ht}}\def\:tempa{##2}}%
1181 \expandafter\:tempa\:temp .4ht|<par del|>%
1182 \ifx \:tempa\empty \else \:temp \fi
1183 \fi \xtrct:hin}
1184 >>>
1185
1186
1187 Until \''\Preamble' is encountered, \''\Hinclude' requrests
1188 `vertiv=cal' 4ht files (html4,html0, mathml, unicode,...), during
1189 \''\Preamble' if requests `horizontal' files (latex, plain,etc), and
1190 after the \''\Preamble' it is undefined.
1191
1192
1193
1194 \<redefine Hinclud\><<<
1195 \:Hinclude
1196 >>>
1197
1198 \<define for /Preamble\><<<
1199 \def\Use:N{0}
1200 \let\:USE|=\empty
1201 \def\:Use#1{\:USe #1,,\HAdvance\Use:N |by 1 }
1202 \def\:USe#1,{\def\:temp{#1}\ifx\:temp\empty
1203 \edef\:temp{\noexpand\append:def\noexpand\:USE{\let\expandafter
1204 \noexpand\csname Use:\Use:N\endcsname\noexpand\:UnDef}}\:temp
1205 \else
1206 \edef\:temp{\noexpand\append:def\noexpand\:USE{\expandafter
1207 \noexpand\csname Use:\Use:N\endcsname}}\:temp
1208 \append:def\:USE{{#1}}%
1209 \expandafter\:USe\fi}
1210 \def\:Hinclude{%
1211 \def\Hinclude{\afterassignment\:Use
1212 \expandafter\def\csname Use:\Use:N\endcsname ####1}%
1213 \def\:Hinclude{\ifx \:USE \empty
1214 \let\Hinclude|=\:UnDef
1215 \let\:Hinclude|=\:UnDef
1216 \let\:Use|=\:UnDef
1217 \let\:USe|=\:UnDef
1218 \let\:USE|=\:UnDef
1219 \else
1220 \pend:def\:USE{\let\:USE|=\empty}%
1221 \expand:after{\:USE \:Hinclude}\fi}%
1222 }
1223 >>>
1224
1225
1226
1227
1228 Do we want the push/pop below?
1229
1230
1231 \<Hinput Configs\><<<
1232 \let\:Hin|=\empty
1233 \def\Hinput#1{\PushStack\:Hinputs\:Hin \def\:Hin{#1}%
1234 \expandafter\:Hinput\:Hincl{}{}\PopStack\:Hinputs\:Hin}
1235 \def\:Hinput#1#2{\def\:temp{#2}\ifx \:temp\empty \else
1236 \let\:temp|=\empty \def\:tempa{*}\def\:tempb{#1}%
1237 \ifx \:tempa\:tempb \def\:temp{\input #2}%
1238 \else \ifx \:Hin\:tempb \def\:temp{\input #2}%
1239 \else \def\:tempb{#1.4ht}\ifx \:Hin\:tempb \def\:temp{\input #2}%
1240 \fi\fi\fi
1241 \expand:after{\:temp
1242 |<system NewConfigure|>\:Hinput}\fi}
1243 >>>
1244
1245
1246
1247
1248
1249 \<html utilities\><<<
1250 \def\exit:ifnot#1{%
1251 \edef\:temp{\def\noexpand\:temp####1,\:Hin,####2..//{%
1252 \noexpand\if !####2!\noexpand\else
1253 \noexpand\expandafter\noexpand\:gobble\noexpand\fi
1254 }\noexpand\:temp,#1,\:Hin,..//}\:temp\endinput }
1255 >>>
1256
1257 \<html utilities\><<<
1258 \catcode`\@|=0
1259 \catcode`\\|=12
1260 @def@ConfigureHinput{%
1261 @def@:temp##1{%
1262 @def@:temp{##1}@ifx@:temp@:Hin @else @:tempb @fi }%
1263 @def@:tempb{@fi@bgroup @no:catcodes0{255}{12}%
1264 @no:catcodes{101}{101}{11}%
1265 @no:catcodes{109}{109}{11}%
1266 @no:catcodes{112}{112}{11}%
1267 @no:catcodes{116}{116}{11}%
1268 @no:catcodes{121}{121}{11}%
1269 @:tempa}
1270 @def@:tempa##1\empty\empty\empty\empty\empty\empty{@egroup}%
1271 @:temp
1272 }
1273 @catcode`@\=0
1274 \catcode`\@=11
1275 >>>
1276
1277
1278
1279
1280
1281 \<early utilities\><<<
1282 \catcode`\#=12 \def\#{#} \catcode`\#=6
1283 >>>
1284
1285 The starred command is for immediate expansion
1286
1287 Can we avoid the following file?
1288
1289 \<general utilities\><<<
1290 \immediate\openout15=\jobname.tmp
1291 \bgroup \escapechar=`\\
1292 \immediate\write15{\def\string\Jobname{\jobname}}
1293 \egroup
1294 \immediate\closeout15
1295 \input \jobname.tmp
1296
1297 \def\get:input#1{%
1298 \openin15=#1
1299 \ifeof15 \closein15 \:warning{No file #1}%
1300 \else \closein15 \expand:after{\input #1 }%
1301 \fi}
1302 >>>
1303
1304
1305 \<general utilities\><<<
1306 \def\if:notempty#1#2{%
1307 \def\:temp{#1}\ifx \:temp\empty \else \expand:after{#2}\fi }
1308 >>>
1309
1310
1311 \Chapter{Configurations}
1312
1313
1314 \Section{Contributes}
1315
1316
1317 \<early utilitiesNO\><<<
1318 \long\def\Contribute#1#2{%
1319 \expandafter\ifx \csname :#1:\endcsname\relax
1320 \:warning{\string\Contribute{#1}?}\fi
1321 \long\expandafter\def\csname :#1:\endcsname{#2}}
1322 >>>
1323
1324 \<utilitiesNO\><<<
1325 \long\def\Contribute#1#2{%
1326 \expandafter\ifx \csname :#1:\endcsname\relax
1327 \:warning{\string\Contribute{#1}?}\else
1328 \long\expandafter\def\csname :#1:\endcsname{#2}\fi }
1329 >>>
1330
1331
1332 \Section{Configurations}
1333
1334
1335 \SubSection{Configure}
1336
1337
1338
1339 The following assumes a definition \`'\Odef\c:#2:[#1]...'
1340
1341 \<def Configure\><<<
1342 \def\Configure#1{%
1343 \expandafter\ifx \csname c:#1:\endcsname\relax
1344 \:warning{\string\Configure{#1}?}
1345 \fi
1346 \csname c:#1:\endcsname}
1347 \let\c:def|=\def
1348 \let\d:def|=\def
1349 >>>
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360 \SubSection{NewConfigure}
1361
1362
1363
1364
1365
1366
1367
1368 \<def Configure\><<<
1369 \def\NewConfigure#1{\def\:tempa{#1}\futurelet\:temp\Nw:cnf}
1370 \def\Nw:cnf{\ifx [\:temp \edef\:tempa{\noexpand\N:wCnfga{\:tempa}}\else
1371 \edef\:tempa{\noexpand\N:wCnfgb{\:tempa}}\fi \:tempa}
1372 \def\N:wCnfga#1[#2]{%
1373 \edef\:temp{|</long/def/c:...:|>}\:temp }
1374 \def\N:wCnfgb#1#2{%
1375 \edef\:temp{|</long/def/c:...:|>{\New:Conf{\aNew:Conf#1}{####1}%
1376 \ifnum #2>1 \New:Conf{\bNew:Conf#1}{####2}\fi
1377 \ifnum #2>2 \New:Conf{\cNew:Conf#1}{####3}\fi
1378 \ifnum #2>3 \New:Conf{\dNew:Conf#1}{####4}\fi
1379 \ifnum #2>4 \New:Conf{\eNew:Conf#1}{####5}\fi
1380 \ifnum #2>5 \New:Conf{\fNew:Conf#1}{####6}\fi
1381 \ifnum #2>6 \New:Conf{\gNew:Conf#1}{####7}\fi
1382 \ifnum #2>7 \New:Conf{\hNew:Conf#1}{####8}\fi
1383 \ifnum #2>8 \New:Conf{\iNew:Conf#1}{####9}\fi
1384 }}\:temp}
1385 >>>
1386
1387 \</long/def/c:...:\><<<
1388 \long\def\expandafter
1389 \noexpand\csname c:#1:\endcsname####1%
1390 \ifnum #2>1 ####2\fi \ifnum #2>2 ####3\fi
1391 \ifnum #2>3 ####4\fi \ifnum #2>4 ####5\fi
1392 \ifnum #2>5 ####6\fi \ifnum #2>6 ####7\fi
1393 \ifnum #2>7 ####8\fi \ifnum #2>8 ####9\fi
1394 >>>
1395
1396
1397
1398
1399
1400 \<def Configure\><<<
1401 \def\New:Conf#1{\noexpand\c:def
1402 \expandafter\noexpand\csname#1\endcsname}%
1403 \def\c:NewConfigure:#1#2#3#4#5#6#7#8#9{%
1404 \def\aNew:Conf{#1}\def\bNew:Conf{#2}\def\cNew:Conf{#3}%
1405 \def\dNew:Conf{#4}\def\eNew:Conf{#5}\def\fNew:Conf{#6}%
1406 \def\gNew:Conf{#7}\def\hNew:Conf{#8}\def\iNew:Conf{#9}}
1407 |<system NewConfigure|>
1408 >>>
1409
1410
1411 After each loading of the vertical 4ht files, the coefficients
1412 of newconfigure assume their initial definitions.
1413
1414 \<system NewConfigure\><<<
1415 \Configure{NewConfigure}{a:}{b:}{c:}{d:}{e:}{f:}{g:}{h:}{i:}%
1416 >>>
1417
1418
1419
1420 \Section{Tracing Configurations}
1421
1422
1423
1424 See also LaTeX part
1425
1426
1427 \<trace configurations\><<<
1428 \:CheckOption{hooks++} \if:Option
1429 |<trace+ comamnds|>
1430 \def\edit:p#1#2{\let#2|=\empty \:gobble}%
1431 \else \:CheckOption{hooks+} \if:Option
1432 \def\trc:wrt{\writesixteen}
1433 \else \:CheckOption{hooks} \if:Option
1434 \let\trc:wrt|=\:gobble
1435 \fi\fi
1436 \if:Option
1437 |<trace commands|>
1438 \let\edit:p|=\empty
1439 \fi \fi
1440 \if:Option
1441 |<trace and trace+|>
1442 \NewConfigure{hooks}[4]{\def\a:trc{#1}\def\b:trc{#2}%
1443 \def\c:trc{#3}\def\d:trc{#4}%
1444 \ifx \a:trc\empty \def\a:trc##1\b:trc{\b:trc}\fi
1445 \ifx \c:trc\empty \def\c:trc##1\d:trc{\d:trc}\fi
1446 }
1447 \def\d:def{\advance\tmp:cnt |by1\def}
1448 \Configure{hooks}{}{}{}{}
1449 \else
1450 \let\c:hooks:|=\:gobbleIV
1451 |<no trace and trace+|>
1452 \fi
1453 >>>
1454
1455 \<trace+ comamnds\><<<
1456 \pend:defI\Configure{\tmp:cnt|=0
1457 \long\def\c:def####1####2{\advance\tmp:cnt |by1
1458 |<tempb = number of parameters|>
1459 \def####1{####2}%
1460 \edef\:temp{\noexpand\pend:def\noexpand####1{\noexpand\ifx
1461 \noexpand\EndPicture\noexpand\:UnDef \hbox{\noexpand\a:trc
1462 ##1\the\tmp:cnt :\:tempb\noexpand\b:trc}\noexpand\fi}}\:temp
1463 \edef\:temp{\noexpand\append:def\noexpand####1{\noexpand\ifx
1464 \noexpand\EndPicture\noexpand\:UnDef\hbox{\noexpand\c:trc
1465 ##1\the\tmp:cnt :\:tempb\noexpand\d:trc}\noexpand\fi}}\:temp
1466 }}
1467 >>>
1468
1469
1470 \<trace commands\><<<
1471 \pend:defI\Configure{\tmp:cnt|=0
1472 \long\def\c:def####1####2{\advance\tmp:cnt |by1
1473 |<tempb = number of parameters|>
1474 \def####1{####2}%
1475 \ifx ####1\empty
1476 \edef\:temp{\noexpand\pend:def\noexpand####1{\hbox{\noexpand
1477 \a:trc ##1\the\tmp:cnt :\:tempb\noexpand\b:trc}}}\:temp
1478 \edef\:temp{\noexpand\append:def\noexpand####1{\hbox{\noexpand
1479 \c:trc ##1\the\tmp:cnt :\:tempb\noexpand\d:trc}}}\:temp
1480 \else
1481 \trc:wrt{...##1\the\tmp:cnt....\meaning####1}%
1482 \fi
1483 }}
1484 >>>
1485
1486 \<trace and trace+\><<<
1487 \edef\:tempb{\def\noexpand
1488 \par:N##1\string :##2->##3////{\noexpand\par:NN?##2//}}
1489 \:tempb
1490 \def\par:NN#1#2//{\def\:tempb{#2}\ifx\:tempb\empty
1491 \def\:tempb{#1}\else \def\:tempb{\par:NN#2//}\expandafter\:tempb\fi}
1492 >>>
1493
1494 \<tempb = number of parameters\><<<
1495 \edef\:tempb{\expandafter \meaning\csname c:##1:\endcsname}%
1496 \expandafter\par:N \:tempb////%
1497 >>>
1498
1499
1500
1501
1502
1503 \Section{Editing and Xml}
1504
1505
1506
1507
1508
1509 Note that \`'edit' is not the option \`'tty'!
1510
1511
1512
1513 \<trace configurations\><<<
1514 \def\Tg<#1>{%
1515 \expandafter\ifx
1516 \csname\try:tagend <#1</|<par del|>\endcsname\is:empty
1517 \:tagend#1|<par del|>\else
1518 \expandafter\ifx
1519 \csname\try:tagempty #1>/>|<par del|>\endcsname\is:empty
1520 \:tag{#1}\else \:tagempty #1>\fi\fi}
1521 \def\try:tagend#1</#2|<par del|>{#1is:empty}
1522 \def\try:tagempty#1/>#2|<par del|>{#2is:empty}
1523 \def\is:empty{\empty\empty}
1524 \:CheckOption{edit} \if:Option
1525 |<tg and TG|>
1526 |<edit* option|>
1527 \else
1528 |<no-edit tg and TG|>
1529 \:CheckOption{verify}\if:Option\else \:CheckOption{verify+}\fi
1530 \if:Option
1531 |<edit- code|>
1532 \else
1533 |<no-edit option|>
1534 \fi
1535 \fi
1536 >>>
1537
1538 The \''\tg' is also part of mex.
1539
1540 \<tg and TG\><<<
1541 % \def\tg<#1>{\c:edit#1\d:edit}
1542 \def\TG<#1>{\a:edit#1\b:edit}
1543 >>>
1544
1545 \<no-edit tg and TG\><<<
1546 % \def\tg<#1>{<#1>}
1547 \def\TG<#1>{\HCode{<#1>}}
1548 >>>
1549
1550
1551
1552 The \`'edit+' is a pseudo-browser mode showing a possible
1553 view of the code.
1554
1555 \<no-edit option\><<<
1556 \def\:tag#1{\hbox{\HCode{<#1>}}}
1557 \def\:tagend#1#2|<par del|>{\hbox{\HCode{</#2>}}}
1558 \def\:tagempty#1/>{\hbox{\HCode{<#1/>}}}
1559 \expandafter\def\csname c:<:\endcsname#1>{\:gobbleII}
1560 >>>
1561
1562
1563 The \`'\hbox' above is to avoid creating extra paragraphs with
1564 extra tags, which can also introduce extra paragraph ends.
1565
1566 The definiions of \''\c:<...>:' are broken into two parts
1567 to avoid the spaces after the closing angular bracket \''>'.
1568
1569 \<edit+ option\><<<
1570 \def\tag:of#1 #2|<par del|>{#1}
1571 \def\pl:s{+}
1572 \def\:tag#1{\VerifyOpen{#1}\expandafter\ifx
1573 \csname A:\tag:of#1 |<par del|>\endcsname\pl:s\else
1574 \hbox{\a:edit\HCode{#1}\b:edit}%
1575 \fi \csname B:\tag:of#1 |<par del|>\endcsname
1576 }
1577 \def\:tagend#1#2|<par del|>{\VerifyClose{#2}\expandafter\ifx
1578 \csname A:/\tag:of#2 |<par del|>\endcsname\pl:s\else
1579 \hbox{\a:edit\HCode{/#2}\b:edit}%
1580 \fi \csname B:/\tag:of#2 |<par del|>\endcsname
1581 }
1582 \def\:tagempty#1/>{\VerifyEmpty{#1}\expandafter\ifx
1583 \csname A:\tag:of#1 |<par del|>/\endcsname\pl:s\else
1584 \hbox{\a:edit\HCode{#1/}\b:edit}%
1585 \fi \csname B:\tag:of#1 |<par del|>/\endcsname
1586 }
1587 \expandafter\def\csname c:<:\endcsname#1>{\edef\:temp{#1}\:gat}
1588 \long\def\:gat#1#2{\expandafter
1589 \def\csname A:\:temp\endcsname{#1}%
1590 \expandafter\def\csname B:\:temp\endcsname{#2}}
1591 \NewConfigure{edit}{4}
1592 \Configure{edit}{\HCode{<strong class="edit">&lt;}}
1593 {\HCode{&gt;</strong>}}
1594 >>>
1595
1596
1597 \<edit option\><<<
1598 \def\tag:of#1 #2|<par del|>{#1}
1599 \def\:tag#1{\csname A:\tag:of#1 |<par del|>\endcsname
1600 \VerifyOpen{#1}\a:edit\HCode{#1}\b:edit
1601 \csname B:\tag:of#1 |<par del|>\endcsname
1602 }
1603 \def\:tagend#1#2|<par del|>{\csname A:/\tag:of#2 |<par del|>\endcsname
1604 \VerifyClose{#2}\a:edit\HCode{/#2}\b:edit
1605 \csname B:/\tag:of#2 |<par del|>\endcsname
1606 }
1607 \def\:tagempty#1/>{\csname A:\tag:of#1 |<par del|>/\endcsname
1608 \VerifyEmpty{#1}\a:edit\HCode{#1/}\b:edit
1609 \csname B:\tag:of#1 |<par del|>/\endcsname
1610 }
1611 \expandafter\def\csname c:<:\endcsname#1>{\edef\:temp{#1}\:gat}
1612 \long\def\:gat#1#2{\expandafter
1613 \def\csname A:\:temp\endcsname{#1}%
1614 \expandafter\def\csname B:\:temp\endcsname{#2}}
1615 \NewConfigure{edit}{4}
1616 \Configure{edit}{\HCode{<strong>&lt;}}{\HCode{&gt;</strong>}}
1617 {<strong>&lt;}{&gt;</strong>}
1618 >>>
1619
1620 \<edit- code\><<<
1621 \def\:tag#1{\VerifyOpen{#1}\hbox{\HCode{<#1>}}}
1622 \def\:tagend#1#2|<par del|>{\VerifyClose{#2}\hbox{\HCode{</#2>}}}
1623 \def\:tagempty#1/>{\VerifyEmpty{#1}\hbox{\HCode{<#1/>}}}
1624 \expandafter\def\csname c:<:\endcsname#1>{\:gobbleII}
1625 >>>
1626
1627
1628 The \`'\hbox' above is to avoid creating extra paragraphs with
1629 extra tags, which can also introduce extra paragraph ends.
1630
1631
1632
1633
1634 \<edit* option\><<<
1635 \def\tag:of#1 #2|<par del|>{#1}
1636 \def\mn:s{-}
1637 \def\:tag#1{\VerifyOpen{#1}\expandafter\ifx
1638 \csname A:\tag:of#1 |<par del|>\endcsname\mn:s\else
1639 \csname A:\tag:of#1 |<par del|>\endcsname
1640 \hbox{\a:edit\HCode{#1}\b:edit}%
1641 \fi \csname B:\tag:of#1 |<par del|>\endcsname
1642 }
1643 \def\:tagend#1#2|<par del|>{\VerifyClose{#2}\expandafter\ifx
1644 \csname A:/\tag:of#2 |<par del|>\endcsname\mn:s\else
1645 \csname A:/\tag:of#2 |<par del|>\endcsname
1646 \hbox{\a:edit\HCode{/#2}\b:edit}%
1647 \fi \csname B:/\tag:of#2 |<par del|>\endcsname
1648 }
1649 \def\:tagempty#1/>{\VerifyEmpty{#1}\expandafter\ifx
1650 \csname A:\tag:of#1 |<par del|>/\endcsname\mn:s\else
1651 \csname A:\tag:of#1 |<par del|>/\endcsname
1652 \hbox{\a:edit\HCode{#1/}\b:edit}%
1653 \fi \csname B:\tag:of#1 |<par del|>/\endcsname
1654 }
1655 \expandafter\def\csname c:<:\endcsname#1>{\edef\:temp{#1}\:gat}
1656 \long\def\:gat#1#2{\expandafter
1657 \def\csname A:\:temp\endcsname{#1}%
1658 \expandafter\def\csname B:\:temp\endcsname{#2}}
1659 \NewConfigure{edit}{4}
1660 >>>
1661
1662
1663 \Section{Logical commands}
1664
1665 \<html Configure's\><<<
1666 \def\InsertTagStart#1#2{%
1667 \edef\local:properties{\ifx\relax#2\relax\else\space#2\fi}
1668 \HCode{<\get:tag{#1}\get:block:properties{#1}\local:properties>}%
1669 }
1670 \def\InsertTagEnd#1{\HCode{</\get:tag{#1}>}}
1671
1672 \long\def\InlineElementStart#1#2{\InsertTagStart{#1}{#2}}
1673 \long\def\InlineElementEnd#1{\InsertTagEnd{#1}}
1674
1675 \long\def\BlockElementStart#1#2{\ifvmode\IgnorePar\fi\EndP\InsertTagStart{#1}{#2}}
1676 \long\def\BlockElementEnd#1{\ifvmode\IgnorePar\fi\EndP\InsertTagEnd{#1}}
1677
1678 % define default values for a new logical block
1679 \def\NewLogicalBlock#1{%
1680 \SetTag{#1}{span}%
1681 \expandafter\def\csname #1:properties\endcsname{}
1682 }
1683
1684 \def\SetTag#1#2{\expandafter\xdef\csname #1:tagname\endcsname{#2}}
1685 \def\get:tag#1{\expandafter\expandafter\csname #1:tagname\endcsname}
1686
1687 \def\SetBlockProperty#1#2#3{%
1688 \expandafter\ifcsname #1:property:#2\endcsname\else%
1689 \expandafter\edef\csname #1:properties\endcsname{\csname #1:properties\endcsname\space\csname #1:property:#2\endcsname }
1690 \fi%
1691 \expandafter\def\csname #1:property:#2\endcsname{#2="#3"}
1692 }
1693
1694 \def\get:block:properties#1{%
1695 \expandafter\csname #1:properties\endcsname%
1696 }
1697
1698 >>>
1699
1700 \Section{Verify Elements}
1701
1702 \<html Configure's\><<<
1703 \:CheckOption{verify} \if:Option
1704 |<chk no trace|>
1705 \else \:CheckOption{verify+} \if:Option
1706 |<chk trace|>
1707 \fi \fi
1708 \if:Option
1709 |<check utilities|>
1710 \else
1711 \let\VerifyOpen|=\:gobble
1712 \let\VerifyClose|=\:gobble
1713 \let\VerifyEmpty|=\:gobble
1714 \long\def\Verify#1\EndVerify{}
1715 \def\trace:chk#1 #2|<par del|>{}
1716 \fi
1717 >>>
1718
1719 \<chk no trace\><<<
1720 \let\:chk:trc|=\:gobble
1721 >>>
1722
1723 \<chk trace\><<<
1724 \def\:chk:trc#1{%
1725 \writesixteen{\the\inputlineno\space(\:ChkLevel) #1}}
1726 >>>
1727
1728 The \`'\PushStack\:CHK\empty' is needed because whenever a pop occurs,
1729 we temporarily take one more pop to check who was the old parent.
1730
1731 \<check utilities\><<<
1732 \HAssign\:ChkLevel|=0
1733 \let\:CurrentChk|=\empty
1734 \PushStack\:CHK\empty
1735 \def\VerifyOpen#1{\Protect\trace:chk#1 |<par del|>}
1736 \def\trace:chk#1 #2|<par del|>{%
1737 \gHAdvance\:ChkLevel |by 1 \:chk:trc{Open......#1}%
1738 \expandafter\ifx \csname #1Level:\endcsname\relax
1739 \expandafter\gHAssign\csname #1Level:\endcsname|=0
1740 \fi
1741 \expandafter\gHAdvance\csname #1Level:\endcsname |by 1
1742 \PushStack\:CHK{#1}%
1743 \expandafter\ifx \csname \:CurrentChk +#1\endcsname\relax
1744 \expandafter\gdef \csname \:CurrentChk +#1\endcsname{}%
1745 \writesixteen{\the\inputlineno.
1746 --- warning --- \:CurrentChk\space --> #1 ?}%
1747 \fi
1748 \xdef\:CurrentChk{#1}%
1749 }
1750 \def\VerifyClose#1{\Protect\trace:endchk#1 |<par del|>}
1751 \def\trace:endchk#1 #2|<par del|>{%
1752 \:chk:trc{Close......#1}%
1753 \expandafter\ifx \csname #1Level:\endcsname\relax
1754 \writesixteen{\the\inputlineno.
1755 --- warning --- </#1> witout <#1>}%
1756 \expandafter\gHAssign\csname #1Level:\endcsname|=0
1757 \else
1758 \expandafter\gHAdvance\csname #1Level:\endcsname |by -1
1759 \gHAdvance\:ChkLevel |by -1
1760 \PopStack\:CHK\:temp
1761 \edef\:tempa{#1}%
1762 \ifx \:temp\:tempa
1763 \PopStack\:CHK\:CurrentChk
1764 \PushStack\:CHK\:CurrentChk
1765 \else
1766 \writesixteen{\the\inputlineno.
1767 --- warning --- </\:temp> instead of </#1>}%
1768 \fi
1769 \fi
1770 }
1771 \def\VerifyEmpty#1{\Protect\trace:emptychk#1 |<par del|>}
1772 \def\trace:emptychk#1 #2|<par del|>{%
1773 \:chk:trc{Empty......#1}%
1774 \expandafter \ifx \csname \:CurrentChk +#1\endcsname\relax
1775 \expandafter\gdef \csname \:CurrentChk +#1\endcsname{}%
1776 \writesixteen{\the\inputlineno.
1777 --- warning --- \:CurrentChk\space --> #1 ?}%
1778 \fi
1779 }
1780 \begingroup
1781 \catcode`\^|=7
1782 \gdef\Verify{\bgroup \catcode`\ |=9 \catcode`\^^M|=9 \:dtd}
1783 \endgroup
1784 \def\:dtd#1\EndVerify{\egroup\dtd:rule#1,-->,}
1785 \def\dtd:rule#1-->#2,{\def\:temp{#1#2}\ifx \:temp\empty\else
1786 \expandafter\gdef \csname #1+#2\endcsname{}%
1787 \expandafter\dtd:rule
1788 \fi}
1789 >>>
1790
1791
1792 \Chapter{Html Environment}
1793
1794 \Section{Initiating}
1795
1796
1797 The \`'\special{t4ht.\:html}' gives the extension to the root file. To
1798 be recognized, Must appear before the openning of any file, and
1799 outputing of any content.
1800
1801 \<html option\><<<
1802 \def\:tempa#1#2#3#4|<par del|>{#1#2#3}
1803 \:CheckOption{htm} \if:Option
1804 \edef\:html{\expandafter\:tempa\:html\empty\empty|<par del|>}
1805 |<base 2 names for htm|>
1806 \else \:CheckOption{htm5} \if:Option
1807 \edef\:html{\expandafter\:tempa\:html\empty\empty|<par del|>}
1808 |<base 5 names for htm|>
1809 \else \:CheckOption{htm4} \if:Option
1810 \edef\:html{\expandafter\:tempa\:html\empty\empty|<par del|>}
1811 |<base 4 names for htm|>
1812 \else \:CheckOption{htm3} \if:Option
1813 \edef\:html{\expandafter\:tempa\:html\empty\empty|<par del|>}
1814 |<base 3 names for htm|>
1815 \else \:CheckOption{xhtml} \if:Option
1816 \let\j:bname|=\jobname
1817 \else \:CheckOption{html}
1818 \if:Option \let\j:bname|=\jobname \fi
1819 \fi \fi \fi \fi \fi
1820 \if:Option
1821 |% \ht:special{t4ht.\:html} |%
1822 |<default html env|>
1823 |<disregard html:par from protex|>
1824 |<html TeX4ht protex|>
1825 \fi
1826 >>>
1827
1828
1829
1830 \<first pass\><<<
1831 \NewConfigure{ext}[1]{%
1832 \def\:temp##1ext=##2,##3|<par del|>{%
1833 \if !##2!\edef\:html{#1}%
1834 \else \edef\:html{##2}\fi}%
1835 \expandafter\:temp\Preamble ,ext=,|<par del|>
1836 }
1837 \Configure{ext}{html}
1838 >>>
1839
1840 \<base 2 names for htm\><<<
1841 \def\:temp#1#2#3|<par del|>{\def\j:bname{#1\ifx ?#2\else #2\fi}}
1842 \expandafter\:temp \jobname ?|<par del|>
1843 >>>
1844
1845 \<base 3 names for htm\><<<
1846 \def\:temp#1#2#3#4|<par del|>{\def\j:bname{#1\ifx ?#2\else
1847 #2\ifx ?#3\else #3\fi\fi}}
1848 \expandafter\:temp \jobname ??|<par del|>
1849 >>>
1850
1851 \<base 4 names for htm\><<<
1852 \def\:temp#1#2#3#4#5|<par del|>{\def\j:bname{#1\ifx ?#2\else
1853 #2\ifx ?#3\else #3\ifx ?#4\else #4\fi\fi\fi}}
1854 \expandafter\:temp \jobname ???|<par del|>
1855 >>>
1856
1857
1858 \<base 5 names for htm\><<<
1859 \def\:temp#1#2#3#4#5#6|<par del|>{\def\j:bname{#1\ifx ?#2\else
1860 #2\ifx ?#3\else #3\ifx ?#4\else #4\ifx ?#5\else #5\fi\fi\fi\fi}}
1861 \expandafter\:temp \jobname ????|<par del|>
1862 >>>
1863
1864
1865
1866
1867
1868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1869 \Section{\TeX{} Parameters}
1870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1871
1872 \`'\html:rightskip' is already defined in AlProTex, but we need it early here.
1873
1874 \<def /HtmlEnv\><<<
1875 \def\html:rightskip{\rightskip|=\z@ plus 0.5\hsize minus0.5\hsize }
1876 \def\HtmlEnv{%
1877 \html:rightskip |<html penalties|>%
1878 \def\magnification{%
1879 \def\:temp{\:warning{Insert \string\magnification
1880 =\the\tmp:cnt\space before tex4ht}}%
1881 \afterassignment\:temp\tmp:cnt}%
1882 \ht:everypar{\HtmlPar}}
1883 \let\HtmlPar|=\empty
1884 >>>
1885
1886
1887
1888 The \''\output' variable might hold a script
1889 with
1890 a \''\par', as is the case in LaTeX.
1891
1892 \<def /HtmlEnv\><<<
1893 \edef\:temp{%
1894 \output={\noexpand\SaveEverypar \noexpand\ht:everypar{}\the\output
1895 \noexpand\RecallEverypar}}
1896 \:temp
1897 >>>>
1898
1899
1900
1901
1902 % \let\HtmlENV|=\:gobble
1903
1904 Inhibit streching and shrinking of spaces between words to help tex4ht,
1905 and let flexibility in line length to compensate for fixed spaces and
1906 discouraged word breaks.
1907
1908 \<html penalties\><<<
1909 \frenchspacing |%no extra space after punctuation marks|%
1910 \let\nonfrenchspacing|=\relax
1911 \spaceskip|=\z@ |%override inter word glue|%
1912 \xspaceskip|=\z@ |%same but for words ending with punctuation marks|%
1913 \linepenalty|=0 |%charged on each line break|%
1914 \adjdemerits|=0 |%charged on adj lines of diff length|%
1915 \pretolerance|=10000 |%max penalty pts per line without hyphenation|%
1916 \hyphenpenalty|=10000 |%for line break within word|%
1917 \exhyphenpenalty|=10000|%for line break after hyphen|%
1918 \clubpenalty|=0 |%for page break after first line of parag|%
1919 \widowpenalty|=0 |%for page break before last line of parag|%
1920 \interlinepenalty|=50 |%for page break within a paragraph|%
1921 \displaywidowpenalty|=0
1922 \predisplaypenalty|=-10
1923 \postdisplaypenalty|=1000
1924 \abovedisplayskip|=30pt plus 10pt
1925 \belowdisplayskip|=\abovedisplayskip
1926 \abovedisplayshortskip|=\abovedisplayskip
1927 \belowdisplayshortskip|=\abovedisplayskip
1928 >>>
1929
1930 We don't want a page break after a display, because the
1931 \''\aftergroup' material for the equation may be detached from the
1932 equation. A possible prolem for math into figures.
1933
1934
1935 \<default html env\><<<
1936 |<def /HtmlEnv|>
1937 \edef\:temp{\meaning\everypar}
1938 \edef\:tempa{\string\everypar}
1939 \ifx \:temp\:tempa
1940 \let\ht:everypar|=\everypar
1941 \else
1942 % LaTeX kernel will patch \everypar in future releases,
1943 % so this test will always fail. We should define \ht:everypar
1944 % anyway, paragraph handling would fail otherwise
1945 \let\ht:everypar|=\everypar
1946 \:warning{nonprimitive \string\everypar}
1947 \fi
1948 \edef\NoHtmlEnv{%
1949 \sfcode `\noexpand\noexpand\noexpand\.3000 |%nonfrenchspacing|%
1950 \sfcode `\noexpand\noexpand\noexpand\?3000
1951 \sfcode `\noexpand\noexpand\noexpand\!3000
1952 \sfcode `\noexpand\noexpand\noexpand\:2000
1953 \sfcode `\noexpand\noexpand\noexpand\;1500
1954 \sfcode `\noexpand\noexpand\noexpand\,1250
1955 \rightskip|=\the\rightskip
1956 \spaceskip|=\the\spaceskip
1957 \xspaceskip|=\the\xspaceskip
1958 \linepenalty|=\the\linepenalty
1959 \adjdemerits|=\the\adjdemerits
1960 \pretolerance|=\the\pretolerance
1961 \hyphenpenalty|=\the\hyphenpenalty
1962 \exhyphenpenalty|=\the\exhyphenpenalty
1963 \clubpenalty|=\the\clubpenalty
1964 \widowpenalty|=\the\widowpenalty
1965 \interlinepenalty|=\the\interlinepenalty
1966 \displaywidowpenalty|=\the\displaywidowpenalty
1967 \predisplaypenalty|=\the\predisplaypenalty
1968 \postdisplaypenalty|=\the\postdisplaypenalty
1969 \abovedisplayskip|=\the\abovedisplayskip
1970 \belowdisplayskip|=\the\belowdisplayskip
1971 \abovedisplayshortskip|=\the\abovedisplayshortskip
1972 \belowdisplayshortskip|=\the\belowdisplayshortskip
1973 \noexpand\ht:everypar{\noexpand\the\noexpand\ht:everypar}}
1974 >>>
1975
1976
1977 \<activate html env\><<<
1978 \edef\NoHtmlEnv{\NoHtmlEnv}%
1979 \append:def\NoHtmlEnv{\SUBOff \SUPOff}\HtmlEnv
1980 >>>
1981
1982 \<html utilities\><<<
1983 \let\:noindent|=\noindent
1984 \def\noindent{\ifx \EndPicture\:UnDef
1985 \ifvmode \IgnoreIndent\leavevmode\fi
1986 \else \:noindent \fi}
1987 >>>
1988
1989 \Section{Paragraphs}
1990
1991 We want to push specials at start of lines, and merge the space before
1992 and after specials.
1993
1994 \<html utilities\><<<
1995 \let\skip:Par|=\empty
1996 >>>
1997
1998
1999
2000
2001 \<html paragraph breaks at entry to file\><<<
2002 \def\HtmlPar{\HtmlPar:Off{%
2003 \if:nopar \ShowPar \ShowIndent
2004 \ifx \skip:Par\empty\else \hskip -\parindent \skip:Par\fi
2005 \else
2006 \if:removeindent \ShowIndent \hskip -\parindent \a:Par
2007 \else
2008 \ifdim \parindent>\z@ \hskip -\parindent \fi
2009 \html:par
2010 \ifdim \parindent>\z@ \hskip \parindent \fi
2011 \fi\fi \relax
2012 }}%
2013 >>>
2014
2015
2016 \<general utilities\><<<
2017 \def\IgnorePar{\ifx \EndPicture\:UnDef \Protect\gl:nopartrue \fi}
2018 \def\ShowPar{\ifx \EndPicture\:UnDef \Protect\gl:noparfalse \fi}
2019 \def\IgnoreIndent{\ifx \EndPicture\:UnDef
2020 \Protect\gl:removeindenttrue \fi}
2021 \def\ShowIndent{\ifx \EndPicture\:UnDef
2022 \Protect\gl:removeindentfalse \fi}
2023 \def\gl:nopartrue{\global\:nopartrue}
2024 \def\gl:noparfalse{\global\:noparfalse}
2025 \def\gl:removeindenttrue{\global\:removeindenttrue}
2026 \def\gl:removeindentfalse{\global\:removeindentfalse}
2027 \def\HtmlParOff{\global\let\HtmlPar:Off|=\:gobble}
2028 \def\HtmlParOn{\gdef\HtmlPar:Off##1{##1}}
2029 \HtmlParOn
2030 >>>
2031
2032
2033
2034
2035
2036 \<new ifs\><<<
2037 \:tempa{if:removeindent}
2038 \:tempa{if:nopar}
2039 >>>
2040
2041
2042
2043
2044 \<first pass\><<<
2045 \def\c:HtmlPar:#1#2#3#4{%
2046 \def\:temp{#3}\ifx \:temp\empty \c:def\a:Par{#1}\else
2047 \c:def\a:Par{#1\Next:EndP{#3}}\fi
2048 \def\:temp{#4}\ifx \:temp\empty \c:def\html:par{#2}\else
2049 \c:def\html:par{#2\Next:EndP{#4}}\fi
2050 }
2051 \def\EndP{\Protect\par:end}
2052 \let\par:end|=\empty
2053 \def\Next:EndP{\Protect\next:endp}
2054 \def\next:endp#1{\gdef\par:end{#1\global\let\par:end|=\empty}}
2055 \def\SaveHtmlPar{\PushMacro\a:Par \PushMacro\html:par}
2056 \def\RecallHtmlPar{\PopMacro\a:Par \PopMacro\html:par}
2057 >>>
2058
2059
2060 The following is neded for debugging, to detect skipped paragraps.
2061 Delete it, or just make it active for debugging mode!!!!!
2062
2063
2064 \<shared config\><<<
2065 \NewConfigure{HtmlPar*}[2]{%
2066 \def\:temp{#2}\ifx \:temp\empty \c:def\skip:Par{#1}\else
2067 \c:def\skip:Par{#1\Next:EndP{#2}}\fi}
2068 >>>
2069
2070 \<first pass\><<<
2071 \def\gl:let{\global\let}
2072 \def\EndP:cnt{0}
2073 \def\SaveEndP{%
2074 \expandafter\gl:let\csname \EndP:cnt :sv\endcsname |=\par:end
2075 \gl:let\par:end|=\empty
2076 \gHAdvance \EndP:cnt |by 1 }
2077 \def\RecallEndP{%
2078 \ifnum \EndP:cnt>0
2079 \gHAdvance \EndP:cnt |by -1
2080 \expand:after{\gl:let\par:end|=}\csname\EndP:cnt :sv\endcsname
2081 \else
2082 \:warning{extra \string\RecallEndP}
2083 \fi}
2084 >>>
2085
2086 \<disregard html:par from protex\><<<
2087 \ifx \html:par\:UnDef \let\html:par|=\empty \fi
2088 >>>
2089
2090 User's input, and the following in case of no such input,
2091 determine how files will initially treat paragraphs.
2092
2093
2094
2095
2096
2097
2098 Display math formulas can be in-line or between paragraph.
2099 The ``.nopar'' is for forced paragraph starts after the
2100 end of in-line display paragraphs. HTML 4.0 requires opening
2101 of such paragraphs.
2102
2103
2104
2105 \<html paragraph breaks at entry to fileNO\><<<
2106 \Configure{HtmlPar}{\sva:Par}{\svhtml:par} {}{}
2107 >>>
2108
2109
2110
2111
2112 \<empty html paragraph breaks\><<<
2113 \Configure{HtmlPar}{}{}{}{}%
2114 >>>
2115
2116
2117
2118
2119
2120 \<general utilities\><<<
2121 \def\SaveEverypar{%
2122 \expandafter\ifx\csname ht:everypar\endcsname\relax
2123 \expand:after{\expandafter\gdef\csname \n:list L\endcsname }%
2124 \expandafter{\expandafter\everypar
2125 \expandafter{\the\everypar}}%
2126 \else
2127 \expand:after{\expandafter\gdef\csname \n:list L\endcsname }%
2128 \expandafter{\expandafter\ht:everypar
2129 \expandafter{\the\ht:everypar}}%
2130 \fi
2131 \expandafter\xdef\csname \n:list X\endcsname{%
2132 \if:removeindent \global\noexpand\:removeindenttrue
2133 \else \global\noexpand\:removeindentfalse \fi
2134 \if:nopar \global\noexpand\:nopartrue
2135 \else \global\noexpand\:noparfalse \fi}%
2136 \HtmlEnv \csname \n:list X\endcsname
2137 \csname \n:list L\endcsname
2138 \gHAdvance\n:list |by 1
2139 }
2140 \def\RecallEverypar{\ifnum \n:list<1
2141 \:warning{\noexpand\RecallEverypar without \noexpand\SaveEverypar}%
2142 \else
2143 \HtmlEnv
2144 \gHAdvance\n:list |by -1
2145 \csname \n:list X\endcsname
2146 \csname \n:list L\endcsname
2147 \fi
2148 }
2149 \def\n:list{0}
2150 >>>
2151
2152
2153
2154
2155
2156 \Chapter{Cross References}
2157
2158
2159 Should be consistent with the corresponding features in ProTeX.
2160
2161
2162 \<cross references\><<<
2163 |<common cross references|>
2164 \ifHtml |<html cross references|>
2165 \fi
2166 >>>
2167
2168 \Section{The Commands}
2169
2170 \SubSection{Ref}
2171
2172 The implementations of \''\XRef' and \''\Tag' view the crosswords $\alpha$ as
2173 pointers to macros that carry the names `\''\cw:'$\alpha$'.
2174
2175 \<common cross references\><<<
2176 \def\XRef#1{\expandafter\ifx
2177 \csname |<tag of Tag|>#1\endcsname \relax \:NoTag{#1}%
2178 \else \csname |<tag of Tag|>#1\endcsname \fi}
2179 >>>
2180
2181
2182 \<general utilities\><<<
2183 \def\ifTag#1#2#3{\expandafter\ifx
2184 \csname |<tag of Tag|>#1\endcsname \relax #3\else #2\fi}
2185 >>>
2186
2187
2188
2189
2190
2191
2192
2193 \SubSection{LikeRef}
2194
2195 The \`'\:LikeRef' command is a stripped down version of
2196 \`'\XRef'; it doesn't check whether the tag is defined.
2197
2198 The space in \`'\space' is needed for carrying MAME tags
2199 in (mosaic) html files.
2200
2201 \<common cross references\><<<
2202 \def\LikeRef#1{\expandafter\ifx
2203 \csname |<tag of Tag|>#1\endcsname \relax \space%
2204 \else \csname |<tag of Tag|>#1\endcsname \fi}
2205 \def\:LikeRef#1{\csname |<tag of Tag|>#1\endcsname}
2206 >>>
2207
2208
2209 Read file from previous compilation.
2210
2211
2212
2213
2214 \SubSection{Tag}
2215
2216 A command \''\Tag{'$\alpha$\''}{'$\beta$\''}' introduces into the
2217 reference file a record
2218 of the form
2219 \''\:CrossWord{'$\alpha$\''}{'$\hat\beta$\''}{'$i$\''}'.
2220
2221
2222 \<common cross references\><<<
2223 \let\:SUPOff|=\empty \let\:SUBOff|=\empty
2224 \def\Tag#1#2{\begingroup \:SUPOff \:SUBOff \a:xref \escapechar=`\\%
2225 \edef\:head{\string\:CrossWord{#1}{#2}}%
2226 \expandafter \expandafter \expandafter
2227 \:writeref\expandafter{\:head{\folio}\prcnt:ch}%
2228 \endgroup}
2229 \NewConfigure{xref}{1}
2230 >>>
2231
2232 The \''\:SUBSUPOff' will be redefined latter with subscripts and
2233 superscripts. The current definition is sufficient for the
2234 tags that in the meantime are created by the system.
2235
2236
2237 \<common cross references\><<<
2238 \def\:writeref{\write\:refout}%
2239 >>>
2240
2241 \<general utilities\><<<
2242 \catcode`\%|=12 \def\prcnt:ch{%} \catcode`\%|=14
2243 >>>
2244
2245 I don't know what this code is supposed to do, but it can produce
2246 fatal errors when \''\%' is used inside of title, captions or sections.
2247 See \Link[https://tex.stackexchange.com/q/652848/2891]{}{}
2248 this question on TeX.sx for an example\EndLink.
2249
2250 But when I remove it, the compilation process of TeX4ht sources fails,
2251 so we will need to revert to the original version of the percent command
2252 probably in latex.4ht.
2253
2254 \<html utilities\><<<
2255 \catcode`\%|=12 \def\%{%} \catcode`\%|=14
2256 >>>
2257
2258 \Section{Internal References}
2259
2260
2261
2262 \SubSection{Loading}
2263
2264 \<common cross references\><<<
2265 \def\load:ref#1{%
2266 |<set catcodes for info in ref file|>%
2267 \get:input{#1}%
2268 \re:call \let\:CrossWord|=\sv:crs }
2269 |<interpretation for entries in ref file|>
2270 \ifx \:refout\:UnDef
2271 |<check the existence of jobname.xref|>
2272 \load:ref{\jobname.xref}
2273 \csname newwrite\endcsname\:refout
2274 |<if latex then latex/write sol|>\openout\:refout=\jobname.xref
2275 \fi
2276 >>>
2277
2278 \<check the existence of jobname.xref\><<<
2279 \openin15=\jobname.xref
2280 \ifeof15 \def\:NoTag#1{\hbox{$???$}}
2281 \else \def\:NoTag#1{\hbox{$???$}
2282 \:warning{\string\XRef\string{\string#1\string}?}}
2283 |<warnings for missing /Link|>
2284 \fi
2285 \closein15
2286 >>>
2287
2288
2289
2290
2291
2292
2293 \<set catcodes for info in ref file\><<<
2294 \edef\re:call{\catcode`\noexpand\:|=\the\catcode`\: }%
2295 \catcode`\:|=11
2296 \let\sv:crs|=\:CrossWord
2297 \def\:CrossWord{\bgroup
2298 \no:catcodes{128}{255}{12}%
2299 \catcode`\:|=12 \catcode`\@|=11
2300 \catcode`\^^M|=11 \:CrsWrd}%
2301 \def\:CrsWrd##1##2##3{\egroup \sv:crs{##1}{##2}{##3}}%
2302 >>>
2303
2304 Aborted compilations tend to leave incimplete \`':CrossWord' commands
2305 in the xref file, missing the last page-number parameter. The
2306 \`'\catcode`\^^M=11' allows such commands to be loaded without
2307 terminating the compilation.
2308
2309 \Section{External References}
2310
2311 References to information in other files can be achieved with
2312 the following file-loading command
2313 \`'\LoadRef-[prefix]+{filename.ext}{...}'.
2314
2315
2316
2317 The \`'.ext', \`'+', \`'-', and \`'[...]' components are
2318 optional. A missing \`'.ext' stands for \`'.xref'. When \`'-[prefix]+'
2319 is empty the component \`'{...}' should also be omitted (and the
2320 comamnd assume the form \`'\LoadRef{filename.ext}').
2321
2322 A \`'+' asks that \`'\XRef' and \`'LikeRef' commands will refer to
2323 expanded tags of the form \`'filename::tag' instead of just \`'tag'.
2324 A \`'[prefix]' asks that only tags which start with the given prefix
2325 will be loaded. When \`'[prefix]' is omitted, an empty prefix is
2326 assumed and all the tags are loaded. A \`'-' asks that \`'\XRef' and
2327 \`'LikeRef' commands will refer to truncated tags in which the
2328 specified prefixes are omitted.
2329
2330 Intuitively, a tag can be viewed as a triplet \`'<from>:<to><tag>'
2331 which encodes information together with source and destination
2332 addresses. The \`'{...}' specifies how the information should be
2333 included, where \`'#1' represents the information being loaded.
2334
2335 \SubSection{Scanning the Preamble}
2336
2337
2338
2339 \<common cross references\><<<
2340 \def\LoadRef{\futurelet|<-?|>\:LoadRef}
2341 \def\:LoadRef{{%
2342 \if \bgroup|<-?|>
2343 \aftergroup\loadr:ef
2344 \else
2345 \aftergroup\Load:Ref \if -|<-?|> \else
2346 \aftergroup-\fi
2347 \fi
2348 }}
2349 \def\Load:Ref#1{\futurelet|<[?|>\LoadRef:}
2350 \def\LoadRef:{{%
2351 \aftergroup\:loadref \ifx [|<[?|> \else
2352 \aftergroup[\aftergroup]\fi}}
2353 >>>
2354
2355
2356 %%%%%%%%%%%%% WAS if[
2357
2358 \<common cross references\><<<
2359 \def\:loadref[#1]{%
2360 \let\sv:cros|=\:CrossWord
2361 \edef|<prefix|>{#1}\ifx |<prefix|>\empty \let|<[?|>|= N\fi
2362 \futurelet|<+?|>\l:oadref }
2363 \def\l:oadref{%
2364 {\aftergroup\lo:adref \if +|<+?|> \else \aftergroup+\fi }}
2365 \def\lo:adref#1#2#3{%
2366 \def\cw:format##1{#3}%
2367 \edef\:temp{#2}\expandafter \get:ext\:temp .|<par del|>%
2368 \ifx \:temp\empty
2369 \set:CrossWord#2.|<par del|>{|<prefix|>}\load:ref{#2.xref}%
2370 \else \set:CrossWord#2|<par del|>{|<prefix|>}\load:ref{#2}\fi
2371 \let\:CrossWord|=\sv:cros }
2372 \def\get:ext#1.#2|<par del|>{\def\:temp{#2}}
2373 \def\loadr:ef#1{\let|<+?|>=x \let|<prefix|>|=\empty \lo:adref{}{#1}{##1}}
2374 >>>
2375
2376
2377
2378 \<cs?\><<<
2379 \:tempa>>>
2380
2381 \<-?\><<<
2382 \:tempa>>>
2383
2384 \<[?\><<<
2385 \:tempb>>>
2386
2387 \<+?\><<<
2388 \:tempc>>>
2389
2390 \<prefix\><<<
2391 \:tempd>>>
2392
2393 \SubSection{Incorporating the Preamble}
2394
2395 \<common cross references\><<<
2396 \def\set:CrossWord#1|<par del|>#2{%
2397 \edef\:temp{\noexpand\:setCrossWord#1|<par del|>{#2}}\:temp}
2398 \def\:setCrossWord|<ref filename par|>.#2|<par del|>|<substr par|>{%
2399 \ifx [|<[?|>
2400 \def\:CrossWord##1##2##3{%
2401 \cond:CrossWord##1|<substr par|>|<par del|>{##1}{##2}{##3}}%
2402 \def\:tail|<substr par|>##1|<substr par|>{##1}%
2403 \if +|<+?|> |<:CrossWord := extend selected words|>%
2404 \else |<:CrossWord := selected words|>\fi
2405 \else
2406 \if +|<+?|> |<:CrossWord := extend all words|>\fi
2407 \fi |%else :CrossWord := all words|%
2408 }
2409 >>>
2410
2411 %%%%%%%%%%%%% WAS if[
2412
2413
2414 \<:CrossWord := extend all words\><<<
2415 \def\:CrossWord{\Cross:Word{|<ref filename par|>::}}%
2416 >>>
2417
2418 \<:CrossWord := extend selected words\><<<
2419 \if -|<-?|>
2420 \def\cond:CrossWord##1|<substr par|>##2|<par del|>##3##4##5{%
2421 \def\:temp{##1}\ifx \:temp\empty
2422 \Cross:Word{|<ref filename par|>::}%
2423 {\:tail##3|<substr par|>}{##4}{##5}\fi }%
2424 \else
2425 \def\cond:CrossWord##1|<substr par|>##2|<par del|>##3##4##5{%
2426 \def\:temp{##1}\ifx \:temp\empty
2427 \Cross:Word{|<ref filename par|>::}{##3}{##4}{##5}\fi }%
2428 \fi
2429 >>>
2430
2431 \<:CrossWord := selected words\><<<
2432 \if -|<-?|>
2433 \def\cond:CrossWord##1|<substr par|>##2|<par del|>##3##4##5{%
2434 \def\:temp{##1}\ifx \:temp\empty
2435 \Cross:Word{}{\:tail##3|<substr par|>}{##4}{##5}\fi }%
2436 \else
2437 \def\cond:CrossWord##1|<substr par|>##2|<par del|>##3##4##5{%
2438 \def\:temp{##1}\ifx \:temp\empty
2439 \Cross:Word{}{##3}{##4}{##5}\fi }%
2440 \fi
2441 >>>
2442
2443
2444
2445
2446
2447 \Section{Interpretation for Entries}
2448
2449
2450
2451 For each crossword $\alpha$ the imported file contains a record of the
2452 form \''\:CrossWord{'$\alpha$\''}{'$\hat{\beta}$\''}{'$i$\''}'.
2453 In such a record, $\hat\beta$ and $i$ stand for the expanded token
2454 list and HPage number that correspond to $\alpha$, respectively.
2455
2456 A command
2457 \''\:CrossWord{'$\alpha$\''}{'$\hat{\beta}$\''}{'$i$\''}'
2458 introduces the macro
2459 \''\def\cw:'$\alpha$\''{'$\hat\beta$\''}', if the label is not empty.
2460 Otherwise, it introduces the macro \''\def\cw:'$\alpha$\''{'$i$\''}'
2461 that holds the page number.
2462
2463
2464 \<interpretation for entries in ref file\><<<
2465 \def\:CrossWord#1#2#3{\Cross:Word{}{#1}{#2}{#3}}
2466 \def\Cross:Word#1#2#3#4{%
2467 \def\:temp{#3}\tmp:toks{#3}%
2468 \expandafter\edef\csname |<tag of Tag|>\cw:format{#1#2}\endcsname{%
2469 \expandafter\ifx\csname |<tag of Tag|>\cw:format{#1#2}\endcsname\relax
2470 \else \csname |<tag of Tag|>\cw:format{#1#2}\endcsname , \fi
2471 \ifx \:temp\empty #4\else \the\tmp:toks\fi}}
2472 \def\cw:format#1{#1}%
2473 >>>
2474
2475
2476
2477
2478 \<par del\><<<
2479 !*?: >>>
2480
2481 \<substr par\><<<
2482 #3>>>
2483
2484 \<ref filename par\><<<
2485 #1>>>
2486
2487 %%%%%%%%%%%%%%%%%%%
2488 \Section{Link}
2489 %%%%%%%%%%%%%%%%%%
2490
2491 Good for \''\Link{...}{...}' across files when we have
2492 \''\LoadRef+{...}{#1}'.
2493
2494 \<html cross references\><<<
2495 \catcode`\:=12
2496
2497 \def\get@hfile#1{\get@hfil@ #1:::://}
2498
2499 \def\get@hfil@#1::#2::#3//{%
2500 \expandafter\ifx \csname
2501 |<tag of Tag|>#1::|<HTag tag|>#2\endcsname \relax \else
2502 \expandafter\expandafter\expandafter\get@@hfile
2503 \csname |<tag of Tag|>#1::|<HTag tag|>#2\endcsname,//{#1}%
2504 \fi}
2505 \def\get@@hfile#1,#2//#3{%
2506 \expandafter\ifx
2507 \csname |<tag of Tag|>#3::|<auto file tag|>#1%
2508 |<Tag/Ref: file-id -> file-name|>\endcsname \relax
2509 \else
2510 \csname |<tag of Tag|>#3::|<auto file tag|>#1%
2511 |<Tag/Ref: file-id -> file-name|>\endcsname
2512 \expandafter \expandafter \expandafter \expandafter
2513 \expandafter \expandafter \expandafter \remove@fn
2514 \fi }
2515
2516 \def\remove@fn#1#2::{#1}
2517
2518 \catcode`\:=11
2519 >>>
2520
2521
2522
2523
2524
2525 %%%%%%%%%%%%%%%%%%%%%%%%%%
2526 \Section{Utilities}
2527 %%%%%%%%%%%%%%%%%%%%%%%%%%
2528
2529 %%%%%%%%%%%%%%%%%%%%%%%%%%
2530 \SubSection{Empty Anchors}
2531 %%%%%%%%%%%%%%%%%%%%%%%%%%
2532
2533 Change the following to standard space character when microsoft
2534 explorer will let it. Currently it wiil go only for ubreakable
2535 space. The last null anchor is obviously the most desirable one.
2536
2537 \<html utilities\><<<
2538 \def\hidden:anchor{}
2539 >>>
2540
2541 %%%%%%%%%%%%%%%%%%%%%%%%%%
2542 \SubSection{Latex Anomalies}
2543 %%%%%%%%%%%%%%%%%%%%%%%%%%
2544
2545 \<if latex then latex/write sol\><<<
2546 \if:latex \expandafter\immediate\fi
2547 >>>
2548
2549
2550 Try to understand betetr what goes here, because I got
2551 the following not workin in latex. It pushed the output
2552 to the log file instead of the toc file.
2553
2554 \Verbatim
2555 \<latex/write sol\><<<
2556 \immediate
2557 >>>
2558 \EndVerbatim
2559
2560 Inserted for the differences in the output routines between TeX and
2561 LaTeX.
2562
2563 \Verbatim
2564 -------ok----------------faulty------------------ok-----------------
2565 | | | |
2566 | | \documentstyle{book} | \documentstyle{book} |
2567 | | \begin{document} | \begin{document} |
2568 | \newwrite\y | \newwrite\y | \newwrite\y |
2569 | \openout\y=f.xx | \openout\y=f.xx | \immediate\openout\y=f.xx |
2570 | \write\y{....} | \write\y{....} | \immediate\write\y{....} |
2571 | \closeout\y | \closeout\y | \immediate\closeout\y |
2572 | \end | \end{document} | \end{document} |
2573 --------------------------------------------------------------------
2574 \EndVerbatim
2575
2576 La\TeX has a \''\clearpage' and \''\cleardoublepage'.
2577
2578 \<latex /special sol\><<<
2579 \ifx \clearpage\:UnDef \def\:clearpage{\vfil\penalty-20000}
2580 \else
2581 \let\real:par|=\par \def\eq:par{\par\real:par}
2582 \def\:clearpage{\expandafter\ifx\eq:par\clearpage\fi}
2583 \fi
2584 >>>
2585
2586 In LaTeX, \''\clearpage' embeds a \''\newpage', which in turns
2587 embeds a \''\par'. The \''\EndPage', in turn, embeddes a
2588 \''\:clearpage' which may cause a problem in places that
2589 \''\par' might be a problem. Such is the case, for instance,
2590 within \''\halign', where \''\par' has a different meaning
2591 and may cause an infinite loop. The \''\footnote' produces
2592 this bad situation.
2593
2594
2595 \<general utilities\><<<
2596 |<latex /special sol|>
2597 >>>
2598
2599 \Verbatim
2600 ---------ok------------------faulty--------------------ok-----------
2601 | | | |
2602 | | \documentstyle{book} | \documentstyle{book} |
2603 | | \begin{document} | \begin{document} |
2604 | aaaaa | aaaaa | aaaaa |
2605 | \special{t4ht>bbbbb} | \special{t4ht>bbbbb} | \special{t4ht>bbbbb} |
2606 | ccccc | ccccc | ccccc |
2607 | \vfil\penalty-20000 | \vfil\penalty-20000 | \vfil\penalty-10000 |
2608 | ddddd | ddddd | ddddd |
2609 | \end | \end{document} | \end{document} |
2610 | | | |
2611 --------------------------------------------------------------------
2612 \EndVerbatim
2613
2614
2615
2616 \Verbatim
2617 --------------------ok-------------------------------faulty------------------
2618 | |\documentstyle{book} |
2619 | |\begin{document} |
2620 |\leavevmode x\vfil \penalty-10000 |\leavevmode x\vfil \penalty-10000 |
2621 |\leavevmode y\mark{\gdef\noexpand\z{}}|\leavevmode y\mark{\gdef\noexpand\z{}}|
2622 |\end |\end{document} |
2623 -----------------------------------------------------------------------------
2624
2625 -------------ok-----------------------faulty--------------
2626 | | \documentstyle{book} |
2627 | | \begin{document} |
2628 | y | y |
2629 | \mark{\gdef\noexpand\zz{}} | \mark{\gdef\noexpand\zz{}} |
2630 | \end | \end{document} |
2631 ----------------------------------------------------------
2632 \EndVerbatim
2633
2634 \SubSection{Other}
2635
2636 \<general utilities\><<<
2637 \ifx \folio\:UnDef
2638 \def\folio{\ifx \pageno\:UnDef \z@ \else
2639 \ifnum \pageno <0 \romannumeral -\pageno
2640 \else \the \pageno \fi\fi}
2641 \fi
2642 >>>
2643
2644
2645
2646 %%%%%%%%%%%%%%%%%%%%%%%%%%
2647 \Chapter{Html Files}
2648 %%%%%%%%%%%%%%%%%%%%%%%%%%
2649
2650 \''\HP:file' was before \''\:tempa', and it got screwed when
2651 \''\PauseHFont' and \''\EndPauseHFont' have been defined
2652 and introdued to \''\Configure{HtmlPar}'. The name is probably misused
2653 at some of its occurences.
2654
2655
2656 \<files\><<<
2657 |<elements for file|>
2658 \ifHtml |<html file commands|> \fi
2659 >>>
2660
2661 \Section{Open Files}
2662
2663 The first optional parameter of \`'\FileStream' goes to the title of
2664 the html file. For a second parabeter, one should be careful
2665 of not providing an undefined \`'\csname...\endcsname' file name. An
2666 empty second parameter refers to the root file.
2667
2668 \<elements for file\><<<
2669 \ifx \FileStream\:UnDef \else
2670 \errmessage{--- TeX4ht error ---
2671 \noexpand\FileStream is defined outside of TeX4ht}\endinput
2672 \fi
2673 \def\FileStream{\IgnorePar
2674 \let|<needs preamble|>|=-\futurelet\:temp\F:le}
2675 \def\F:le{\if +\:temp \let|<needs preamble|>|=+\expandafter\Fl:e
2676 \else \expand:after{\Fl:e-}\fi}
2677 \def\Fl:e#1{\futurelet\:temp\::File}
2678 \def\::File{\ifx [\:temp \expandafter\:File
2679 \else \expand:after{\:File[]}\fi }
2680 \def\:File[#1]#2{}
2681 >>>
2682
2683 %%%%%%%%%%%%% WAS if[
2684
2685 \<html file commands\><<<
2686 \def\:File[#1]#2{%
2687 \no:pic\edef\file:name{#2}\yes:pic
2688 \expandafter\ifx\csname
2689 |<csname: file name -> file id|>\file:name\endcsname\relax
2690 |<open html file name|>%
2691 \else |<reopen html file|>%
2692 \fi}
2693 \HAssign\bs:fileid |= 1
2694 >>>
2695
2696 The definition \`'\edef\file:name{#2}' is needed just in case the
2697 parameter \`'#2' depends on \`'\file:id', because the latter is being
2698 changed within the course of the code.
2699
2700
2701
2702
2703 \<reopen html file\><<<
2704 \xdef\file:id{\csname
2705 |<csname: file name -> file id|>\file:name\endcsname}%
2706 \ht:special{t4ht>\ifnum \file:id>\bs:fileid\space \file:name\fi }%
2707 >>>
2708
2709
2710
2711
2712 \<open html file name\><<<
2713 \ht:special{t4ht>\file:name}%
2714 \immediate\write-1{--- file \file:name\space ---}%
2715 |<round ids before file|>%
2716 \gHAdvance\maxfile:id |by 1
2717 \global\let\file:id|=\maxfile:id
2718 \Tag{|<auto file tag|>\file:id
2719 |<Tag/Ref: file-id -> file-name|>}{\file:name}%
2720 \expandafter\xdef\csname
2721 |<csname: file name -> file id|>\file:name\endcsname{\file:id}%
2722 |<HPage TITLE|>%
2723 |<remove par skip space|>%
2724 \a:PROLOG \a:HTML \a:HEAD
2725 \ifx +|<needs preamble|>%
2726 |<initiate frames|>%
2727 \xdef:cs{|<live|>\file:id}{\noexpand\a:TITLE
2728 |<noexpanded configured title|>%
2729 \noexpand\b:TITLE\noexpand\a:@HEAD\noexpand\b:HEAD}%
2730 \else
2731 \xdef:cs{|<live|>\file:id}{}%
2732 \a:TITLE|<configured title|>\b:TITLE \a:@HEAD\b:HEAD\B:DY
2733 \fi
2734 >>>
2735
2736 \<configured title\><<<
2737 \bgroup \:TITLE: \c:TITLE \egroup
2738 >>>
2739
2740
2741
2742 \<noexpanded configured title\><<<
2743 \bgroup \noexpand\:TITLE: \noexpand\c:TITLE \egroup
2744 >>>
2745
2746
2747 \<remove par skip space\><<<
2748 \ht:special{t4ht@[}{\ht:everypar{}\leavevmode}\ht:special{t4ht@]}%
2749 >>>
2750
2751
2752
2753
2754 Titles need to be evaluated immediately to capture meanings that come
2755 from sectioning commands, where the latter may include macro names
2756 taht can change in time.
2757
2758
2759 The following should appear before \''\Preamble'.
2760
2761 \<first pass\><<<
2762 \NewConfigure{HTML}[2]{\c:def\a:HTML{#1}\c:def\b:HTML{#2}}
2763 \NewConfigure{HEAD}[2]{\c:def\a:HEAD{#1}\c:def\b:HEAD{#2}}
2764 \NewConfigure{BODY}[2]{\c:def\a:BODY{#1}%
2765 \c:def\b:BODY{\csname a:@/BODY\endcsname#2}}
2766 \NewConfigure{TITLE}[2]{\c:def\a:TITLE{#1}\c:def\b:TITLE{#2}}
2767 \NewConfigure{TITLE+}[1]{\c:def\c:TITLE{#1}}
2768 \NewConfigure{@TITLE}[1]{\concat:config\:TITLE:{#1}}
2769 \NewConfigure{@HEAD}[1]{\concat:config\a:@HEAD{#1}}
2770 \let\a:@HEAD|=\relax
2771 >>>
2772
2773 \<concat config\><<<
2774 \long\def\concat:config#1#2{\def\:temp{#2}%
2775 \ifx \:temp\empty \let#1|=\empty
2776 \else \ifx #1\relax \let#1|=\empty\fi
2777 \append:def#1{#2}\fi
2778 }
2779 >>>
2780
2781 \''\Configure{@HEAD}{}' empties the content.
2782 \''\Configure{@HEAD}{...}' appends the content.
2783
2784 Same for the following
2785
2786 \<first pass\><<<
2787 \NewConfigure{@BODY}[1]{\concat:config\a:@BODY{#1}}
2788 \let\a:@BODY\relax
2789 \NewConfigure{@/BODY}[1]{\expandafter
2790 \concat:config\csname a:@/BODY\endcsname{#1}}
2791 \expandafter\let\csname a:@/BODY\endcsname\relax
2792 >>>
2793
2794 Why the \''\noexpand' above. Put a \`'\special' instead.
2795
2796 \<utilities\><<<
2797 \:CheckOption{hshow} \if:Option
2798 \def\hshow#1{\writesixteen
2799 {..#1.......\expandafter\meaning\csname #1\endcsname}}
2800 |<Show Configure|>
2801 \fi
2802 >>>
2803
2804 \<Show Configure\><<<
2805 \def\ShowConfigure#1{%
2806 \edef\:tempb{\expandafter \meaning\csname c:#1:\endcsname}%
2807 \expandafter\par:N \:tempb////%
2808 \writesixteen{\string\Configure{#1}}%
2809 {\show:Arg{1}{a:#1}%
2810 \show:Arg{2}{b:#1}%
2811 \show:Arg{3}{c:#1}%
2812 \show:Arg{4}{d:#1}%
2813 \show:Arg{5}{e:#1}%
2814 \show:Arg{6}{f:#1}%
2815 \show:Arg{7}{g:#1}%
2816 \show:Arg{8}{h:#1}%
2817 \show:Arg{9}{i:#1}}%
2818 }
2819 \edef\:temp{\def\noexpand
2820 \par:N##1\string :##2->##3////{\noexpand\par:NN?##2//}}
2821 \:temp
2822 \def\par:NN#1#2//{\def\:tempb{#2}\ifx\:tempb\empty
2823 \def\:tempb{#1}\else \def\:tempb{\par:NN#2//}\expandafter\:tempb\fi}
2824 \def\show:Arg#1#2{%
2825 \ifnum \:tempb=#1 \let\show:Arg=\:gobbleII \fi
2826 \expandafter\let\expandafter\:temp \csname #2\endcsname
2827 \writesixteen{ {\ifx \:temp\relax ???\else
2828 \expandafter\:gobbleM \meaning \:temp\fi}}}
2829 \def\:gobbleM#1->{}
2830 >>>
2831
2832
2833
2834
2835
2836
2837 The following tag is for recording files that are still alive, and for
2838 keeping a status location for HEAD/FRAMESET/BODY entity types.
2839
2840 \<live\><<<
2841 Lv >>>
2842
2843
2844
2845 \Section{Close Files}
2846
2847 \<html file commands\><<<
2848 \def\EndFileStream#1{%
2849 \expandafter\ifx
2850 \csname |<csname: file name -> file id|>#1\endcsname\relax
2851 \:warning{\string\EndFileStream{#1}?}%
2852 \else
2853 \ifnum\csname |<csname: file name -> file id|>#1\endcsname=\bs:fileid
2854 \:warning{\string\EndFileStream{\jobname .\:html}?}%
2855 \else \expandafter\ifnum |<file not overided by /ChildOf|>%
2856 |<close html file name|>%
2857 \fi\fi\fi }
2858 >>>
2859
2860 Note thta \`'\EndFileStream' might get fake calls due to end of HPages. Hence,
2861 \`'\RecallEverypar' should be invoked only when real HPageas are closed.
2862 Well, we can't put \''\SaveEverypar' and
2863 \''\RecallEverypar' in \''\FileStream' and \''\EndFileStream'
2864 because they are not structured. We can reopen and close files randomly.
2865
2866
2867 An extra empty line at end of file (for some reason, some settings
2868 of emacs prompt the user for such a line).
2869
2870 \<close html file name\><<<
2871 {\let\inputlineno|=\tmp:cnt \tmp:cnt|=1 \root:next }%
2872 |<end body and frames|>%
2873 \ht:special{t4ht<#1}%
2874 \g:delete{\empty |<csname: file name -> file id|>#1}%
2875 |<round ids after file|>%
2876 >>>
2877
2878 Why the \''\edef' above
2879
2880
2881 Upon closing a file with \`\special{t4ht<#1}', the program
2882 \`'tex4ht.c' moves to the youngest file that is still openned.
2883
2884 \<close html file name\><<<
2885 \expandafter\expandafter\expandafter\global \expandafter
2886 \let\csname |<live|>\file:id\endcsname|=\:UnDef
2887 \global\let\file:id|=\maxfile:id
2888 \find:fileid
2889 >>>
2890
2891 \<html file commands\><<<
2892 \def\find:fileid{%
2893 \expandafter\ifx \csname |<live|>\file:id\endcsname \relax
2894 \gHAdvance\file:id |by -1 \expandafter\find:fileid
2895 \fi
2896 }
2897 >>>
2898
2899
2900
2901 \Section{Cross References}
2902
2903
2904
2905
2906 The commands referencing files are defined for use also within
2907 restricted environments (\`'\edef', \`'\write').
2908
2909 \<html file commands\><<<
2910 \def\TagFile#1{%
2911 \expandafter\ifx \csname
2912 |<tag of Tag|>|<file name for TagFile|>\endcsname \relax \else
2913 \Tag{#1|<File tag|>}{\LikeRef{|<file name for TagFile|>}}%
2914 \fi
2915 }
2916 \def\RefFile#1{\LikeRef{#1|<File tag|>}}
2917 \def\FileName{\LikeRef
2918 {|<auto file tag|>\file:id |<Tag/Ref: file-id -> file-name|>}}
2919 >>>
2920
2921
2922
2923
2924
2925 \<file name for TagFile\><<<
2926 |<auto file tag|>\file:id |<Tag/Ref: file-id -> file-name|>%
2927 >>>
2928
2929
2930 \`'\def\RefFile#1{\XRef{#1|<File tag|>}}
2931 \def\LikeRefFile#1{\LikeRef{#1|<File tag|>}}'
2932
2933 \<html file commands\><<<
2934 \def\RefFileNumber#1{%
2935 \expandafter\ifx \csname
2936 |<tag of Tag|>|<auto file tag|>#1%
2937 |<Tag/Ref: file-id -> file-name|>\endcsname\relax
2938 \else
2939 \:LikeRef{|<auto file tag|>#1|<Tag/Ref: file-id -> file-name|>}%
2940 \fi }
2941 >>>
2942
2943
2944 \Verbatim
2945
2946 > Why is it that during the first run, \file:name returns the correct
2947 > filename, but \FileName returns a blank?
2948
2949 \file:name doesn't always return the correct
2950
2951 \documentclass{article}
2952 \begin{document}
2953
2954 \writesixteen
2955 {\csname file:name\endcsname...\csname FileName\endcsname}
2956
2957 \end{document}
2958
2959 > Is this a bug or a feature?
2960
2961 \FileName gets its information through the xref file from the previous
2962 compilation, in a similar manner that \ref gets its information from
2963 \name in latex. The indirection is needed to allow communication
2964 between different files that are to be compiled into a joint html
2965 output. It was introduced at a time that I and others had no access to
2966 large latex compilers, forcing the break up of large source (eg,
2967 books) into smaller files.
2968 \EndVerbatim
2969
2970
2971
2972 \Section{Root File}
2973
2974 \<html file commands\><<<
2975 \xdef:cs{\empty |<csname: file name -> file id|>\jobname .\:html}{\file:id}
2976 \xdef:cs{\empty |<csname: file name -> file id|>}{\file:id}
2977 \Tag{|<auto file tag|>\file:id
2978 |<Tag/Ref: file-id -> file-name|>}{\jobname .\:html}
2979 \bgroup
2980 |<protect from /special redef|>%
2981 \xdef:cs{|<live|>\file:id}{\noexpand\a:TITLE
2982 |<noexpanded configured title|>%
2983 \noexpand\b:TITLE \noexpand\a:@HEAD\noexpand\b:HEAD}%
2984 \egroup
2985 >>>
2986
2987
2988
2989
2990 \Section{Document Head}
2991
2992 \<start html doc\><<<
2993 \:startdoc
2994 >>>
2995
2996
2997
2998 \<at doc start\><<<
2999 \def\at:startdoc{%
3000 \let\:startdoc|=\:UnDef \let\at:startdoc|=\:UnDef
3001 |<activate html env|>%
3002 \a:Preamble
3003 |<start html file|>}
3004 \def\:startdoc{%
3005 \at:startdoc
3006 \edef\:temp{\pageno|=\the\pageno}%
3007 {\let\HCode|=\:gobble \par\newpage}\:temp}
3008 >>>
3009
3010 The \''\let\HCode=\:gobble' is to prevent \`'<BR>' from
3011 \''\line' activated by \'sty' and called upon from
3012 a user-designed \''\output' routines taht have not been
3013 adjusted yet for haeders and footers.
3014
3015
3016
3017
3018 > The following is to ensure that no shipout of content is done before
3019 > the header is out.
3020
3021 Update 2020: patching of shipout is discouraged in LaTeX. I don't know what
3022 use case the following code has, but it seems that TeX4ht can safelly work
3023 without it. We can introduce it back in the case of problems. -- Michal
3024
3025 \<start html doc\><<<
3026 %\let\:shipout|=\shipout
3027 %\def\shipout{\vfil\break\let\shipout|=\:shipout \shipout}
3028 >>>
3029
3030
3031
3032 \<start html file\><<<
3033 \a:PROLOG \a:HTML \a:HEAD
3034 |<initiate frames|>%
3035 >>>
3036
3037 The following empty line is to avoid lines that are too long
3038 in the style file.
3039
3040 The following is for the root file, and it can be overriden
3041 by definitions before \''\EndPreamble'.
3042
3043
3044
3045 \<concat config\><<<
3046 \def\:prolog#1#2,#3|<par del|>{%
3047 \if ,#2,\else
3048 \edef\:tempc{\if*#2\fi}%
3049 \ifx \:tempc\empty
3050 \expandafter\append:def
3051 \csname a:#1\endcsname{\csname a:#2\endcsname}%
3052 \expandafter\ifx \csname c:#2:\endcsname\relax
3053 \NewConfigure{#2}{1}%
3054 \fi
3055 \else
3056 \expand:after{\pro:log{#1}}\expandafter{\:tempc}%
3057 \fi\fi
3058 \if ,#3,\else \expand:after{\:prolog{#1}#3|<par del|>}\fi
3059 }
3060 \def\pro:log#1#2{%
3061 \expandafter\append:def
3062 \csname a:#1\endcsname{\csname a:#2\endcsname}%
3063 \expandafter\ifx \csname c:#2:\endcsname\relax
3064 \NewConfigure{#2}[1]{\expandafter
3065 \concat:config\csname a:#2\endcsname{##1}}%
3066 \expandafter\let\csname a:#2\endcsname\relax
3067 \fi
3068 }
3069 \def\seq:config#1#2{%
3070 \expandafter\let\csname a:#1\endcsname=\empty
3071 \:prolog {#1}#2,|<par del|>}
3072 >>>
3073
3074 The \''\seq:config' is for introducing a sequence of hooks,
3075 where a star `*' before the hook name indicates it is to be
3076 of accumulative kind.
3077
3078 \<define /Preamble\><<<
3079 \NewConfigure{PROLOG}[1]{\seq:config{PROLOG}{#1}}
3080 >>>
3081
3082
3083 \<html Configure's\><<<
3084 \def\Goto:Configure{\long\def
3085 \Goto:Configure##1\:Configure{\let\Goto:Configure
3086 |=\:UnDef}\expandafter\Goto:Configure}
3087 |<trace configurations|>
3088 |<html config util|>
3089 |<shared config|>
3090 |<font config util|>
3091 |<accents|>
3092 |<math config util|>
3093 >>>
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105 \Section{Document Tail}
3106
3107
3108
3109 \<TeX4ht hook on end\><<<
3110 \expand:after{\let\o:end|=}\csname end\endcsname
3111 \expandafter\def\csname end\endcsname{%
3112 \csname export:hook\endcsname \csname o:end\endcsname}
3113 >>>
3114
3115 This is not used, enddocument hook for LaTeX is defined in latex.4ht.
3116
3117 \<latex hook on end\><<<
3118 \let\o:enddocumenthook|=\@enddocumenthook
3119 \def\@enddocumenthook{%
3120 \o:enddocumenthook \csname export:hook\endcsname }
3121 >>>
3122
3123
3124
3125
3126
3127 \<hook on end\><<<
3128 \def\at:docend{|<close html doc|>\global\let\at:docend=\empty}
3129 \expand:after{\let\o:end|=}\csname end\endcsname
3130 \expandafter\def\csname end\endcsname{\HtmlEnv
3131 \at:docend
3132 \csname export:hook\endcsname \csname o:end\endcsname}
3133 >>>
3134
3135
3136 \<close html doc\><<<
3137 |<close HPages in @end|>%
3138 \HAssign\op:fl|=\maxfile:id\space \close:files
3139 |<buttons at end of child|>%
3140 |<end body and frames|>%
3141 >>>
3142
3143
3144
3145 \<end body and frames\><<<
3146 {\b:BODY \b:HTML}%
3147 >>>
3148
3149
3150 \<html file commands\><<<
3151 \def\close:files{%
3152 \ifnum \op:fl<\bs:fileid \else
3153 \def\:warning##1{}%
3154 \EndFileStream{\RefFileNumber\op:fl}%
3155 \Advance:\op:fl |by -1
3156 \expandafter\close:files
3157 \fi}
3158 >>>
3159
3160
3161 \Chapter{HPages and Cut Points}
3162
3163
3164
3165 \<cut points\><<<
3166 |<elements for cut points|>
3167 \ifHtml |<html cut points|>
3168 |<tex html cut points|>
3169 \fi
3170 >>>
3171
3172 \Section{HPages}
3173
3174
3175 \`'\HPage<block name>[tag]{title} ... \EndHPage{block name}'
3176
3177 \List{$\button$}
3178
3179 \item The \`'block name' is optional in \''\EndHPage', and it serves
3180 for balancing delimiters of blocks.
3181
3182 If included, it is compared against \`'block name' and \`'tag'
3183 in the given order until a non-empty entity is encountered.
3184 All the compared entities must be fully-expandable (i.e., edef).
3185 (Note that for \`'[]', title is the tag.)
3186
3187 \item The \`'[tag]' is used for \`'\RefFile', and it is optional.
3188 An empty tag asks that the title will serve as a tag.
3189
3190 \item The \`'{title}' is used for a HPage. If empty, the HPage is omitted.
3191
3192 \EndList
3193
3194 \`'\HPage<block name>-[tag]title\ContHPage ... \EndHPage{block
3195 name}'
3196
3197 A variant of the above in which tag must be non-empty if \`'[tag]' is
3198 present, and \`'title' need not be expandable. Also, either \`'block
3199 name' or \`'tag' must be present, if \`'\EndHPage{...}' has a
3200 non-empty parameter.
3201
3202
3203 \<html cut points\><<<
3204 \def\HPage{\strt:bt\ch:HPage}
3205 \def\ch:HPage{%
3206 \ifx -\:temp \expandafter\m:HPage
3207 \else \expand:after{\ifx [\:temp \expandafter\op:HPage
3208 \else \expandafter\:HPage \fi}%
3209 \fi}
3210 >>>
3211
3212 \<html cut points\><<<
3213 \def\strt:bt#1{%
3214 \def\:bgtr<##1>{|<page-name is a file name?|>%
3215 |<push name if not HPageButton|>%
3216 \futurelet\:temp#1}%
3217 \futurelet\:temp\ch:btgr}
3218 \def\ch:btgr{\ifx <\:temp \expandafter\:bgtr
3219 \else \expand:after{\:bgtr<>}\fi}%
3220 >>>
3221
3222
3223 \<push name if not HPageButton\><<<
3224 \ifx #1\ch:bbtf \else \PushStack\:btid{##1}\fi
3225 >>>
3226
3227 \<html cut points\><<<
3228 \def\HP:Link{\Link[\HP:file
3229 \a:LinkHPage]{}{\HP:file}\global\let\a:LinkHPage|=\empty}
3230 \NewConfigure{LinkHPage}[1]{\def\a:LinkHPage{ #1}}
3231 \let\a:LinkHPage=\empty
3232 \def\op:HPage[#1]#2{%
3233 |<entring file of hpage|>%
3234 \:hookI{BeforeHPageButton}{}{#2}%
3235 \hpg:wrn{#1}{#2}\HPage \TagFile{|<fr bt fl|>\:temp}%
3236 \Save:HPageTag\:temp
3237 \Save:HPage{#2}%
3238 \NewFileName\HP:file \Save:Link\HP:file
3239 \if:notempty{#2}{\HP:Link#2\EndLink}%
3240 \:hookI{AfterHPageButton}{}{#2}%
3241 \:btfile{#2}%
3242 \:buttrc\HPage{[#1]{#2}}%
3243 \PushStack\:afterbt{x}%
3244 |<:temp = but name|>%
3245 \TagFile{\:temp}}
3246 \def\:HPage#1{%
3247 |<entring file of hpage|>%
3248 \:hookI{BeforeHPageButton}{}{#1}%
3249 \NewFileName\HP:file \Save:Link\HP:file \Save:Temp\HP:file
3250 \TagFile{|<fr bt fl|>\HP:file}%
3251 \Save:HPageTag\HP:file
3252 \Save:HPage{#1}%
3253 \def\:temp{#1}\ifx \:temp\empty
3254 \else \HP:Link#1\EndLink
3255 \fi
3256 \:hookI{AfterHPageButton}{}{#1}%
3257 \:btfile{#1}%
3258 \:buttrc\HPage{{#1}}%
3259 \PushStack\:afterbt{x}%
3260 \Recall:Temp\:tempa \TagFile{\:tempa}}
3261 >>>
3262
3263
3264 \<html cut points\><<<
3265 \def\hpg:wrn#1#2#3{%
3266 |<:temp = but name|>%
3267 \ifx \:temp\empty \:warning{\string#3[]{}?}\fi}
3268 >>>
3269
3270
3271 \<:temp = but name\><<<
3272 \edef\:temp{#1}\ifx \:temp\empty \no:pic
3273 \edef\:temp{\noexpand\yes:pic
3274 \def\noexpand\:temp{#2}}\:temp \fi
3275 >>>
3276
3277
3278 \<html cut points\><<<
3279 \def\Save:Temp{\PushStack\sv:Temp}
3280 \def\Recall:Temp{\PopStack\sv:Temp}
3281 >>>
3282
3283 Can't go for \`' \def\:temp{#1}' because \`'#1' is just a title and
3284 not a tag.
3285
3286
3287 \<html cut points\><<<
3288 \def\m:HPage#1{\futurelet\:temp\ch:mbut}
3289 \def\ch:mbut{\ifx [\:temp \expandafter\op:mbut
3290 \else \expandafter\:mbut \fi}
3291 \def\op:mbut[#1]{%
3292 |<entring file of hpage|>%
3293 \:hookI{BeforeHPageButton}{}{}%
3294 \edef\:temp{#1}%
3295 \ifx \:temp\empty \:warning{\string\HPage-[]?}\fi
3296 \TagFile{|<fr bt fl|>\:temp}%
3297 \Save:HPageTag\:temp
3298 \Save:HPage{}%
3299 \NewFileName\HP:file \Save:Link\HP:file
3300 \HP:Link%
3301 \def\ContHPage{\:ContHPage{x}{#1}}}
3302 \def\:mbut{%
3303 |<entring file of hpage|>%
3304 \:hookI{BeforeHPageButton}{}{}%
3305 \NewFileName\HP:file \Save:Link\HP:file
3306 \TagFile{|<fr bt fl|>\HP:file}%
3307 \Save:HPageTag\HP:file
3308 \Save:HPage{}%
3309 \HP:Link%
3310 \def\ContHPage{\:ContHPage{x}{\HP:file}}}
3311 \def\:ContHPage#1#2{\EndLink
3312 \Recall:Link\HP:file \Save:Link\HP:file
3313 \:hookI{AfterHPageButton}{}{}%
3314 \:btfile{}%
3315 \:buttrc\HPage{...\string\ContHPage}%
3316 \PushStack\:afterbt{#1}%
3317 \TagFile{#2}}
3318 >>>
3319
3320
3321 \<html cut points\><<<
3322 \def\:hookI#1#2#3{%
3323 \expandafter\ifx \csname #1\endcsname\relax #2\else
3324 \csname #1\endcsname{#3}\fi
3325 }
3326 >>>
3327
3328 \<html cut points\><<<
3329 \def\NewFileName#1{%
3330 \HAssign#1|=\maxfile:id
3331 \Advance:#1 |by 1
3332 \ifx \:NxtNwFN\:Undef
3333 \edef#1{\j:bname \ifx \big:fn\:UnDef|<tail for file name|>#1%
3334 \else \big:fn\fi .\:html}%
3335 \else \let#1|=\:NxtNwFN \global\let\:NxtNwFN|=\:UnDef \fi
3336 \global\let\big:fn|=\:UnDef
3337 }
3338 \def\NextFile#1{\xdef\:NxtNwFN{#1}}
3339 >>>
3340
3341
3342
3343
3344 \<html cut points\><<<
3345 \def\:btfile#1{%
3346 \SaveEverypar \FileStream[#1]{\HP:file} \IgnorePar
3347 \gHAdvance\HPageDepth |by 1
3348 \AtEndHPage{\csname HPageFooter\endcsname}%
3349 \:hookI{HPageHeader}{}{#1}%
3350 }
3351 >>>
3352
3353
3354
3355
3356
3357 \SubSection{Specification Separated from Realization}
3358
3359 Split HPages must appear with reference keys (brackets).
3360
3361
3362
3363
3364 \<html cut points\><<<
3365 \def\HPageButton{\strt:bt\ch:bbtf}
3366 \def\ch:bbtf{\ifx -\:temp \expandafter\op:bbft
3367 \else \expandafter\:bbtf \fi}
3368 \def\:bbtf[#1]#2{%
3369 \:hookI{BeforeHPageButton}{}{#2}%
3370 \hpg:wrn{#1}{#2}\HPageButton
3371 \TagFile{|<fr bt fl|>\:temp}%
3372 \edef\HP:file{\RefFile\:temp}%
3373 \def\:temp{#2}\ifx \:temp\empty
3374 \else \HP:Link#2\EndLink \fi
3375 \:hookI{AfterHPageButton}{}{#2}%
3376 \csname AfterHPage\endcsname }
3377
3378 \def\op:bbft#1[#2]{%
3379 \:hookI{BeforeHPageButton}{}{}%
3380 \edef\:temp{#2}%
3381 \ifx \:temp\empty \:warning{\string\HPageButton-[]?}\fi
3382 \TagFile{|<fr bt fl|>\:temp}%
3383 \edef\HP:file{\RefFile\:temp}%
3384 \HP:Link%
3385 \def\ContHPage{\EndLink
3386 \:hookI{AfterHPageButton}{}{}%
3387 \csname AfterHPage\endcsname }}
3388 >>>
3389
3390
3391 \<html cut points\><<<
3392 \def\BeginHPage{\futurelet\:temp\ch:bbbt}
3393 \def\ch:bbbt{%
3394 |<entring file of hpage|>%
3395 \NewFileName\HP:file \Save:Link\HP:file
3396 \ifx -\:temp \expandafter\op:bbbt
3397 \else \expandafter\:bbbt \fi}
3398 \def\:bbbt[#1]#2{%
3399 \PushStack\:btid{#1}% |%aug 2003|%
3400 \:btfile{#2}%
3401 \:buttrc\BeginHPage{[#1]{#2}}%
3402 \PushStack\:afterbt\empty
3403 \hpg:wrn{#1}{#2}\BeginHPage \Save:HPageTag\:temp
3404 \Save:HPage{#2}%
3405 \TagFile{\:temp}}
3406 \def\op:bbbt#1[#2]{%
3407 \PushStack\:btid{#2}% |%aug 2003|%
3408 \:hookI{AfterHPageButton}{}{}%
3409 \:btfile{}%
3410 \:buttrc\BeginHPage{[#2]}%
3411 \PushStack\:afterbt\empty \edef\:temp{#2}%
3412 \ifx \:temp\empty \:warning{\string\BeginHPage-[]?}\fi
3413 \Save:HPageTag\:temp \Save:HPage{}%
3414 \TagFile{\:temp}}
3415 >>>
3416
3417
3418
3419
3420
3421 \SubSection{End HPage}
3422
3423 \`'\EndHPage[level]{bloc name}'
3424
3425 \List{$\bullet$}
3426
3427 \item \`'[level]' is optional. If present, all HPages, up to the
3428 specified level, are closed.
3429
3430 \item \`'block name'. If empty, a single HPage is closed. If
3431 non-empty, all HPages up-and-including the one with the given name
3432 are closed.
3433
3434 \EndList
3435
3436 \<html cut points\><<<
3437 \def\EndHPage{\futurelet\:temp\chEnd:HPage}
3438 \def\chEnd:HPage{\ifx [\:temp \expandafter\opEnd:HPage
3439 \else \expandafter\End:HPage \fi}
3440 \def\opEnd:HPage[#1]{%
3441 \ifnum #1>\HPageDepth\space
3442 \:warning{\string\EndHPage[#1]?}%
3443 \let\:temp|=\:gobble
3444 \else \ifnum #1<\HPageDepth\space
3445 \def\:temp{\:EndHPage\EndHPage[#1]{}}%
3446 \else \let\:temp|=\End:HPage \fi \fi
3447 \:temp }
3448
3449 \def\End:HPage#1{%
3450 \ifnum \HPageDepth<1 \:warning{\string\EndHPage{#1}?}\let\:temp|=\:gobble
3451 \else \ifinner\else\:clearpage\fi \PopStack\:btid\:tempa
3452 \def\:tempb{#1}\ifx \:tempb\empty\let\:temp|=\:EndHPage
3453 \else \ifx \:tempb\:tempa \let\:temp|=\:EndHPage
3454 \else \Recall:HPageTag\:tempa
3455 \Save:HPageTag\:tempa
3456 \ifx \:tempb\:tempa \let\:temp|=\:EndHPage
3457 \else \def\:temp{\:EndHPage\End:HPage{#1}}%
3458 \fi\fi\fi\fi
3459 \:temp }
3460
3461 \def\:EndHPage{%
3462 \csname EndHPage\HPageDepth \endcsname
3463 \global\expandafter\let\csname EndHPage\HPageDepth\endcsname|=\:UnDef
3464 \Recall:Link\HP:file \Recall:Link\:tempd \Save:Link\:tempd
3465 \Recall:HPage\:tempb
3466 \Recall:HPageTag\:tempc
3467 \:buttrc\EndHPage{{\:tempb}}%
3468 \EndFileStream{\HP:file}%
3469 |<leaving actual file of hpage|>%
3470 \FileStream{\:tempd}%
3471 \RecallEverypar \gHAdvance\HPageDepth |by -1
3472 \PopStack\:afterbt\:temp
3473 \ifx \:temp\empty \else \csname AfterHPage\endcsname \fi }
3474 >>>
3475
3476
3477 Overrides earlier defs, including the default.
3478
3479
3480 \<html cut points\><<<
3481 \def\AtEndHPage{%
3482 \expandafter\gdef\csname EndHPage\HPageDepth\endcsname}
3483 >>>
3484
3485
3486 \<html cut points\><<<
3487 \HAssign\HPageDepth|=0
3488 \PushStack\:btid{}
3489 >>>
3490
3491 %\NewStack\:btid
3492
3493 \<close HPages in @end\><<<
3494 \ifnum \HPageDepth> 0 \EndHPage[1]{}\fi
3495 |<document end for non-cut logical units|>%
3496 >>>
3497
3498
3499 \SubSection{Debugging}
3500
3501 \<html cut points\><<<
3502 \def\Save:FileHPg{\PushStack\HPage:FlHg}
3503 \def\Recall:FileHPg{\PopStack\HPage:FlHg}
3504 >>>
3505
3506 The \''\Recall:FileHPg' and \''Recall:Link' should give the
3507 same file if HPages are not stored in files, and when the files are
3508 not remote. CHECK!!!
3509
3510
3511 The following works with the actual files containing the
3512 hpages, instead of assuming that the files are of their parent
3513 hpages.
3514
3515
3516 \<leaving actual file of hpage\><<<
3517 %\Recall:FileHPg\:tempd
3518 >>>
3519
3520 \''HPage''s are not natural children of \''\FileStream':
3521 \''\EndHPage' don't touches pages, \''\FileStream'
3522 has no button name, \''\ExitHPage' might not work, etc (Recall that
3523 HPages must be consistent in seperated form of \''\HPageButton' with
3524 \''\beginHPage' and unified form of \''\HPage'.)
3525
3526
3527 \<entring file of hpage\><<<
3528 %\chk:hpfl
3529 >>>
3530
3531 \<html cut points\><<<
3532 \def\chk:hpfl{\Save:FileHPg\FileName \:FlHpg}
3533 \def\No:FlHpg{{\Recall:Link\HP:file \Save:Link\HP:file
3534 \edef\HP:file{\HP:file}\edef\FileName{\FileName}%
3535 \edef\HP:file{\expandafter\string\csname \HP:file\endcsname}%
3536 \edef\FileName{\expandafter\string\csname \FileName\endcsname}%
3537 \ifx \HP:file\FileName \else
3538 \:warning{HPage in a non-HPage file
3539 `\expandafter\:gobble\FileName'}%
3540 \fi}}
3541 \def\HPageInFile{\global\let\:FlHpg|=\empty}
3542 \def\NoHPageInFile{\global\let\:FlHpg|=\No:FlHpg}
3543 \NoHPageInFile
3544 >>>
3545
3546
3547
3548 Had \`'\yes:trc' and changed to \`'\yes:pic' without checking what I'm doing.
3549
3550 \<html debug\><<<
3551 \def\HTraceHPageOn{%
3552 \def\:buttrc##1##2{\no:pic \writesixteen{%
3553 l.\the\inputlineno -[\HPageDepth]- \string##1##2}\yes:pic
3554 }}
3555 \def\HTraceHPageOff{\def\:buttrc##1##2{}}
3556 \HTraceHPageOn
3557 >>>
3558
3559
3560
3561 \<no debug\><<<
3562 \def\:buttrc#1#2{}
3563 \let\HTraceHPageOn|=\empty
3564 \let\HTraceHPageOff|=\empty
3565 >>>
3566
3567 \SubSection{Utilities}
3568
3569
3570
3571 \<page-name is a file name?\><<<
3572 \expand:after{\bt:fn##1.}\:html|<par del|>%
3573 >>>
3574
3575 \<html cut points\><<<
3576 \expand:after{\def\bt:fn##1.}\:html#2|<par del|>{%
3577 \def\:temp{#2}\ifx \:temp\empty
3578 \else \NextFile{#1.\:html}\fi }
3579 >>>
3580
3581
3582 \`'\ExitHPage[mark]{title}'. The bracket mark is optional and
3583 it is introduced for marking the HPage with an NAME. If
3584 \`'\HPageButton'-\`'\BeginHPage' combination wouldn't have existed we
3585 could have used simpler code of the form \`'\Recall:Link\HP:file
3586 \Recall:Link\:tempb \Save:Link\:tempb \Save:Link\HP:file
3587 \Link[\:tempb]{\HP:file}{#1}#2\EndLink'.
3588 An empty title creates a default \`'exit <file title>'.
3589
3590
3591 Whenever we have cross-references in a html file (might be
3592 also indirect through a child) we want an exit HPage to save an
3593 annoying backtract through the visited path.
3594
3595 \<html cut points\><<<
3596 \Odef\ExitHPage[#1]#2{%
3597 \Recall:HPageTag\HP:file \Save:HPageTag\HP:file
3598 \Link[\RefFile{|<fr bt fl|>\HP:file}]{\RefFile{\HP:file}}{#1}%
3599 \def\:temp{#2}\ifx \:temp\empty
3600 \Recall:HPage\:temp \Save:HPage\:temp
3601 \ifx \:temp\empty \a:ExitHPage
3602 \else \b:ExitHPage \:temp \c:ExitHPage \fi
3603 \else #2\fi
3604 \EndLink
3605 }
3606 >>>
3607
3608 \<shared config\><<<
3609 \NewConfigure{ExitHPage}{3}
3610 >>>
3611
3612
3613
3614
3615 \<fr bt fl\><<<
3616 )B>>>
3617
3618
3619 \`'\RefHPage' can be used for the filename and HPage location.
3620
3621 \<html cut points\><<<
3622 \def\RefHPage{\RefFile}
3623 >>>
3624
3625 \<html cut points\><<<
3626 \def\Save:Link{\PushStack\HPageFiles}
3627 \def\Recall:Link{\PopStack\HPageFiles}
3628 \Save:Link{\jobname.\:html}
3629 \def\Save:HPage{\PushStack\HPageAnchors}
3630 \def\Recall:HPage{\PopStack\HPageAnchors}
3631 \def\Save:HPageTag{\PushStack\HPage:Tags}
3632 \def\Recall:HPageTag{\PopStack\HPage:Tags}
3633 >>>
3634
3635 %\NewStack\HPageFiles
3636 %\NewStack\HPageAnchors
3637 %\NewStack\HPage:Tags
3638
3639 %\NewStack\:afterbt
3640
3641
3642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3643 \Section{Requests for Cutpoints}
3644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3645
3646 Requests are made with commands of the form
3647 \`'\CutAt{division,terminators,...}'. A \`'division' that precedes
3648 with a \`'+' asks that the HPage will be visible.
3649
3650 \<html cut points\><<<
3651 \def\CutAt#1{%
3652 \if +\:firstch#1 //\:CutAt#1,//\else
3653 \if |<- TITLE|>\:firstch#1 //\:CutAt#1,//\else
3654 \:CutAt=#1,//\fi\fi
3655 }
3656 >>>
3657
3658
3659 \<html cut points\><<<
3660 \def\PauseCutAt#1{%
3661 \expandafter\ifx\csname Cut:#1\endcsname\relax\else
3662 \expandafter\ifx \csname NoCut:#1\endcsname\relax
3663 \expand:after{\expandafter\let\csname NoCut:#1\endcsname=}%
3664 \csname Cut:#1\endcsname
3665 \fi
3666 |<paused cut at|>%
3667 \fi }
3668 \def\ContCutAt#1{%
3669 \expandafter\ifx \csname NoCut:#1\endcsname\relax\else
3670 \expand:after{\expandafter\let\csname Cut:#1\endcsname=}%
3671 \csname NoCut:#1\endcsname
3672 \expandafter\let\csname Toc:#1\expandafter\endcsname\csname OToc:#1\endcsname
3673 \fi}
3674 >>>
3675
3676 e.g., \''PauseCutAt{section}'
3677
3678 \<paused cut at\><<<
3679 \expandafter\let\csname OToc:#1\expandafter\endcsname\csname Toc:#1\endcsname
3680 \expandafter\let\csname Toc:#1\endcsname=\relax
3681 \expandafter\let\csname Cut:#1\endcsname=\null
3682 \expandafter\def\csname Cut:#1\endcsname{%
3683 \gHAdvance \TitleCount 1
3684 \null \:gobble
3685 }%
3686 >>>
3687
3688
3689 % \expandafter\global \expandafter
3690 % \let\csname #1:Count\endcsname\TitleCount
3691
3692
3693
3694
3695 Intuitively, a conditional command \`'\UnCut:division' is prepended to
3696 \`'\division' and \`'\terminator'. When defined, it has the meaning
3697 of a EndHPage. Hence, implicity we have also a terminator at the end
3698 of the document.
3699
3700 The new commands are executed only if they are defined. The
3701 \`'\Cut:division' is defined by \`'\CutAt',
3702 the \`'\UnCut:division' is defined by \`'\Cut:division', and
3703 \`'\UnCut:division' undefines \`'\UnCut:division'. The hook for
3704 \`'Cut:division' is introduced in
3705 \LinkPort\<button for cut at sect\>{\tt<button for cut at sect>}\EndLink.
3706
3707
3708 \<html cut points\><<<
3709 \def\:CutAt#1#2,#3//{%
3710 \csname ltx:like\endcsname
3711 \expandafter\ifx \csname #2\endcsname \relax
3712 \:warning{\string\CutAt\space at undefined
3713 `\expandafter\string\csname#2\endcsname'}%
3714 \fi
3715 \csname ltx:nolike\endcsname
3716 |<modify current command|>%
3717 |<notify current division to higher ones in the hierarchy|>%
3718 |<overide default: open new file for current division|>%
3719 }
3720 >>>
3721
3722 \<shared config\><<<
3723 \NewConfigure{UndefinedSec}[1]{%
3724 \ifx \ltx:like\:UnDef \let\ltx:like|=\empty \let\ltx:nolike|=\empty \fi
3725 \append:def\ltx:like{\expandafter\let\csname #1\endcsname|=\empty}%
3726 \append:def\ltx:nolike{\expandafter\let\csname #1\endcsname|=\:UnDef}%
3727 }
3728 >>>
3729
3730 \<modify current command\><<<
3731 \expandafter\ifx \csname #2:\endcsname\relax
3732 \expand:after{\expandafter\let \csname #2:\endcsname |=}%
3733 \csname #2\endcsname
3734 \else \:warning{Again \string\CutAt{#2}?}%
3735 \fi
3736 \expandafter\def \csname #2\endcsname{%
3737 \csname UnCut:#2\endcsname
3738 \csname #2:\endcsname}%
3739 >>>
3740
3741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3742 \SubSection{Connection to Super Divisions}
3743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3744
3745 \<notify current division to higher ones in the hierarchy\><<<
3746 \:UnCutAt#2,#3,//%
3747 >>>
3748
3749 \<html cut points\><<<
3750 \def\:UnCutAt#1,#2,#3//{%
3751 \def\:temp{#2}\ifx \:temp\empty \else
3752 \def\:tempa{#1}\ifx \:tempa\:temp \else
3753 \expandafter\ifx \csname#2:#1\endcsname\relax
3754 |<uncut @1 at @2|>%
3755 \else \:warning{#2 already assumed in \string\CutAt{#1,...}}\fi
3756 \fi
3757 \def\:temp{\:UnCutAt#1,#3//}%
3758 \expandafter\:temp
3759 \fi
3760 }
3761 >>>
3762
3763
3764 \<uncut @1 at @2\><<<
3765 \expand:after{\expandafter\let \csname #2:#1\endcsname |=}%
3766 \csname #2\endcsname
3767 \expandafter\def \csname #2\endcsname{%
3768 \csname UnCut:#1\endcsname
3769 \csname #2:#1\endcsname}%
3770 >>>
3771
3772 %%%%%%%%%%%%%%%%%%%%
3773 \SubSection{HPages}
3774 %%%%%%%%%%%%%%%%%%%%
3775
3776 \<overide default: open new file for current division\><<<
3777 \expandafter\edef \csname Cut:#2\endcsname##1{%
3778 \noexpand\cut:at{#2}{##1}#1}%
3779 >>>
3780
3781 \<html cut points\><<<
3782 \def\cut:at#1#2#3{{%
3783 |<HPages for sec|>%
3784 |<large file name for @2|>%
3785 \if #3+\HPage<#1>{#2}%
3786 \else
3787 |<CutAt TITLE|>%
3788 \HPage<#1>{}\fi
3789 \ifx \prevCutAt\empty \else \TagFile{|<nxt but file|>\lastsec:id}\fi
3790 \AtEndHPage{|<prev/next at end of hpage|>\UnCut:{#1}}%
3791 \expandafter\xdef\csname UnCut:#1\endcsname{%
3792 \noexpand\EndHPage[\HPageDepth]{}}%
3793 }}
3794 \HAssign\lastsec:id|=0
3795 \def\cut:TTL#1{#1}
3796 >>>
3797
3798
3799
3800
3801 The following is for cut pages (typically, from sectioning commands).
3802
3803 \<CutAt TITLE\><<<
3804 \if #3|<- TITLE|>\else
3805 \let\cut:TTL|=\:gobble
3806 \begingroup
3807 \csname no:fonts\endcsname|<TITLE env|>\:CutAtTITLE:
3808 \xdef\:temp{\noexpand\Configure{TITLE+}{\a:CutAtTITLE{#2}}}%
3809 \endgroup \:temp
3810 \fi
3811 >>>
3812
3813 \<HPage TITLE\><<<
3814 \no:pic
3815 \edef\:temp{\noexpand\yes:pic \def\noexpand\:temp{#1}}\:temp
3816 \begingroup
3817 |<TITLE env|>\:HPageTITLE:
3818 \no:pic
3819 \edef\:tempa{\noexpand\yes:pic \def\noexpand\:tempa{#1}}\:tempa
3820 \xdef\:temp{\cut:TTL{\noexpand\Configure{TITLE+}{\a:HPageTITLE{\ifx
3821 \:temp\empty \file:name\else \:tempa\fi}}}}%
3822 \endgroup \:temp
3823 >>>
3824
3825 \<- TITLE\><<<
3826 ->>>
3827
3828 \<TITLE env\><<<
3829 \def\gobble:font##1##2{##2}%
3830 \:TITLE:
3831 >>>
3832
3833 The \''\gobble:font' is to remove the primitive font definitions of latex.
3834
3835 \<html cut points\><<<
3836 \let\:TITLE:|=\empty
3837 \let\:CutAtTITLE:|=\empty
3838 \let\:HPageTITLE:|=\empty
3839 >>>
3840
3841 \<html config util\><<<
3842 \NewConfigure{CutAtTITLE+}[1]{\def\a:CutAtTITLE{#1}}
3843 \NewConfigure{HPageTITLE+}[1]{\def\a:HPageTITLE{#1}}
3844 >>>
3845
3846
3847
3848 %%\NewStack\:head
3849
3850 \<nxt but file\><<<
3851 )N >>>
3852
3853
3854 \<html cut points\><<<
3855 \def\UnCut:#1{%
3856 |<disable empty delayed toc|>%
3857 \global\expandafter\let\csname UnCut:#1\endcsname|=\:UnDef
3858 \xdef\lastsec:id{\file:id}%
3859 \PopStack\prv:fl\:temp
3860 \bgroup
3861 \ifx\b:crsbt\empty
3862 \ifx\bb:crsbt\empty\else
3863 \:hookI{Back#1}{\default:bts{|<tail|>}{|<front|>}}{}%
3864 \fi
3865 \else
3866 \:hookI{Back#1}{\default:bts{|<tail|>}{|<front|>}}{}%
3867 \fi
3868 \csname b:CutAt#1\endcsname \let\after:endfl|=\EndFileStream
3869 \def\EndFileStream##1{\after:endfl{##1}\egroup
3870 |<AfterHPage for CutAt|>%
3871 |<pop btons|>%
3872 }}
3873 >>>
3874
3875
3876 We have here \`'\Configure{CutAt#1}{..}{..}' for any sectioning
3877 part. The sectioning commands of LaTeX have a
3878 \`'\Configure{section-type} {before-section} {after-section}
3879 {before-title}{after-title}' command that calls
3880 \`'\Configure{CutAt section-type} {before-section} {after-section}'
3881 to insert code at the start and end of the hypertext pages.
3882
3883 On the other hand \`'\Configure{+CutAt}{section-type}{before}{after}'
3884 offers delimiters for the buttons. The
3885 \`'\NewConfigure{CutAt}[1]{\Configure{CutAt#1}}' can be offered for
3886 consistency. DO WE NEED IT?
3887
3888 \<tail\><<<
3889 tail>>>
3890
3891
3892 \<disable empty delayed toc\><<<
3893 \global\expandafter\let\csname TocAt*\endcsname|=\empty
3894 >>>
3895
3896
3897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3898 \Section{Prev/Next Cut Buttons}
3899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3900
3901 \<AfterHPage for CutAt\><<<
3902 \PopStack\:afterbt\:temp
3903 \ifx\:temp\empty\else\:hookI{After#1}{}{}\fi
3904 \PushStack\:afterbt{}%
3905 >>>
3906
3907 \<HPages for sec\><<<
3908 \def\BeforeHPageButton{\if #3+%
3909 \def\:temp{\:hookI{Before#1Button}{\csname a:+CutAt#1\endcsname}}%
3910 \expandafter\:temp\fi}%
3911 \edef\prev:File{\ifnum \sec:lvl>\HPageDepth\space
3912 \RefFileNumber\lastsec:id \fi}%
3913 \def\AfterHPageButton{\if #3+%
3914 \def\:temp{\:hookI{After#1Button}{\csname b:+CutAt#1\endcsname}}%
3915 \expandafter\:temp\fi}%
3916 \def\HPageHeader##1{%
3917 |<prev/next at start of hpage|>%
3918 \xdef\nextCutAt{\RefFile{|<nxt but file|>\file:id}}%
3919 \global\let\prevCutAt|=\prev:File
3920 |<push HPages|>%
3921 \PushStack\prv:fl{#3}\csname a:CutAt#1\endcsname
3922 \ifx\a:crsbt\empty
3923 \ifx\aa:crsbt\empty\else
3924 \:hookI{Front#1}{\default:bts{|<front|>}{|<tail|>}}{##1}%
3925 \fi
3926 \else
3927 \:hookI{Front#1}{\default:bts{|<front|>}{|<tail|>}}{##1}%
3928 \fi
3929 }%
3930 >>>
3931
3932
3933 \<shared config\><<<
3934 \NewConfigure{+CutAt}[3]{%
3935 \expandafter\def\csname Before#1Button\endcsname##1{#2}%
3936 \expandafter\def\csname After#1Button\endcsname##1{#3}}
3937 >>>
3938
3939
3940 \<push HPages\><<<
3941 \sv:btns\nextCutAt
3942 \sv:btns\prevCutAt
3943 >>>
3944
3945
3946 \<html utilities\><<<
3947 \def\sv:btns#1{\ifx #1\space\global\let#1|=\empty \fi \PushStack\prv:fl#1}
3948 >>>
3949
3950 \<pop btons\><<<
3951 \PopStack\prv:fl\prevCutAt
3952 \PopStack\prv:fl\nextCutAt
3953 \ifx \prv:fl\empty
3954 \let\prevCutAt|=\:UndDef
3955 \let\nextCutAt|=\:UndDef
3956 \else
3957 \PopStack\prv:fl\:tempb
3958 \PopStack\prv:fl\prevCutAt
3959 \PopStack\prv:fl\nextCutAt
3960 \PushStack\prv:fl\nextCutAt
3961 \PushStack\prv:fl\prevCutAt
3962 \PushStack\prv:fl\:tempb
3963 \fi
3964 >>>
3965
3966
3967 \<html config util\><<<
3968 \NewConfigure{crosslinks}[8]{%
3969 \def\default:bts##1##2{%
3970 |<record cond buttons|>%
3971 \def\:temp{##1}\ifx \:temp\empty
3972 \ifx\a:crsbt\empty\ifx \aa:crsbt\empty |<remove buttons|>\fi\fi
3973 \a:crsbt
3974 \else
3975 \ifx\b:crsbt\empty\ifx \bb:crsbt\empty |<remove buttons|>\fi\fi
3976 \b:crsbt
3977 \fi
3978 \def\CLB:next{\expandafter\cond:bt\next:bt{}{#3}}%
3979 |<prev for leading node in option `next'|>%
3980 \def\CLB:prev{\expandafter\cond:bt\prev:bt{}{#4}}%
3981 \def\CLB:prevtail{\expandafter\cond:bt\prev:bt{|<tail|>\prev:bt}{#5}}%
3982 |<front/tail button|>%
3983 \def\:temp{#8}\ifx \:temp\empty \else
3984 \ifx \cond:bt\:gobbleIII
3985 \else \def\CLB:up{\def\:temp{#8}#1\ExitHPage{#8}#2}\fi\fi
3986 |<insert cross link buttons|>%
3987 |<restore cond buttons|>%
3988 \def\:temp{##1}\ifx \:temp\empty \aa:crsbt\else \bb:crsbt\fi
3989 |<tail target|>}%
3990 |<set linkless buttons|>%
3991 }
3992 \NewConfigure{crosslinks+}[4]{%
3993 \def\a:crsbt{#1}\def\aa:crsbt{#2}\def\b:crsbt{#3}\def\bb:crsbt{#4}}
3994 \NewConfigure{crosslinks-}[2]{%
3995 \def\a:cond:bt{#1}\def\b:cond:bt{#2}}
3996 >>>
3997
3998
3999 \<set linkless buttons\><<<
4000 \def\cond:bt##1##2##3{%
4001 \expandafter\ifx\csname a:cond:bt\endcsname \relax
4002 \ifx ##1\empty \else
4003 \def\:temp{##3}\ifx \:temp\empty \else
4004 #1\Link[##1]{##2}{}##3\EndLink #2%
4005 \fi \fi
4006 \else
4007 \ifx ##1\empty
4008 |<set a linkless button|>%
4009 \else
4010 \def\:temp{##3}\ifx \:temp\empty \else
4011 #1\Link[##1]{##2}{}##3\EndLink #2%
4012 \fi \fi
4013 \fi
4014 }%
4015 >>>
4016
4017
4018 \<set a linkless button\><<<
4019 \def\:temp{next}\ifx \:temp\cur:bt \else
4020 \ifx \c:next:\:gobbleII \else \let\:temp=\empty \fi
4021 \fi
4022 \ifx \:temp\empty \else
4023 \ifx \a:cond:bt\empty \ifx \b:cond:bt\empty #1\else
4024 \a:cond:bt\fi
4025 \else \a:cond:bt\fi
4026 ##3%
4027 \ifx \a:cond:bt\empty \ifx \b:cond:bt\empty #2\else
4028 \b:cond:bt\fi
4029 \else \b:cond:bt\fi
4030 \fi
4031 >>>
4032
4033
4034
4035 \<insert cross link buttons\><<<
4036 \CLB:menu
4037 >>>
4038
4039 \<\><<<
4040 \csname CLB:next\endcsname %1
4041 %
4042 \csname CLB:prevup\endcsname %2
4043 \csname CLB:prev\endcsname %5
4044 %
4045 \csname CLB:prevtailup\endcsname %3
4046 \csname CLB:prevtail\endcsname %6
4047 %
4048 \csname CLB:tail\endcsname %7
4049 %
4050 \csname CLB:front\endcsname %8
4051 %
4052 \csname CLB:up\endcsname %9
4053 >>>
4054
4055
4056 \<html config util\><<<
4057 \expandafter\def\csname c:crosslinks*:\endcsname{%
4058 \let\CLB:menu\empty \CLB:menuitem }
4059 \def\CLB:menuitem#1{%
4060 \def\:tempa{#1}\ifx \:tempa\empty \else
4061 \append:def\CLB:menu{\csname a:crosslinks:#1\endcsname
4062 \def\cur:bt{#1}\csname CLB:#1\endcsname
4063 }%
4064 \def\:temp{prev}\ifx \:temp\:tempa
4065 \append:def\CLB:menu{\csname a:crosslinks:prev\endcsname
4066 \csname CLB:prevup\endcsname
4067 }%
4068 \else
4069 \def\:temp{prevtail}\ifx \:temp\:tempa
4070 \append:def\CLB:menu{%
4071 \csname a:crosslinks:prev\endcsname
4072 |<prevtail hook|>%
4073 \csname CLB:prevtailup\endcsname
4074 }%
4075 \fi \fi
4076 \expandafter\CLB:menuitem
4077 \fi
4078 }
4079 \Configure{crosslinks*}
4080 {next}
4081 {prev}
4082 {prevtail}
4083 {tail} {front}
4084 {up}
4085 {}
4086 \NewConfigure{crosslinks:next}{1}
4087 \NewConfigure{crosslinks:prev}{1}
4088 \NewConfigure{crosslinks:prevtail}{1}
4089 \NewConfigure{crosslinks:tail}{1}
4090 \NewConfigure{crosslinks:front}{1}
4091 \NewConfigure{crosslinks:up}{1}
4092 >>>
4093
4094
4095
4096 \<record cond buttons\><<<
4097 \let\sv:cond:bt|=\cond:bt
4098 >>>
4099
4100 \<restore cond buttons\><<<
4101 \let\cond:bt|=\sv:cond:bt
4102 >>>
4103
4104 \<remove buttons\><<<
4105 \let\cond:bt|=\:gobbleIII
4106 >>>
4107
4108
4109
4110
4111 \`'\Configure{crosslinks+}
4112 {before-front-links}{after-front-link}
4113 {before-back-link}{after-back-link}'
4114
4115
4116 \<front/tail button\><<<
4117 \def\:temp{##2}%
4118 \ifx \:temp\empty
4119 \def\:temp{#6}%
4120 \ifx \:temp\empty \else
4121 \def\CLB:tail{\def\:temp{#6}#1\Link[\RefFileNumber\file:id]{}{}#6\EndLink #2}\fi
4122 \else
4123 \def\:temp{#7}%
4124 \ifx \:temp\empty \else
4125 \def\CLB:front{\def\:temp{#7}#1\Link{##2\RefFileNumber\file:id}{}#7\EndLink #2}\fi
4126 \fi
4127 >>>
4128
4129 Neds the \''\expandafter' above because \''\Link' modifies \''\:te:mp'.
4130
4131 \<tail target\><<<
4132 \def\:temp{##1}\ifx \:temp\empty \else
4133 \ifx\yes:tail\def
4134 \Link{}{##1\RefFileNumber\file:id}\EndLink
4135 \fi \fi
4136 >>>
4137
4138 \<prevtail hook\><<<
4139 \ifx\a:crsbt\empty\else \let\yes:tail\def\fi
4140 \ifx\aa:crsbt\empty\else \let\yes:tail\def\fi
4141 \ifx\b:crsbt\empty\else \let\yes:tail\def\fi
4142 \ifx\bb:crsbt\empty\else \let\yes:tail\def\fi
4143 >>>
4144
4145 %\NewStack\prv:fl
4146
4147 \<html cut points\><<<
4148 \let\prevCutAt|=\empty
4149 >>>
4150
4151
4152 \''french.sty' chages the definition of \''\special' and that creates
4153 problems for tex4ht. Hence, the following redefdinition. When
4154 \''french.sty' and the likes are not around we can't just go for
4155 \''\let\ht:special=\special' because when the special is written out
4156 we don't \''\ht:special' there. Hence the configure.
4157
4158 \<early utilities\><<<
4159 \NewConfigure{special}[1]{\def\ht:special{#1}}
4160 \Configure{special}{|<default special|>}
4161 >>>
4162
4163 \<default special\><<<
4164 \special
4165 >>>
4166
4167 %\let\real:special|=\special
4168 %\NewConfigure{special}[1]{\def\ht:special{#1}}
4169 %\Configure{special}
4170 % {\ifx \real:special\special \expandafter\special
4171 % \else \expandafter\real:special\fi}
4172
4173
4174 \<html Configure's\><<<
4175 \edef\:temp{\string\special}
4176 \edef\:tempa{\meaning\special}
4177 \ifx \:temp\:tempa \else
4178 \def\:temp{|<default special|>}
4179 \ifx \:temp\ht:special
4180 \:warning{Redefined \string\special. Might
4181 need \string\Configure{special}{<system-special>}}
4182 \fi\fi
4183 >>>
4184
4185 \<protect from /special redef\><<<
4186 \let\special|=\relax
4187 >>>
4188
4189
4190 \<early utilities\><<<
4191 \long\def\expand:after#1{\def\e:tmp{#1}\expandafter\e:tmp}
4192 >>>
4193
4194
4195
4196 \<tempa := new file; tempb := old file\><<<
4197 \tmp:cnt|=\maxfile:id \advance\tmp:cnt |by 1
4198 \edef\HP:file{\j:bname |<tail for file name|>\tmp:cnt }%
4199 \xdef:cs{in:fid:#1}{\file:id}%
4200 \edef\:tempb{\RefFileNumber{\file:id}}%
4201 >>>
4202
4203
4204
4205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4206 \SubSection{The `next' Option}
4207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4208
4209
4210
4211
4212 \<html cut points\><<<
4213 \:CheckOption{next} \if:Option
4214 \def\next:bt{\nextCut}
4215 \def\prev:bt{\prevCut}
4216 \else
4217 \Log:Note{for linear crosslinks of pages,
4218 use the command line option `next'}%
4219 \def\next:bt{\nextCutAt}
4220 \def\prev:bt{\prevCutAt}
4221 \fi
4222 >>>
4223
4224 \<early utilities\><<<
4225 \def\Log:Note#1{%
4226 \immediate\write-1{--------------------------------------}%
4227 \immediate\write-1{--- Note --- #1}%
4228 \immediate\write-1{--------------------------------------}%
4229 }
4230 >>>
4231
4232 \<prev/next at end of hpage\><<<
4233 \ct:btn
4234 >>>
4235
4236 \<prev/next at start of hpage\><<<
4237 \ct:btn
4238 \gHAdvance\C:tAtN |by 1
4239 \Tag{fileidcut \file:id}{\C:tAtN}%
4240 \TagFile{cutfile \C:tAtN}%
4241 >>>
4242
4243 \<html cut points\><<<
4244 \HAssign\C:tAtN |= 0
4245 \def\ct:btn{{%
4246 \HAssign\C:tAtN |= 0\LikeRef{fileidcut \file:id}%
4247 \Advance:\C:tAtN |by -1
4248 \xdef\prevCut{\RefFile{cutfile \C:tAtN}}%
4249 \ifx \prevCut\space \global\let\prevCut|=\empty \fi
4250 \Advance:\C:tAtN |by 2
4251 \xdef\nextCut{\RefFile{cutfile \C:tAtN}}%
4252 \ifx \nextCut\space \global\let\nextCut|=\empty \fi
4253 }}
4254 >>>
4255
4256 \<prev for leading node in option `next'\><<<
4257 \ifx \prevCut\empty
4258 \def\:temp{\prevCut}\ifx \:temp\prev:bt
4259 \Recall:HPageTag\HP:file \Save:HPageTag\HP:file
4260 \def\:temp{#4}\ifx \:temp\empty \else
4261 \def\CLB:prevup{%
4262 \def\:temp{#4}#1\Link[\RefFile{|<fr bt fl|>\HP:file}]{}{}#4\EndLink #2}%
4263 \fi
4264 \def\:temp{#5}\ifx \:temp\empty \else
4265 \def\CLB:prevtailup{%
4266 \def\:temp{#5}#1\Link[\RefFile{|<fr bt fl|>\HP:file}]{tail\Jobname
4267 }{}#5\EndLink #2}%
4268 \fi
4269 |<next button in root of `next' option|>%
4270 \fi \fi
4271 >>>
4272
4273 % \expandafter\cond:bt\prev:bt{}{%... add march 25, 2005
4274
4275 \<next button in root of `next' option\><<<
4276 \long\def\:tempb####1####2{\gdef\root:next{%
4277 \def\:temp{####2}\edef\HP:file{\RefFileNumber\file:id}%
4278 \ifx \:temp\HP:file
4279 \global\let\root:next|=\empty
4280 \def\:temp{#3}\ifx \:temp\empty
4281 \Link{}{tail\Jobname}\EndLink
4282 \else
4283 \expandafter\ifx \csname a:next+\endcsname\relax #1\else
4284 \csname a:next+\endcsname \fi
4285 \expandafter\ifx \csname a:next\endcsname\relax
4286 \def\:next{#3}%
4287 \else \let\:next\a:next \fi
4288 \ifx \:next\empty
4289 \Link{}{tail\Jobname}\EndLink
4290 \else
4291 \Link[####1]{}{tail\Jobname}\:next\EndLink
4292 \fi
4293 \expandafter\ifx \csname b:next+\endcsname\relax #2\else
4294 \csname b:next+\endcsname \fi
4295 \fi \fi}}%
4296 \edef\:temp{\noexpand\:tempb
4297 {\RefFileNumber\file:id}{\RefFile{|<fr bt fl|>\HP:file}}}%
4298 \:temp
4299 >>>
4300
4301 \<html cut points\><<<
4302 \let\root:next|=\empty
4303 >>>
4304
4305
4306 \<html config util\><<<
4307 \NewConfigure{next}[1]{\def\a:next{#1}}
4308 \NewConfigure{next+}[2]{%
4309 \expandafter\def\csname a:next+\endcsname{#1}%
4310 \expandafter\def\csname b:next+\endcsname{#2}}
4311 >>>
4312
4313
4314
4315
4316
4317
4318
4319 \<elements for cut points\><<<
4320 \:CheckOption{next} \if:Option \else
4321 \let\c:next:|=\:gobbleII
4322 \fi
4323 >>>
4324
4325
4326 %%%%%%%%%%%%%
4327 \SubSection{File Naming}
4328 %%%%%%%%%%%%%
4329
4330
4331
4332 \<HPages for sec\><<<
4333 \csname a:CutAt-filename\endcsname{#1}{#2}%
4334 >>>
4335
4336 \<early utilities\><<<
4337 \NewConfigure{CutAt-filename}[1]{%
4338 \expandafter\def\csname a:CutAt-filename\endcsname##1##2{#1}}
4339 \Configure{CutAt-filename}{}
4340 >>>
4341
4342
4343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4344 \Section{Grouping Mecahanism for CutAt}
4345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4346
4347 A \`'\CutGroup{ChGroup,Chapter,LikeChapter,Appendix}' allows unified
4348 requests of the form \`'\CutAt{ChGroup,Part}'.
4349
4350 \<html cut points\><<<
4351 \def\CutGroup#1{\Cut:Group#1,,|<par del|>}
4352 \def\Cut:Group#1,{%
4353 \expandafter\ifx \csname #1\endcsname\relax
4354 \expandafter\let\csname #1\endcsname|=\:gobble\fi
4355 \def\HP:file{#1}%
4356 \do:list \cut:gr,}
4357 >>>
4358
4359
4360
4361
4362 The \`'\CutGroup{group,division}' replaces \`'\division{#1}'
4363 with \`'\group{#1}\division{#1}', and \`'\Cut:division{#1}'
4364 with \`'\Cut:group{#1}\Cut:division{#1}'.
4365
4366 \<tex html cut points\><<<
4367 \def\cut:gr#1{%
4368 \edef\:temp{%
4369 \let\:csname \HP:file :#1\endcsname |=\:csname #1\endcsname
4370 \let\:csname \HP:file :Cut:#1\endcsname |=\:csname Cut:#1\endcsname
4371 \def\:csname #1\endcsname####1{%
4372 \noexpand\cond:cs{\HP:file}{####1}%
4373 \:csname \HP:file :#1\endcsname{####1}}%
4374 \def\:csname Cut:#1\endcsname####1{%
4375 \noexpand\cond:cs{Cut:\HP:file}{####1}%
4376 \noexpand\cond:cs{\HP:file :Cut:#1}{####1}}%
4377 }\:temp }
4378 >>>
4379
4380
4381 \SubSection{Utilities}
4382
4383
4384 \<general utilities\><<<
4385 \def\cond:cs#1#2{%
4386 \expandafter\ifx \csname #1\endcsname\relax \else
4387 \csname #1\endcsname{#2}%
4388 \fi
4389 }
4390 \def\do:list#1,#2,{%
4391 \def\:temp{#2}\ifx \:temp\empty \expandafter\stop:do
4392 \else #1{#2}\fi
4393 \do:list#1,}
4394 \def\stop:do#1|<par del|>{}
4395 >>>
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411 \Chapter{Coauthoring}
4412
4413
4414
4415 \<imports\><<<
4416 |<import-export interface|>
4417 \:CheckOption{family} \if:Option
4418 |<import-export commands|>
4419 |<imports utilities|>
4420 \else
4421 |<no import-export|>
4422 \fi
4423 >>>
4424
4425
4426
4427
4428
4429
4430
4431 \<general utilities\><<<
4432 \def\BI:gbl{\ifx [\:temp \expandafter\bi:gbl\else
4433 \expand:after{\bi:gbl[]}\fi}
4434 \def\bi:gbl[#1]#2{}
4435 >>>
4436
4437
4438 \<html utilities\><<<
4439 \def\ro:nd#1#2{%
4440 \gHAdvance#1 |by #2
4441 \gHDivide#1 |by #2
4442 \gHMultiply#1 |by #2 }
4443 >>>
4444
4445 \Section{The Commands}
4446
4447 The extension for the name should refer to the \`'xref' file,
4448 and if omitted an \`'.xref' is aasumed.
4449
4450 \<import-export interface\><<<
4451 \def\ParentOf{\gHAdvance\TitleCount 1
4452 \global\let\mu:span|=\TitleCount \futurelet\:temp\:mprt}
4453 >>>
4454
4455 \<no import-export\><<<
4456 \let\:mprt|=\BI:gbl
4457 >>>
4458
4459
4460 \<import-export commands\><<<
4461 \def\:mprt{\fm:call\:Imprt}
4462
4463 \def\:Imprt[#1]#2#3{%
4464 \def\:temp{#2}\ifx \:temp\Jobname
4465 \:warning{#2 \string\ParentOf\space#2?}\fi
4466 \Needs-{child `#2'}%
4467 \LoadRef[|<screen ref from child @2|>]{#3}{##1}%
4468 \imp:var{#2}fstf:id,#1|<par del|>%
4469 |<send links from parent to child|>%
4470 \the\:tokwrite{\string\doTocEntry
4471 \string\tocParentOf{#2}{}{}\relax}}
4472
4473 \HAssign\fstf:id|=0
4474 >>>
4475
4476
4477
4478
4479 \<import-export interface\><<<
4480 \def\ChildOf{\futurelet\:temp\:xprt}
4481 >>>
4482
4483 \<no import-export\><<<
4484 \Odef\ChildOf[#1]#2{\:warning{\string\ChildOf{#2}
4485 without \string\Preamble{...,family,...}}}
4486 \let\:xprt|=\BI:gbl
4487 >>>
4488
4489
4490
4491
4492 \<import-export commands\><<<
4493 \def\:xprt{\fm:call\:Exprt}
4494
4495 \def\:Exprt[#1]#2#3{%
4496 \ifnum \maxfile:id>1
4497 \:warning{\string\ChildOf{#2} not at root file}\fi
4498 \Needs-{parent `#2'}%
4499 \ld:flxrf{#3}{|<toc tag|>}%
4500 \LoadRef[|<screen ref from parent @2|>]{#3}{##1}%
4501 \xp:var{#2}fstf:id,#1|<par del|>%
4502 |<adjust file ids info up|>%
4503 \def\export:hook{\exprt:tag{#2}fstf:id,#1|<par del|>}%
4504 |<send links from child to parent|>%
4505 \gdef\:Export[##1]##2{\:warning{\string\ChildOf
4506 \string{##2\string}\space ignored (not 1st)}}%
4507 }
4508 >>>
4509
4510
4511
4512
4513
4514 \<import-export commands\><<<
4515 \def\rmv:ext#1.#2|<par del|>{#1}
4516
4517 \def\fm:call#1{\ifx [\:temp \expand:after{\fm:cll#1}\else
4518 \expand:after{\fm:cll#1[]}\fi}
4519 \def\fm:cll#1[#2]#3{\edef\:temp{\noexpand\noexpand\noexpand
4520 #1[#2]{\noexpand\rmv:ext#3.|<par del|>}{#3}}%
4521 \edef\:temp{\:temp}\:temp}
4522 >>>
4523
4524
4525
4526 \SubSection{Links}
4527
4528
4529 \<send links from parent to child\><<<
4530 \Tag{|<screen tag to child @2|>-up}{\RefFileNumber\FileNumber}%
4531 \Tag{|<screen tag to child @2|>-prev}{\childFile}%
4532 \xdef\childFile{\LikeRef{|<screen ref from child @2|>-down}}%
4533 \ifx \cld:n\:UnDef \else \Tag{\cld:n}{\childFile}\fi
4534 \xdef\cld:n{|<screen tag to child @2|>-next}%
4535 >>>
4536
4537
4538
4539 \<send links from child to parent\><<<
4540 \Tag{|<screen tag to parent @2|>-down}{\RefFileNumber\FileNumber}%
4541 \ch:lnk\parentFile{#2}{up}%
4542 \ch:lnk\prevChildFile{#2}{prev}%
4543 \ch:lnk\nextChildFile{#2}{next}%
4544 \global\let\nsrt:chlnks|=\nsrt:cldnks
4545 \nsrt:chlnks{|<front|>}{|<tail|>}{FrontChild}%
4546 >>>
4547
4548 We need in \`'\childFile' initially a space and not empty, because
4549 otherwise Ref will produce the page number.
4550
4551
4552 \<import-export commands\><<<
4553 \let\childFile|=\space
4554 \def\ch:lnk#1#2#3{%
4555 \xdef#1{\LikeRef{|<screen ref from parent @2|>-#3}}%
4556 \ifx #1\space \let#1|=\empty\fi}
4557 >>>
4558
4559 Note that the following might be a problem for when HPage
4560 is nested in regular file.
4561
4562 \<import-export commands\><<<
4563 \def\nsrt:cldnks#1#2#3{{%
4564 \let\prevCutAt|=\prevChildFile
4565 \let\nextCutAt|=\nextChildFile
4566 \def\ExitHPage##1{\Link[\parentFile]{}{}##1\EndLink}
4567 \:hookI{#3}{\default:bts{#1}{#2}}{}}}
4568 >>>
4569
4570 \<buttons at end of child\><<<
4571 \root:next
4572 \ifx \nsrt:chlnks\:UnDef
4573 \else \nsrt:chlnks{|<tail|>}{|<front|>}{BackChild}\fi
4574 >>>
4575
4576 \Section{Values in Variables}
4577
4578 \<import-export commands\><<<
4579 \def\imp:var#1#2,#3|<par del|>{%
4580 \gt:ops{#2}%
4581 \Tag{|<screen tag to child @1|>-#2}{|<the|>\csname #2\endcsname}%
4582 \edef|<temp|>{0\LikeRef{|<screen ref from child @1|>-#2}}%
4583 \expand:after{\expandafter|<advance|>\csname
4584 #2\endcsname |by }|<temp|>%
4585 \if:notempty{#3}{\imp:var{#1}#3,|<par del|>}}
4586 >>>
4587
4588 A child transfers up the changes made to a counter, not an absolute
4589 value. The entry value is recorded in \`'\csname :#2:\endcsname'.
4590
4591 \<import-export commands\><<<
4592 \def\xp:var#1#2,#3|<par del|>{%
4593 \gt:ops{#2}%
4594 \edef|<temp|>{0\LikeRef{|<screen ref from parent @1|>-#2}}%
4595 \expandafter|<assign|>\csname #2\endcsname|=|<temp|>
4596 \expandafter\HAssign\csname :#2:\endcsname|=|<temp|>
4597 \if:notempty{#3}{\xp:var{#1}#3,|<par del|>}}
4598 >>>
4599
4600 \<import-export commands\><<<
4601 \def\exprt:tag#1#2,#3|<par del|>{%
4602 \tmp:cnt |= \csname #2\endcsname
4603 \advance\tmp:cnt |by -\csname :#2:\endcsname
4604 \Tag{|<screen tag to parent @1|>-#2}{\the\tmp:cnt}%
4605 \if:notempty{#3}{\exprt:tag{#1}#3,|<par del|>}}
4606 >>>
4607
4608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4609 \SubSection{Overide Previous Files}
4610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4611
4612
4613 The \''\:clearpage' is needed below to clear the old tags and xref
4614 files, before new ones start to come. The \''\Tag' few lines below can be lost.
4615
4616 \<adjust file ids info up\><<<
4617 \closeout\:refout
4618 \openout\:refout|=\jobname.xref \:clearpage
4619 |<fix point for file ids at child|>%
4620 \gHAssign\maxfile:id |= \fstf:id
4621 \gHAssign\bs:fileid |= \maxfile:id
4622 \global\let\file:id|=\maxfile:id
4623 \Tag{|<auto file tag|>\file:id |<Tag/Ref: file-id -> file-name|>}%
4624 {\jobname.\:html}%
4625 \expandafter\xdef\csname
4626 |<csname: file name -> file id|>\jobname.\:html\endcsname{\file:id}%
4627 \xdef:cs{|<live|>\file:id}{}%
4628 >>>
4629
4630
4631 \<file not overided by /ChildOf\><<<
4632 \csname FN #1\endcsname > \bs:fileid
4633 >>>
4634
4635
4636 \SubSection{Contain Changes}
4637
4638
4639 We want to reduce the number of compilations due to changes. We can't do
4640 much with sectioning numbers, but we can do quite a lot with labels of
4641 links. Note that the addresses are made up of file numbers + label numbers.
4642
4643 We make the children `fix-points' with respect to file numbers, by
4644 allocating them addresses that are equal to `child-id * 10000'. We
4645 make here an assumption that a compilation will not generate more than
4646 9999 files.
4647
4648
4649 \<fix point for file ids at child\><<<
4650 \gHAdvance\fstf:id |by 100000
4651 >>>
4652
4653 It would be nice to have also fix-points for file ids within children,
4654 but this will cause holes. The holes will result in fake names
4655 \`'\csname filei-d\endcsname' which unneccesariliy consume ids and can
4656 overflow the memory quite quickly. This names are inspected at points
4657 that files are closed, and checking is performed for opened subfiles.
4658
4659
4660 We can also ask that large files will provide fixed-points. We do so
4661 with the following command, which so far is used only at cut
4662 points. It requests distinguished automatically generated file names
4663 for the class that is identified by the two leading characters of the
4664 given parameter (i.e., sectioning type in case of the cut points).
4665 These are really not fixed point, because they don't fix unique file
4666 names (e.g., by rounding up file ids).
4667
4668 \<large file name for @2\><<<
4669 \fx:pt #1xxx|<par del|>%
4670 >>>
4671
4672 Do we want \`' \ro:nd\html:lbl{100000}%' below?
4673
4674 \<html utilities\><<<
4675 \def\fx:pt#1#2#3|<par del|>{%
4676 \expandafter\ifx \csname big:#1:#2\endcsname\relax
4677 \expandafter\gHAssign\csname big:#1:#2\endcsname |= 0 \fi
4678 \expandafter\gHAdvance\csname big:#1:#2\endcsname |by 1
4679 \edef\big:fn{#1#2\csname big:#1:#2\endcsname}}
4680 >>>
4681
4682
4683
4684 On the other hands, we try to make sectioning commands fixed points
4685 for labels. Hence, we try to reduce sensitivity of tocs to changes.
4686 See \`'\<round ids between sections\>'
4687
4688
4689
4690
4691 The validity of the above fixed points carries on as far as the
4692 specified points are really fixed. If they become fluid, then
4693 everything becomes fluid.
4694
4695
4696
4697
4698
4699
4700
4701
4702 To get evrything working, we need 4 compilations (in modifications
4703 less might be sufficient).
4704
4705 \List{ord}
4706
4707 \item A compilation to create the starting file number for each node
4708 (child/ parent). That is, fix file numbers for children.
4709
4710 \item A compilation for using the right file numbers, and to create
4711 the correct tags within the tocs.
4712 That is, to collect moveable information like tables of
4713 contents and relationships between files.
4714
4715 \item A compilation to use the right tags, and to create the right
4716 xref for the tags in the tocs
4717 That is, to collect cross-references from moveable info.
4718
4719 \item A compilation to incorporate the cross refs
4720
4721 \EndList
4722
4723
4724
4725 \SubSection{Cross-Reference Screening}
4726
4727 \''\Jobname' has been introduced for \''\LoadRef[..]'
4728
4729 \<screen ref from child @2\><<<
4730 #2-\Jobname>>>
4731
4732 \<screen ref from child @1\><<<
4733 #1-\Jobname>>>
4734
4735 \<screen ref from parent @2\><<<
4736 #2-\Jobname>>>
4737
4738 \<screen ref from parent @1\><<<
4739 #1-\Jobname>>>
4740
4741 \<screen tag to child @1\><<<
4742 \Jobname-#1>>>
4743
4744 \<screen tag to child @2\><<<
4745 \Jobname-#2>>>
4746
4747 \<screen tag to parent @1\><<<
4748 \Jobname-#1>>>
4749
4750 \<screen tag to parent @2\><<<
4751 \Jobname-#2>>>
4752
4753
4754
4755
4756 \Section{Tables of Content}
4757
4758
4759
4760
4761 The are needed because some variables are of TeX and others
4762 are of TeX4ht.
4763
4764
4765
4766 \<imports\><<<
4767 \def\tocParentOf#1{{%
4768 \def\:temp{#1}\ifx \:temp\Jobname
4769 \:warning{#1 \string\ParentOf\space#1?}
4770 \else \expand:after{\ld:flxrf{#1}{|<toc tag|>}\get:input{#1.4tc}}\fi}}
4771 >>>
4772
4773
4774 \Section{Load File and Link Xref of Relative}
4775
4776
4777 \<imports\><<<
4778 \def\ld:flxrf#1#2{%
4779 \let\:CrsWd|=\Cross:Word
4780 \def\Cross:Word##1##2{%
4781 \expandafter\let\csname |<tag of Tag|>##2\endcsname|=\:UnDef
4782 \:CrsWd{##1}{##2}}%
4783 \LoadRef[|<auto file tag|>]{#1}{##1}%
4784 \LoadRef[|<HTag tag|>#2]{#1}{##1}%
4785 \let\Cross:Word|=\:CrsWd
4786 }
4787 >>>
4788
4789
4790
4791
4792
4793
4794
4795 \SubSection{Local Utilities}
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813 The following are needed because some variables are of TeX and others
4814 are of TeX4ht.
4815
4816 \<imports utilities\><<<
4817 \def\gt:vi#1#2#3#4#5#6#7|<par del|>{#1#2#3#4#5#6}
4818 \def\gt:vr#1#2{\edef#1{\expandafter
4819 \gt:vi\meaning#2 .......|<par del|>}}
4820 \gt:vr\c:unt\tmp:cnt
4821 \def\chk:vr#1#2{\expand:after{\gt:vr\:temp#2 #1\:temp\c:unt}}
4822
4823 \def\gt:ops#1{%
4824 \expand:after{\chk:vr\ifx}\csname#1\endcsname \let|<the|>|=\the
4825 \let|<assign|>|=\empty \let|<advance|>|=\advance
4826 \else \let|<the|>|=\empty
4827 \let|<assign|>|=\HAssign \let|<advance|>|=\Advance:
4828 \fi }
4829 >>>
4830
4831 \<assign\><<<
4832 \:tempa>>>
4833
4834 \<advance\><<<
4835 \:tempb>>>
4836
4837 \<temp\><<<
4838 \:tempc>>>
4839
4840 \<the\><<<
4841 \:tempd>>>
4842
4843
4844
4845
4846
4847
4848 \Chapter{Subdivisions}
4849
4850
4851 \<divisions\><<<
4852 |<elements for divs|>
4853 |<no trace sec config|>
4854 \ifHtml |<html divs|>
4855 \:CheckOption{hooks+} \if:Option
4856 \else \:CheckOption{hooks} \fi
4857 \if:Option |<trace sec config|>\fi
4858 \fi
4859 |<tex divisions|>
4860 >>>
4861
4862
4863
4864 \Section{Interface}
4865
4866 The first parameter of \`'\Def:Section' provides the command name, the
4867 second gives a non-parametric code that produces the title number, and
4868 the third gives a single-parameter code for producing the title
4869 itself.
4870
4871
4872
4873 \<elements for divs\><<<
4874 \long\def\NewSection#1#2{%
4875 \Def:Section#1{#2}{##1}%
4876 \edef\:temp{\expandafter\:gobble\string#1}%
4877 \Configure:Sec\:temp{}{}{}{}%
4878 \ConfigureToc{\expandafter\:gobble\string#1}{\empty}{\empty}{}{}}
4879 >>>
4880
4881
4882 \`'\NewSection\DocChapter {counter}'
4883
4884 The parameter \`'##1' holds the title head.
4885
4886
4887 \<endsection config\><<<
4888 \NewConfigure{end#1}[1]{\expandafter
4889 \def\csname a:end#1\endcsname{##1}}%
4890 \Configure{end#1}{}
4891 >>>
4892
4893
4894 \<elements for divs\><<<
4895 \def\Def:Section#1{%
4896 \edef\:tempc{{\expandafter\:gobble \string#1}}%
4897 |<Configure for sectioning command|>%
4898 \futurelet\:temp\ch:NewSec}
4899 \def\ch:NewSec{\if *\:temp\let\if:toc|=\:gobble\expandafter\op:NewSec
4900 \else \let\if:toc|=\empty \expand:after{\op:NewSec+}\fi}
4901 \def\op:NewSec#1{\expandafter\:NewSec\:tempc}
4902 |<def /:Every|>%
4903 \def\:NewSec#1#2{%
4904 |<endsection config|>%
4905 \expandafter\def\csname #1\endcsname{%
4906 \expand:after{\let\if:toc|=}\csname if:#1toc\endcsname
4907 \:StartSec{#1}{#2}}%
4908 |<c:TITLE: for Sec|>%
4909 \expandafter\let\csname if:#1toc\endcsname|=\if:toc
4910 |<initiate BeforeEvery/Every div|>%
4911 \expandafter\def\csname #1:ttl\endcsname##1}
4912 >>>
4913
4914 \''\Def:Section' + \''\Configure' = \''\NewSection'
4915
4916
4917 \SubSection{/Configure}
4918
4919
4920 \<no trace sec config\><<<
4921 \long\def\Configure:Sec#1#2#3#4#5{%
4922 \expandafter\ifx\csname c:#1\endcsname\relax \let\:tempa|=\relax \else
4923 \def\:tempa{#4#5}\fi \ifx\:tempa\empty \else
4924 |<conf for sec boundaries|>\fi
4925 \expandafter\ifx\csname a:#1\endcsname\relax \let\:tempa|=\relax \else
4926 \def\:tempa{#2#3}\fi \ifx\:tempa\empty \else
4927 \expandafter\def\csname a:#1\endcsname##1{#2}%
4928 \expandafter\def\csname b:#1\endcsname##1{#3}%
4929 \fi
4930 }
4931 >>>
4932
4933 Note that in \`'\Configure{Section}{before}{after}{before head}{after
4934 head}' a change occures only when before-after pair is not empty.
4935
4936
4937 \<trace sec config\><<<
4938 \long\def\Configure:Sec#1#2#3#4#5{%
4939 \expandafter\ifx\csname c:#1\endcsname\relax \let\:tempa|=\relax \else
4940 \def\:tempa{#4#5}\fi \ifx\:tempa\empty \else
4941 |<conf for sec boundaries|>\fi
4942 \expandafter\ifx\csname a:#1\endcsname\relax \let\:tempa|=\relax \else
4943 \def\:tempa{#2#3}\fi \ifx\:tempa\empty \else
4944 |<conf for sec heads|>\fi
4945 }
4946 >>>
4947
4948
4949 \<conf for sec heads\><<<
4950 \def\:tempa{#2}\ifx \:tempa\empty
4951 \expandafter\def\csname a:#1\endcsname
4952 ##1{\hbox{\a:trc #13:4\b:trc}#2\hbox{\c:trc #14:4\d:trc}}%
4953 \else
4954 \expandafter\def\csname a:#1\endcsname##1{#2}%
4955 \fi
4956 \def\:tempa{#3}\ifx \:tempa\empty
4957 \expandafter\def\csname b:#1\endcsname
4958 ##1{\hbox{\a:trc #13:4\b:trc}#3\hbox{\c:trc #14:4\d:trc}}%
4959 \else
4960 \expandafter\def\csname b:#1\endcsname##1{#3}%
4961 \fi
4962 >>>
4963
4964 \<conf for sec boundaries\><<<
4965 \expandafter\c:def\csname c:#1\endcsname{#4}%
4966 \expandafter\c:def\csname d:#1\endcsname{#5}%
4967 >>>
4968
4969
4970 \<Configure for sectioning command\><<<
4971 \edef\:temp{\long\def\expandafter\noexpand \csname
4972 c:\expandafter\:gobble \string#1:\endcsname
4973 ####1####2####3####4{\noexpand
4974 \Configure:Sec\:tempc{####3}{####4}{####1}{####2}}%
4975 \noexpand\NewConfigure{CutAt\expandafter\:gobble \string#1}2%
4976 \noexpand\NewConfigure{+CutAt\expandafter\:gobble \string#1}2%
4977 }\:temp \expandafter\Configure\:tempc{\empty}{}{\empty}{}%
4978 >>>
4979
4980
4981
4982 \Section{Insertions at Boundaries of Logical Units}
4983
4984 \SubSection{Non Cut Ends}
4985
4986 \<boundaries of non-cut sections\><<<
4987 \def\:tempa{#1}\noct:Close:Until
4988 \ifx \:tempb \empty \else
4989 \csname d:\ifx \found:\empty #1\else \found:\fi\endcsname \fi
4990 |<advance TitleCount|>\csname c:#1\endcsname
4991 >>>
4992
4993
4994 Any need
4995 for \`'\def\:tempa{#1}'?
4996
4997
4998
4999 \<document end for non-cut logical units\><<<
5000 \Close:UntilEnd
5001 >>>
5002
5003 The following \''\Do:Close''s deal with sectioning unit
5004 at levels deeper than one we are openning. The sectioning
5005 unit at the latter level is closed with the code
5006 \`'\csname d:\ifx \found:\empty #1\else \found:\fi\endcsname'
5007 we just proccessed.
5008
5009 \<html divs\><<<
5010 \def\noct:Close:Until{%
5011 \let\:tempA|=\sec:typ \let\found:|=\empty
5012 \let\:tempd|=\:Sections \noct:Check:Until
5013 \ifx \:tempb\sec:typ \expandafter\Do:Close \fi
5014 \let\sec:typ|=\:tempA
5015 }
5016 \def\noct:Check:Until{%
5017 \ifx \:tempd\empty |<exit non-cut check-until|>\else
5018 \PopStack\:tempd\:tempb
5019 |<search non-cut end|>%
5020 \ifx \:tempb\sec:typ \else
5021 \expandafter\expandafter\expandafter\noct:Check:Until
5022 \fi\fi }
5023 >>>
5024
5025 We are about to open a new section unit, and we go as down as possible
5026 in the stack of already openned section units searching for the lowest
5027 unit in the stack that should be closed. The \''\found:' variable
5028 holds the lowest oppened unit to be closed.
5029
5030
5031 \<exit non-cut check-until\><<<
5032 \ifx \found:\empty \let\:tempb\empty
5033 \else \let\:tempb|=\found: \let\sec:typ|=\found:\fi
5034 >>>
5035
5036
5037 \<search non-cut end\><<<
5038 \edef\:tempe{\:tempb,%
5039 \expandafter\ifx \csname a:end\:tempb\endcsname\relax \else
5040 \csname a:end\:tempb\endcsname \fi,,}%
5041 \expandafter\mod:typ\:tempe|<par del|>%
5042 >>>
5043
5044
5045 \<html divs\><<<
5046 \def\mod:typ#1,#2|<par del|>{%
5047 \def\:temp{#1}\ifx \:temp\empty\else
5048 \edef\:temp{\expandafter\expandafter\expandafter
5049 \:gobble\expandafter\string \csname #1\endcsname}%
5050 \ifx \sec:typ\:temp
5051 \let\found:|=\:tempb \let\:temp|=\empty
5052 \else \def\:temp{\mod:typ#2|<par del|>}\fi
5053 \fi \:temp
5054 }
5055 >>>
5056
5057
5058 \SubSection{Cut Ends}
5059
5060 \<boundaries of cut sections\><<<
5061 \Configure{CutAt#1}{|<advance TitleCount|>\csname c:#1\endcsname
5062 }{\def\sec:typ{#1}\Close:Until \csname d:#1\endcsname}%
5063 >>>
5064
5065 \<html divs\><<<
5066 \def\Close:Until{%
5067 \let\:tempd|=\:Sections \Check:Until
5068 \ifx \:tempb\sec:typ \expandafter\Do:Close \fi
5069 }
5070 \def\Check:Until{
5071 \ifx \:tempd\empty \let\:tempb|=\empty \else
5072 \PopStack\:tempd\:tempb
5073 \ifx \:tempb\sec:typ \else
5074 \expandafter\expandafter\expandafter\Check:Until
5075 \fi\fi }
5076 >>>
5077
5078
5079 \SubSection{Common Utilities}
5080
5081 \<record sections hierarchy\><<<
5082 \PushStack\:Sections{#1}%
5083 >>>
5084
5085
5086 \<html divs\><<<
5087 \PushStack\:Sections{}%
5088 \PopStack\:Sections\:temp
5089 \def\Do:Close{%
5090 \PopStack\:Sections\:tempb
5091 \ifx \sec:typ\:tempb \else
5092 \csname d:\:tempb\endcsname
5093 \expandafter\Do:Close
5094 \fi
5095 }
5096 >>>
5097
5098 The following is for closing logical units at the end of the file,
5099 when they don't have hypertext pages of their own.
5100
5101 \<html divs\><<<
5102 \def\Close:UntilEnd{%
5103 \ifx \:Sections\empty \let\:tempb|=\empty
5104 \else \PopStack\:Sections\:tempb \fi
5105 \ifx \:tempb\empty \else
5106 \csname d:\:tempb\endcsname
5107 \expandafter\Close:UntilEnd
5108 \fi
5109 }
5110 >>>
5111
5112
5113
5114 \Section{Building Blocks}
5115
5116 The \''\ref', \''\Tag', \''\@currentlabel', and \''\cur:th' are for
5117 latex. Also note that \''label' and \''\ref' can appear within
5118 titles, and there we nullify them except within the titles themselves
5119 and tocs.
5120 One problem with the \''\ref' is that
5121 they may cause nested links.
5122
5123
5124 \<html divs\><<<
5125 \def\:StartSec#1#2#3{%
5126 \def\title:chs##1##2{##2}%
5127 \def\sec:typ{#1}%
5128 |<delayed TocAt|>%
5129 \a:NoSection
5130 |<round ids between sections|>%
5131 |<button for cut at sect|>%
5132 |<BeforeEvery hook|>%
5133 \expandafter\ifx \csname a:#1\endcsname\relax \else
5134 \csname a:#1\endcsname{#3}%
5135 \fi
5136 \b:NoSection \:Ttle{#1}{#2}{\csname #1:ttl\endcsname{#3}}%
5137 \a:NoSection
5138 \expandafter\ifx \csname b:#1\endcsname\relax \else
5139 \csname b:#1\endcsname{#3}%
5140 \fi
5141 |<Every hook|>%
5142 \csname a:AfterTitle\endcsname \b:NoSection
5143 \def\title:chs##1##2{##1}%
5144 }
5145 \def\title:chs#1#2{#1}
5146 >>>
5147
5148 \<shared config\><<<
5149 \NewConfigure{NoSection}{2}
5150 >>>
5151
5152
5153
5154
5155
5156 The \''\par' before \''|<Every hook|>' is to ensure the use of
5157 \''\ShowPar'. Well, the \''\par' turned out to be a pain in cases we
5158 want no space at all. Hence, we took it out.
5159
5160
5161
5162
5163
5164
5165 On the other hands, we try to make sectioning commands fixed points
5166 for labels. Hence, we try to reduce sensitivity of tocs to changes.
5167
5168 \<round ids between sections\><<<
5169 \ro:nd\html:lbl{1000}%
5170 >>>
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187 %%%%%%%%%%%%%%%%%%%%%%%%%
5188 \Section{Title}
5189 %%%%%%%%%%%%%%%%%%%%%%%%%
5190
5191 \<elements for divs\><<<
5192 \def\:Ttle#1#2#3{%
5193 \html:addr
5194 |<hook for ref/label|>%
5195 {|<introduce `doTocEntry toc@1 (@2) (@3) (page no)' to toc|>}%
5196 {|<typeset @3 and link to toc entry|>}%
5197 }
5198 \gHAssign\TitleCount|=0 \global\let\mu:span|=\TitleCount
5199 >>>
5200
5201 \<advance TitleCount\><<<
5202 \gHAdvance
5203 \TitleCount |by 1 \global\let\mu:span|=\TitleCount
5204 \expandafter\expandafter\expandafter\global \expandafter
5205 \let\csname #1:Count\endcsname|=\TitleCount
5206 >>>
5207
5208
5209 For some reason (what it is?) we can't put the set TitleMark
5210 together with the TitleConunt within CutAt--e.g., tex4ht-html32 screams at
5211 subsection about undefined TitleMark.
5212
5213 \<set TitleMark\><<<
5214 \expandafter
5215 \let\expandafter\TitleMark\csname #1HMark\endcsname
5216 >>>
5217
5218 \<tex divisions\><<<
5219 \def\ConfigureMark#1#2{\long\expandafter
5220 \def\csname #1HMark\endcsname{#2}}
5221 >>>
5222
5223
5224
5225 We nulify \''\Link', but this causes no problem because we are
5226 within a group.
5227
5228 well, \`' \let\Link|=\no:lnk ' is a problem for \`'\Configure{ref}',
5229 so we introduced the latter comamnd.
5230
5231 \<typeset the html sec title\><<<
5232 \csname a:InsertTitle\endcsname
5233 \csname InsertTitle\endcsname{#1}%
5234 >>>
5235
5236
5237 Can't use \''\Title'. Already in maple2e.tex.
5238
5239
5240
5241
5242
5243 \<typeset @3 and link to toc entry\><<<
5244 |<href on sec head?|>%
5245 \no:lbl:idx \csname Modify#1Title\endcsname
5246 \html:sectoc{#3}%
5247 >>>
5248
5249
5250
5251 \<tex divisions\><<<
5252 \let\no:lbl:idx|=\empty
5253 \let\toc:lbl:idx|=\empty
5254 >>>
5255
5256 \Section{Table of Contents}
5257
5258 The \''\:writetoc' command outputs the expansion of its parameter, and
5259 the page number, into the file. The expanded definition \`'\edef'
5260 provides records the parameter according to the conditions that exist
5261 when the command is encountered.
5262
5263 \<introduce `doTocEntry toc@1 (@2) (@3) (page no)' to toc\><<<
5264 \escapechar=`\\%
5265 \protect:wrtoc
5266 \csname Modify#1ToToc\endcsname
5267 \protected:edef\:writetoc{\csname if:toc\endcsname{\the\:tokwrite
5268 {\string\doTocEntry
5269 \string\toc \expandafter\ifx\csname toToc:#1\endcsname\relax #1\else
5270 \csname toToc:#1\endcsname\fi
5271 {#2}{\html:tocsec{\ifx \TocTitle\:UnDef #3\else
5272 \TocTitle\fi}}{\the\:tokpage}\relax}}}%
5273 \:writetoc \global\let\TocTitle|=\:UnDef
5274 >>>
5275
5276 \<elements for divs\><<<
5277 \NewConfigure{toToc}[2]{%
5278 \if !#2!\expandafter\let\csname toToc:#1\endcsname\:UnDef
5279 \else \if !#1!%
5280 \expandafter\let\csname IF:#2toc\expandafter\endcsname
5281 \csname if:#2toc\endcsname
5282 \expandafter\let\csname if:#2toc\endcsname\:gobble
5283 \else \edef\:temp{\string @}\edef\:tempa{\string#1}%
5284 \ifx \:temp\:tempa
5285 \expandafter\let\csname if:#2toc\endcsname\empty
5286 \else \edef\:temp{\string ?}%
5287 \ifx \:temp\:tempa
5288 \expandafter\let\csname if:#2toc\expandafter\endcsname
5289 \csname IF:#2toc\endcsname
5290 \else
5291 \expandafter\def\csname toToc:#1\endcsname{#2}%
5292 \fi\fi\fi\fi}
5293 >>>
5294
5295 \<elements for divs\><<<
5296 \ifx \:tokwrite\:UnDef
5297 \csname newtoks\endcsname\:tokwrite
5298 \fi
5299 \ifx \:tokpage\:UnDef
5300 \csname newtoks\endcsname\:tokpage
5301 \fi
5302 \:tokpage={\folio}
5303 >>>
5304
5305 \<html latex divs\><<<
5306
5307 >>>
5308
5309 \<elements for divs\><<<
5310 \:tokwrite|={\write\:tocout}
5311 >>>
5312
5313
5314 \<html divs\><<<
5315 \def\protect:wrtoc{%
5316 |<no Hnewline|>\PictureOff
5317 \def\%{\string\%}\a:writetoc}
5318 >>>
5319
5320
5321
5322 \<html config util\><<<
5323 \NewConfigure{writetoc}[1]{\concat:config\a:writetoc{#1}}
5324 \let\a:writetoc|=\empty
5325 >>>
5326
5327
5328 The following might be solved with protect(?).
5329
5330
5331 \`' \let\Link|=\no:lnk ' is a problem for \`'\Configure{ref}'.
5332
5333
5334
5335
5336 \Section{Links}
5337
5338
5339 \<html divs\><<<
5340 \def\html:sectoc#1{\csname if:toc\endcsname{%
5341 \xdef\CurSecHaddr{|<section html addr|>}%
5342 \edef\:attr{\noexpand\scp:Link{%
5343 \ifTag{|<HTag tag|>|<toc-section html addr|>}%
5344 {|<toc-section html addr|>}%
5345 {|<section html addr|>}%
5346 }}%
5347 \:attr{|<section html addr|>}}%
5348 \ifx \EndTitle:Link\:gobble \if:toc{\scp:EndLink}\fi
5349 |<typeset the html sec title|>\EndTitle:Link{\if:toc{\scp:EndLink}}}
5350 \def\html:tocsec#1{\string\csname\space a:TocLink\string\endcsname
5351 {\FileNumber
5352 }{|<section html addr|>}{|<toc-section html addr|>}{#1}}
5353 \let\CurSecHaddr|=\empty
5354 >>>
5355
5356 If option \`'sections+' is active, the full title is an anchor.
5357 Might be a problem, in particular when the title contains
5358 a footnote. If the option is not active, the anchor for access from
5359 the tocs is empty.
5360
5361 % [ CLASS="\sec:typ Head"]
5362 % [ CLASS="\sec:typ Toc"]
5363
5364
5365
5366 The command \''\uppercase' is put outside the command \''\:toc' to
5367 convert the lower case character tokens to uppercase characters before
5368 they are inserted into the file. Within \''\:toc' the command \''\uppercase'
5369 is written as is into the auxiliary file, and takes effect only when
5370 the auxiliary file is imported.
5371
5372
5373
5374
5375 \''\Get:SecAnchor' should provide an anchor in \''\:SecAnchor' for the
5376 cross references. If none is provided, tex4ht will offer one. tex4ht
5377 doesn't really need the address; the idea is to save on duplicated anchors.
5378
5379 \<section html addr\><<<
5380 \ifx \:SecAnchor\:UnDef
5381 |<toc tag|>1-\file:id-\TitleCount
5382 \else \:SecAnchor \fi >>>
5383
5384
5385
5386 \<toc-section html addr\><<<
5387 |<toc tag|>2-\file:id-\TitleCount >>>
5388
5389
5390 \<toc tag\><<<
5391 Q>>>
5392
5393
5394 \<hook for ref/label\><<<
5395 \Get:SecAnchor{#1}{#2}{#3}%
5396 >>>
5397
5398
5399 \<elements for divs\><<<
5400 \def\Get:SecAnchor#1#2#3{}
5401 >>>
5402
5403
5404
5405
5406
5407
5408
5409 \Section{Control Links on Section Heads}
5410
5411
5412
5413 Option for univerally no links from titles of sections.
5414
5415 \<html divs\><<<
5416 \:CheckOption{sections+}\if:Option
5417 \def\Title:Link{\Link}
5418 \def\EndTitle:Link#1{#1}
5419 \else
5420 \def\Title:Link#1{\Link{}}
5421 \let\EndTitle:Link|=\:gobble
5422 \Log:Note{for back links to toc,
5423 use the command line option `sections+'}%
5424 \fi
5425 >>>
5426
5427 \<shared config\><<<
5428 \NewConfigure{toTocLink}[2]{\def\scp:Link{#1}\def\scp:EndLink{#2}}
5429 \Configure{toTocLink}{\Title:Link}{\EndLink}
5430 >>>
5431
5432
5433 The above gives global control. The following local one.
5434 E.g., \`'\NoLink{section}' asks that sections of type `section'
5435 will not act as hot buttons.
5436
5437 \<html divs\><<<
5438 \def\NoLink#1{\expandafter
5439 \gdef\csname #1:Href-\endcsname{\let\EndTitle:Link|=\:gobble}}%
5440 >>>
5441
5442
5443 \<href on sec head?\><<<
5444 \csname #1:Href-\endcsname
5445 >>>
5446
5447
5448 \Section{Cut-Offs}
5449
5450 The following makes a call to, e.g., \`'\cut:at{section}{title}-'
5451
5452
5453
5454 \<button for cut at sect\><<<
5455 |<set TitleMark|>%
5456 \expandafter\ifx \csname Cut:#1\endcsname\relax
5457 |<boundaries of non-cut sections|>%
5458 \else
5459 |<boundaries of cut sections|>%
5460 |<TITLE for Sec|>%
5461 \csname Cut:#1\endcsname{#3}%
5462 \fi
5463 \global\let\sec:lvl|=\HPageDepth
5464 |<record sections hierarchy|>%
5465 >>>
5466
5467
5468 % \Configure{CutAtTITLE+} {|<TITLE for Sec|>}%
5469
5470
5471 The \`'\let\sec:lvl|=\HPageDepth' is used to determine whether we have
5472 prev-next links with next HPage. As we out from hypertext pages,
5473 the value of \''\HPageDepth' decreases, and the values of
5474 \''\sec:lvl' are kept one value behind. If just before entering
5475 a hypertext page we have \`'\sec:lvl>\HPageDepth', it means
5476 that the last HPage and the next one are at the same depth. Hence,
5477 we allow for prev-next links. We want the \''\global' because
5478 section titles can be within groups as is the case, for instance,
5479 for tables of contents of tables or figures in LaTeX. Without
5480 the global, will need to fix locally the values of \''\sec:lvl' for titles
5481 that are nested in groups.
5482
5483
5484 \<TITLE for Sec\><<<
5485 \expandafter\ifx \csname a:\sec:typ TITLE\endcsname\relax\else
5486 \expandafter\let\expandafter\a:CutAtTITLE
5487 \csname a:\sec:typ TITLE\endcsname\fi
5488 >>>
5489
5490 \<TITLE for SecNO\><<<
5491 \expandafter\ifx \csname a:\sec:typ TITLE\endcsname\relax
5492 \expandafter\HCode \else
5493 \expandafter\expandafter\csname a:\sec:typ TITLE\endcsname\fi
5494 >>>
5495
5496
5497
5498
5499 \<c:TITLE: for Sec\><<<
5500 \expandafter\def\csname c:#1TITLE+:\endcsname{%
5501 \expandafter\def\csname a:#1TITLE\endcsname####1}%
5502 >>>
5503
5504 \<html divs\><<<
5505 \HAssign\sec:lvl|=0
5506 >>>
5507
5508 \Section{Hooks}
5509
5510 BeforEvery and Every are single-parameter macros.
5511
5512 \<def /:Every\><<<
5513 \def\:Every#1{%
5514 \expandafter\edef\csname Every#1\endcsname{%
5515 \def\expandafter\noexpand \csname :Every#1\endcsname####1}%
5516 \expandafter\edef\csname BeforeEvery#1\endcsname{%
5517 \def\expandafter\noexpand\csname :BeforeEvery#1\endcsname####1}%
5518 }
5519 >>>
5520
5521 \''\Every...' and not \''\AfterEvery...', because we are not yet after the section, we are only after the title.
5522
5523
5524 Default hooks are set to tables of contents.
5525
5526 \<initiate BeforeEvery/Every div\><<<
5527 \:Every{#1}%
5528 \csname Every#1\endcsname{%
5529 \expandafter\ifx\csname Toc:#1\endcsname \relax\else
5530 \a:TocAt \csname Toc:#1\endcsname \b:TocAt
5531 \fi
5532 \ignorespaces}%
5533 >>>
5534
5535 \<delayed TocAt\><<<
5536 \a:dTocAt \csname TocAt*\endcsname \b:dTocAt
5537 \expand:after{\global\let}\csname TocAt*\endcsname|=\empty
5538 >>>
5539
5540
5541 \<html config util\><<<
5542 \NewConfigure{TocAt*}[2]{%
5543 \c:def\a:dTocAt{#1}\c:def\b:dTocAt{#2}}
5544 \NewConfigure{TocAt}[2]{%
5545 \c:def\a:TocAt{#1}\c:def\b:TocAt{#2}}
5546 \Configure{TocAt*}{}{}
5547 \Configure{TocAt}{}{}
5548 >>>
5549
5550
5551
5552
5553
5554
5555 The following occurs for sectioning commands without
5556 subdivisions.
5557
5558
5559 \<BeforeEvery hook\><<<
5560 \expandafter\ifx \csname :BeforeEvery#1\endcsname\relax \else
5561 \csname :BeforeEvery#1\endcsname{#3}%
5562 \fi
5563 >>>
5564
5565
5566 \<Every hook\><<<
5567 \expandafter\ifx \csname :Every#1\endcsname\relax \else
5568 \csname :Every#1\endcsname{#3}%
5569 \fi
5570 >>>
5571
5572
5573 \Section{Utilities}
5574
5575
5576 Normally, the leading paragraphs in chapters and sections start with
5577 no indentation, whereas the other paragraphs start with indentations.
5578 To achieve this effect, we can allow a contribution of an indentation to
5579 all the paragraphs, with provisions for removing the indentations from
5580 selected paragraphs.
5581
5582
5583
5584 Without the \''\immediate' we can get problems on boundary between pages.
5585
5586
5587
5588 \Section{Configurations for CutAt}
5589
5590
5591
5592
5593 The \`'\par\ShowPar' is to ensure that buttons at
5594 end of a page will not get into the last entry of the table in case
5595 of a cut-off situation.
5596
5597
5598
5599
5600
5601
5602
5603
5604 \Chapter{Tables of Contents}
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615 \Section{Archiving the Table}
5616
5617 For a source document that is stored in file named \''abc.xyz' the
5618 table is assumed to be stored in a file that carries the name
5619 \''abc.4tc'. It is archived into \''abc.4ct'.
5620
5621 \<blocs for tocs\><<<
5622 \openin15=\jobname.4tc
5623 \ifeof15 \closein15
5624 \def\:TableOfContents[#1]{\writesixteen{No file \jobname.4tc}}
5625 |<undef /TableOfContents|>
5626 \else
5627 \ifHtml |<def html /TableOfContents|>
5628 \fi
5629 |<copy toc|>
5630 \fi
5631 >>>
5632
5633
5634 \<copy toc\><<<
5635 \begingroup
5636 \catcode`^|=7
5637 |<define /:copytoc|> \ifHtml \catcode`\#|=12\relax \fi
5638 \def\:next{\catcode\tmp:cnt|=12
5639 \ifnum \tmp:cnt=0
5640 \def\:next{%
5641 \catcode`\^^M|=5
5642 \immediate\openout15=\jobname.4ct \:copytoc
5643 \immediate\closeout15
5644 \endgroup \closein15
5645 }%
5646 \fi
5647 \advance\tmp:cnt |by -1 \:next
5648 }
5649 \tmp:cnt|=255 \:next
5650 >>>
5651
5652
5653 \<define /:copytoc\><<<
5654 \def\:copytoc{%
5655 \ifeof15 \else
5656 \read15 to \:temp
5657 {\escapechar=`\\\immediate\write15{\:temp}}%
5658 \expandafter\:copytoc
5659 \fi}
5660 >>>
5661
5662 \Section{Invoked Tables of Contents}
5663
5664
5665 \SubSection{Listing the Entries}
5666
5667
5668
5669
5670 The following pair of definitions are a degenerated case of the `sty' option
5671 in which the parameters are required for a table to appear.
5672
5673 \<undef /TableOfContents\><<<
5674 \ifx \TableOfContents\:UnDef
5675 \def\TableOfContents{\futurelet\:temp\:TOC}
5676 \def\:TOC{\ifx [\:temp \expandafter\:TableOfContents\fi}
5677 \fi
5678 >>>
5679
5680
5681
5682 \<def html /TableOfContents\><<<
5683 |<undef /TableOfContents|>
5684 \def\:TableOfContents[#1]{\SaveEverypar{%
5685 \def\TocCount{0}%
5686 |<interpretation for entries|>%
5687 \def\InsertTitle##1##2##3{}%
5688 \hsize|=4.5in \rightskip |= \z@ minus 1in \linepenalty|=1000
5689 \catcode`\#|=12 \catcode`\@|=11 \catcode`\:|=11
5690 |<Configure HtmlPar for TOC|>\everypar{\HtmlPar}%
5691 |<before toc|>\input \jobname.4ct
5692 {\ht:everypar{}\leavevmode}|<bottom toc|>%
5693 \par }\RecallEverypar |<after toc|>}
5694 >>>
5695
5696 \<after toc\><<<
5697 \ifx \c:tableofcontents\:UnDef
5698 \csname c:TableOfContents\endcsname
5699 \else \c:tableofcontents \fi
5700 >>>
5701
5702 \<before toc\><<<
5703 \ifx \a:tableofcontents\:UnDef \csname a:TableOfContents\endcsname
5704 \else \a:tableofcontents \fi
5705 >>>
5706
5707
5708
5709 \<bottom toc\><<<
5710 \ifx \b:tableofcontents\:UnDef
5711 \csname b:TableOfContents\endcsname
5712 \else \b:tableofcontents \fi
5713 >>>
5714
5715
5716
5717
5718 \<par toc\><<<
5719 \ifx \d:tableofcontents\:UnDef \csname d:TableOfContents\endcsname
5720 \else \d:tableofcontents \fi
5721 >>>
5722
5723 \<noindent toc par\><<<
5724 \ifx \e:tableofcontents\:UnDef
5725 \csname e:TableOfContents\endcsname
5726 \else \e:tableofcontents \fi
5727 >>>
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738 The following might be a problem LaTeX, in particular
5739 with \''\IgnoreIndent/\ShowIndent' cases. A partial solution
5740 to the problem used the code
5741 \`'\if:latex \if:nopar \else
5742 \Configure{HtmlPar}{}{\Configure
5743 {HtmlPar}{|<noindent toc par|>}{|<par toc|>}{}{}}{}{}%
5744 \fi\fi', but then we got problems elsewhere.
5745
5746 \<Configure HtmlPar for TOC\><<<
5747 \Configure{HtmlPar}{|<noindent toc par|>}{|<par toc|>}{}{}%
5748 >>>
5749
5750
5751
5752
5753
5754 \SubSection{Loading the Entries}
5755
5756
5757 \<interpretation for entries\><<<
5758 \:tocPreamble#1,,%
5759 \let\doTocEntry|=\:doTocEntry
5760 \def\contentsline##1##2##3{##2}%
5761 \no:lbl:idx
5762 >>>
5763
5764
5765
5766
5767 \<blocs for tocs\><<<
5768 \def\:doTocEntry#1#2#3#4{%
5769 \Advance:\TocCount |by 1
5770 \expandafter\ifx \csname \string#1 \endcsname \relax \else
5771 #1{#2}{#3}{#4}\fi
5772 }
5773 >>>
5774
5775 \<shared config\><<<
5776 \NewConfigure{TocLink}[1]{\def\a:TocLink##1##2##3##4{#1}}
5777 >>>
5778
5779 A field \`'[\ifnum \FileNumber=#1
5780 \else \RefFileNumber{#1}\fi]' buys nothing as far as memory
5781 is concerned.
5782
5783 \<def Configure\><<<
5784 \long\def\ConfigureToc#1#2#3#4#5{%
5785 \expandafter\def\csname toc#1\endcsname##1##2##3{#5}%
5786 |<cond toc config|>%
5787 }
5788 >>>
5789
5790
5791 \<trace commands\><<<
5792 \long\def\ConfigureToc#1#2#3#4#5{%
5793 \expandafter\def\csname toc#1\endcsname##1##2##3{#5}%
5794 \edit:p\def\:temp{#2#3#4#5}\ifx \:temp\empty
5795 \expandafter\pend:defIII\csname toc#1\endcsname{\hbox
5796 {\a:trc Toc(#1)1\b:trc}####1\hbox{\a:trc Toc(#1)2\b:trc}####2\hbox
5797 {\a:trc Toc(#1)3\b:trc}####3\hbox{\a:trc Toc(#1)4\b:trc}}%
5798 \else
5799 |<cond toc config|>%
5800 \fi
5801 }
5802 >>>
5803
5804
5805
5806 \<cond toc config\><<<
5807 \def\:temp{#4}\ifx \:temp\empty \else
5808 \expandafter\pend:defIII\csname toc#1\endcsname{#4####3}%
5809 \fi
5810 \def\:temp{#3}\ifx \:temp\empty \else
5811 \expandafter\pend:defIII\csname toc#1\endcsname{#3####2}%
5812 \fi
5813 \def\:temp{#2}\ifx \:temp\empty \else
5814 \expandafter\pend:defIII\csname toc#1\endcsname{#2####1}%
5815 \fi
5816 >>>
5817
5818 \<blocs for tocs\><<<
5819 \def\:tocPreamble#1,{%
5820 \def\:temp{#1}\ifx \:temp\empty \else
5821 \edef\:temp{\expandafter\string\csname toc#1 \endcsname}%
5822 \expandafter\expandafter\expandafter\let
5823 \expandafter\csname\:temp\endcsname|=\empty
5824 \expandafter\:tocPreamble\fi}
5825 >>>
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840 \SubSection{Collecting the Entries}
5841
5842 After producing the table of contents from the previous compilation,
5843 a file is opened for collecting the entries of the table from the
5844 current compilation.
5845
5846 \<blocs for tocs\><<<
5847 \ifx \:tocout\:UnDef
5848 \csname newwrite\endcsname\:tocout
5849 \fi
5850 \def\:temp{%
5851 |<if latex then latex/write sol|>\openout\:tocout|=\jobname.4tc
5852 |<doTocEntry for dvi|>}
5853 \:temp
5854 >>>
5855
5856 In case we switch from html to dvi mode, without the presence of
5857 TeX4ht, we want to hide the \''\doTocEntry'..
5858 The \`'\escapechar' decides what is written out for escape character,
5859 no matter what the actual symbol is. texinfo changes that symbol to
5860 {\tt \string\escapechar=`\string\@}.
5861
5862 \<doTocEntry for dvi\><<<
5863 {\escapechar=`\\|<if latex then latex/write sol|>\write
5864 \:tocout{\string\expandafter\string\ifx
5865 \noexpand\csname doTocEntry\string\endcsname\relax
5866 \string\expandafter\string\endinput
5867 \string\fi}%
5868 \message{(\jobname.4tc)}% enable tracking of the .4tc file by latexmk
5869 }%
5870 >>>
5871
5872
5873
5874
5875 \Section{Triggered Tables of Contents}
5876
5877 The \`'\TocAt-{...}' command asks for no TOC, the \`'TocAt*{...}'
5878 command asks for a TOC delayed until the next section, \`'\TocAt{...}'
5879 asks for TOC in place, and a list of size one asks for no more local
5880 TOC's for the given logical unit.
5881
5882 \<blocs for tocs\><<<
5883 \def\TocAt#1{%
5884 \def\:next##1{\:TocAt##1,//}%
5885 \def\:tempa{#1}\def\:temp{-}\ifx \:tempa\:temp \let\:temp|=-%
5886 \else \def\:temp{*}\ifx \:tempa\:temp \let\:temp|=*%
5887 \else \def\:next{\:TocAt#1,//}%
5888 \fi \fi \:next }
5889 >>>
5890
5891
5892
5893
5894
5895 \<Toc:At>\><<<
5896 \expandafter\edef\csname Toc:#1\endcsname{%
5897 \gdef\expandafter\noexpand\csname TocAt*\endcsname{%
5898 \noexpand \csname Toc#1\noexpand\endcsname }}%
5899 >>>
5900
5901 \<Toc:At\><<<
5902 \expandafter\edef\csname Toc:#1\endcsname{%
5903 \noexpand\csname Toc#1\noexpand\endcsname }%
5904 >>>
5905
5906 \<blocs for tocs\><<<
5907 \def\:TocAt#1,#2//{%
5908 \ifx -\:temp \else \ifx *\:temp
5909 |<Toc:At>|>%
5910 \else |<Toc:At|>\fi \fi
5911 \def\:temp{#2}\ifx \:temp\empty
5912 \expandafter\let\csname Toc#1\endcsname|=\:UnDef
5913 \else |<extract the entries|>\fi }
5914 >>>
5915
5916 \SubSection{Process the Request}
5917
5918 For \`'\TocAt{X,...,Y,...}' we define a \''\TocX' that includes the
5919 interpretations for the different \''\tocY' w of Xithin commands of
5920 the form \`'X::tocY'.
5921
5922
5923
5924 \<extract the entries\><<<
5925 \let\:include|=\empty
5926 \::TocAt#1,/#1,#2,,//%
5927 \edef\:include{\expandafter\:removecomma\:include}%
5928 \expandafter\edef\csname Toc#1\endcsname{{%
5929 \let\noexpand\TitleCount|=\expandafter\noexpand
5930 \csname #1:Count\endcsname
5931 \noexpand\:assgtoc\:include,//{#1}%
5932 \:tocs[\:include]}}%
5933 >>>
5934
5935
5936
5937 \SubSection{Process the Request}
5938
5939 \<blocs for tocs\><<<
5940 \def\:tocs{\noexpand\TableOfContents}
5941 >>>
5942
5943
5944
5945
5946 \<blocs for tocs\><<<
5947 \def\:removecomma#1{}
5948 \def\:assgtoc#1,#2//#3{%
5949 \expand:after{\expandafter\let\csname toc#1\endcsname |=}%
5950 \csname #3::toc#1\endcsname
5951 \if:notempty{#2}{\:assgtoc#2//{#3}}}
5952 >>>
5953
5954 \<blocs for tocs\><<<
5955 \def\::TocAt#1,#2,#3//{\def\:temp{#2}%
5956 \ifx \:temp\empty \else
5957 \if /\:firstch#2 //%
5958 |<stop toc for @1 at @2|>%
5959 \else |<include @2 in toc for @1|>\fi
5960 \expand:after{\::TocAt#1,#3//}%
5961 \fi
5962 }
5963 >>>
5964
5965 \SubSection{Interpretation for Included Entry}
5966
5967 Also for \`'\TocAt{X,....,Y,...}' the interpretation is
5968 defined in \`'X::tocY'.
5969
5970
5971 \<include @2 in toc for @1\><<<
5972 \edef\:include{\:include,#2}%
5973 \expand:after{\expandafter\let\csname svtoc::#2\endcsname|=}%
5974 \csname toc#2\endcsname
5975 \expandafter\edef\csname #1::toc#2\endcsname##1##2##3{%
5976 \noexpand\ifnum \noexpand\TitleCount<\noexpand\TocCount
5977 \noexpand\space
5978 \expandafter\noexpand \csname svtoc::#2\endcsname{##1}{##2}{##3}%
5979 \noexpand\fi}%
5980 >>>
5981
5982
5983 Tex4ht relies on two counters \`'\TitleCount' and \`'\TocCount' to
5984 decide which entries of the global TOC should go to the local TOC.
5985 The first counter is increased when sectioning commands are
5986 encountered. The second counter is increased when the global TOC is
5987 traversed.
5988
5989 A discrepancy will occur when the contributions of the sectioning
5990 commands to the global TOC are not synchronized with the increments of
5991 the first counter. That will normally be the case when sectioning
5992 commands are introduced without tex4h being informed about their
5993 designation as sectioning commands.
5994
5995
5996 \SubSection{End Points}
5997
5998
5999 Also for \`'\TocAt{X,....,/Y,...}' the termination point that we get is
6000 defined in \`'X::tocY'.
6001
6002 \<blocs for tocs\><<<
6003 \def\:firstch#1#2 //{#1\def\:temp{#2}}
6004 >>>
6005
6006
6007 \<stop toc for @1 at @2\><<<
6008 \edef\:include{\:include,\:temp}%
6009 \expandafter\def\csname #1::toc\:temp\endcsname##1##2##3{%
6010 \ifnum \TitleCount<\TocCount
6011 \Advance:\TocCount |by -100000 \endinput
6012 \fi}%
6013 >>>
6014
6015 The \''\endinput' is not required but it desired because it cuts off
6016 the reading of the toc file. The \''-100000' is needed
6017 forhierarchical toc's due to parent-child relashions.
6018
6019
6020
6021
6022
6023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6024 \Chapter{halign-based tables}
6025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6026
6027 \<halign-based tables\><<<
6028 |<all halign-based tables|>
6029 |<html blocks for halign tables|>
6030 |<html halign|>
6031 \def\:temp{\let\:shrp|=##} \:temp
6032 >>>
6033
6034 The \''\:shrp' should be defined at the end so as not
6035 to bother other definitions that will regard it as improper
6036 \`'#' parameter.
6037
6038
6039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6040 \Section{Taming of halign}
6041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6042
6043 The \''\halign' comamnds not defined within TeX4ht environment
6044 can be problematic, and the same may be true to some within such
6045 environnt. Specifically, comamnds of the form \`'\halign...{...}'
6046 are translated well in TeX4ht, but cause a problem if defined
6047 before TeX4ht was activated. Commands of the form
6048 \`'\halign...\bgroup...' cause no problem in either mode, but they
6049 also introduce no html code. Commands of the form
6050 \''\halign...{...\egroup' cause problems in either way.
6051
6052 TeX4ht takes care of the \''\halign' commands in TeX and LaTeX,
6053 but not of those that are loaded earlier from other libraries.
6054
6055
6056 The following tree shows the direct and indirect use of \''\halign' in
6057 TeX and LaTeX.
6058
6059 \Draw
6060 \TreeAlign(H,1,0)(0,0,0)
6061 \TreeSpace(D,10,10)
6062 \Tree()(
6063 5,halign//
6064 12,ialign{(T,L)} & 0,displaylines{(T,L)} &
6065 0,eqalignno{(T)} & 0,leqalignno{(T)} &
6066 0,eqnarray{(L)}//
6067 0,m@ketabbox{(T)} & 0,oalign{(T,L)} & 0,angle{(T,L)} &
6068 0,overrightarrow{(T,L)}~~\hfill overleftarrow{(T,L)}~~
6069 \hfill overbrace{(T,L)}~~\hfill underbrace{(T,L)} &
6070 0,@vereq{(T,L)} & 0,cases{(T,L)} & 0,matrix{(T)} & 0,bordermatrix{(T,L)} &
6071 0,eqalign{(T)} & 0,@array{(L)} & 0,@ishortstack{(L)} &
6072 0,table{(L)}//
6073 )
6074
6075 \EndDraw
6076
6077
6078 The \`'\iffalse{\fi...\iffalse}\fi' is to hide the \`'\cr' from
6079 \''\halign' when it scans for that command.
6080
6081
6082 \<all halign-based tables\><<<
6083 \let\TeXhalign|=\halign
6084 \def\RecallTeXcr{\iffalse{\fi
6085 \expand:after{\let\cr|=}\csname 0cr\endcsname
6086 \expand:after{\let\crcr|=}\csname 0crcr\endcsname
6087 \iffalse}\fi}
6088 \expandafter\let\csname 0cr\endcsname|=\cr
6089 \expandafter\let\csname 0crcr\endcsname|=\crcr
6090 \def\TeXhalign:cr{%
6091 \ifx \EndPicture\:UnDef \else \iffalse{\fi
6092 \expandafter\let\expandafter\cr\csname \MkHalign:d cr\endcsname
6093 \expandafter\let\expandafter\crcr\csname \MkHalign:d crcr\endcsname
6094 \iffalse}\fi \fi \TeXhalign}
6095 >>>
6096
6097
6098 Save/recover \''\crcr' and \''\cr' causes problems, e.g., in nested arrays.
6099 It seems also we don't really need such a feature.
6100
6101
6102
6103
6104 \<tex4ht halign and cr/crcr\><<<
6105 \let\halign|=\sv:halign
6106 >>>
6107
6108
6109
6110
6111 %\edef\TeXhalign:cr{%
6112 % \noexpand\ifx \noexpand\EndPicture\noexpand\:UnDef \noexpand\else
6113 % \let\cr|=\expandafter\noexpand\csname 0cr\endcsname
6114 % \let\crcr|=\expandafter\noexpand\csname 0crcr\endcsname
6115 % \noexpand\fi \noexpand\TeXhalign}
6116
6117
6118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6119 \Section{Building Blocks for Accessing Halign Tables}
6120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6121
6122
6123 The next comamnd can be in use when the parameters \`'#' (i.e.,
6124 the first parameter \''#1') are in cat code 13.
6125
6126
6127 We hade \''\:relax' instead of \''\relax' below. Where did it come
6128 from?
6129
6130
6131 The \''\MkHalign' takes the form
6132 \`'\MkHalign#{...pattern...}...body...\EndHalign' and seeds the end
6133 tags \''\a:halign' and \''\b:halign' around the construct, and
6134 \''\c:halign' and \`'d:halign' in the pattern. The outcome is a seeded
6135 \`'\halign{...}'. The \`'\Configure{MkHalign}...' places
6136 \''a:MkHalign', \''b:MkHalign', \''c:MkHalign', \''d:MkHalign',
6137 \''e:MkHalign', and \''\f:MkHalign' within \''\a:halign',
6138 \''\b:halign', \''\c:halign', and \`'d:halign'. The \`'#' in the
6139 pattern can be any character of category code 13. The \`'&' charaters
6140 shouldn't be within braces. The \''\RecallTeXcr' should appear
6141 before \''\MkHalign'; if it appears within the pattern, we loose
6142 the row breaks.
6143
6144
6145
6146 \<html blocks for halign tables\><<<
6147 \def\MkHalign#1#2{%
6148 \iffalse{\fi \let\sv:new:row|=\new:row
6149 \def\relax:shrp{\let#1|=\relax}%
6150 \def\new:halign{\TeXhalign \bgroup}%
6151 \add:halign#2&|<par del|>\cr
6152 \let#1|=\:shrp |<before TeXhalign|>%
6153 \iffalse}\fi |<protection for $$|>%
6154 \a:PauseMkHalign \new:halign\ext:cr}
6155 \def\EndMkHalign{\egroup
6156 \d:PauseMkHalign |<end protection for $$|>%
6157 \iffalse{\fi |<after TeXhalign|>\relax:shrp \iffalse}\fi }
6158 \def\PauseMkHalign#1{\cr\egroup
6159 \hbox{\r:halign \global\let\new:row|=\R:halign}\b:PauseMkHalign
6160 #1\c:PauseMkHalign\new:halign\ext:cr}
6161 >>>
6162
6163 \<shared config\><<<
6164 \NewConfigure{PauseMkHalign}{4}
6165 >>>
6166
6167
6168 The PauseMkHalign provides a vehicle to decompose a
6169 \''\halign\bgroup...0......1...\egroup' and recompose it in arbitrary order and
6170 choise of components, as is the case in longtable:
6171 \`'\setbox0=\hbox{\halign\bgroup...0...\egroup}
6172 \setbox1=\hbox{\halign\bgroup...1...\egroup}\box0\box1'. In some
6173 occasions, and may be all, the parameter of \''\PauseMkHalign' must be
6174 just boxes.
6175
6176 The \`'\iffalse ...\fi' above are for hiding \''\cr' in
6177 nested cases (e.g., of \''\tabular' in LaTeX).
6178
6179 Spans over N columns require many compilations to
6180 realize them.
6181
6182 The following is an application of \''\MkHalign'.
6183 it allows for tables of the form \`'\MiniHalign...\EndMiniHalign'
6184 instead of \`'\halign{...}'.
6185
6186 \<html blocks for halign tables\><<<
6187 \catcode`\#|=13 \catcode`\@|=6
6188 \def\MiniHalign{\begingroup \catcode`\#|=13 \let#|=\relax
6189 \:MHalign}
6190 \def\:MHalign@1\cr{\endgroup \SaveMkHalignConfig
6191 \Configure{MkHalign}{\a:MiniHalign}{\b:MiniHalign}\c:MiniHalign
6192 \d:MiniHalign{\e:MiniHalign\RecallMkHalignConfig}\f:MiniHalign
6193 \MkHalign#{@1}}
6194 \catcode`\#|=6 \catcode`\@|=11
6195 \def\EndMiniHalign{\EndMkHalign \RecallMkHalignConfig }
6196 >>>
6197
6198 \<shared config\><<<
6199 \NewConfigure{MiniHalign}{6}
6200 >>>
6201
6202
6203
6204 \ifHtml[\HPage{test data}\Verbatim
6205
6206 \documentclass{article}
6207
6208 \input tex4ht.sty \Preamble{html}
6209 \begin{document}
6210 \EndPreamble
6211
6212 \begin{tabular}{c|}
6213 before
6214 \begin{tabular}{c|} center \end{tabular}
6215 after
6216 \end{tabular}
6217
6218 \end{document}
6219 \EndVerbatim\EndHPage{}]\fi
6220
6221
6222 \<protection for $$\><<<
6223 \begingroup
6224 \ifmmode \def\end:m{$$\egroup}\vtop\bgroup$$\else
6225 \let \end:m|=\empty\fi
6226 >>>
6227
6228
6229 \<end protection for $$\><<<
6230 \end:m\endgroup
6231 >>>
6232
6233
6234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6235 \SubSection{Build Expanded Pattern}
6236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6237
6238 Break the pattern at \`'&'s and enclose with calls for html
6239 code.
6240
6241 \<html blocks for halign tables\><<<
6242 \def\add:halign#1&#2\cr{%
6243 \def\:temp{#2}\def\:tempb{|<par del|>}%
6244 \ifx \:temp\:tempb
6245 \append:def\new:halign{\b:halign#1\c:halign}%
6246 \else
6247 \def\:temp{#1}\ifx\:temp\empty \append:def\new:halign{&}%
6248 \else \append:def\new:halign{\b:halign#1\c:halign&}\fi
6249 \add:halign#2\cr
6250 \fi}
6251 >>>
6252
6253
6254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6255 \SubSection{Html Insertions}
6256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6257
6258
6259
6260 \<before TeXhalign\><<<
6261 \global\let\new:row|=\R:halign
6262 \Advance:\MkHalign:d |by 1
6263 \expandafter\let\csname \MkHalign:d cr\endcsname|=\cr
6264 \expandafter\let\csname \MkHalign:d crcr\endcsname|=\crcr
6265 \edef\cr{\noexpand\rR:halign
6266 \expandafter\noexpand \csname \MkHalign:d cr\endcsname}%
6267 \edef\crcr{\noexpand\rR:halign
6268 \expandafter\noexpand \csname \MkHalign:d crcr\endcsname}%
6269 \let\omit|=\om:t \def\TT:halign{\T:halign \global\let\TT:halign|=\empty}%
6270 >>>
6271
6272 Inserting \''\T:halign' here causes infinite loop in \''\@array'
6273 of latex. Hence, we delay it to the stat of the first element.
6274
6275 \<after TeXhalign\><<<
6276 \expand:after{\let\cr|=}\csname \MkHalign:d cr\endcsname
6277 \expand:after{\let\crcr|=}\csname \MkHalign:d crcr\endcsname
6278 \let\omit|=\:omit
6279 % \endgraf fixes fatal error with LaTeX 3 tagging
6280 % see https://tex.stackexchange.com/a/754799/2891
6281 % but it introduces error with Amsmath's align*, so I will remove it
6282 % see https://tex.stackexchange.com/a/760699/2891
6283 {\ht:everypar{}\r:halign}\t:halign%\endgraf
6284 \Advance:\MkHalign:d |by -1
6285 >>>
6286
6287 \<html blocks for halign tables\><<<
6288 \def\rR:halign{\gdef\new:row{\r:halign \R:halign}}
6289 \HAssign\MkHalign:d |= 0
6290 >>>
6291
6292
6293
6294
6295
6296 \<html blocks for halign tables\><<<
6297 \def\b:halign{\BB:halign \bgroup}
6298 \def\c:halign{\egroup\d:halign}
6299 \def\BB:halign{\expand:after{\global\let\new:row|=\empty }\new:row
6300 \D:halign}
6301 >>>
6302
6303 The \''\Configure' may use the values of \''\:MULTISPAN', \''\halignTD',
6304 \''\HRow'' and \''\HCol'. The \''\halignTD' gets its value from
6305 \''\Configure{TD}{...}'.
6306
6307
6308 \<html config util\><<<
6309 \def\halignTD{\ifx \:mALIGN\empty \hT:D \else \:mALIGN \fi}
6310 \def\halignTB#1{
6311 \expandafter\ifx \csname :#1:\endcsname\relax
6312 \:warning{Missing \string\Configure{halignTB<>}{#1}}%
6313 \else
6314 \global\expandafter\let\expandafter\:MkHalign:
6315 \csname :#1:\endcsname \a:halignTB \expandafter\expandafter
6316 \expandafter\halign:TB \csname :#1:\endcsname|<par del|>\b:halignTB
6317 \fi }
6318 \NewConfigure{halignTB}{2}
6319 \NewConfigure{halignTB<>}[2]{%
6320 \expandafter\def\csname :#1:\endcsname{#2}}
6321 |<init :MkHalign:|>
6322 >>>
6323
6324 \<html config util\><<<
6325 \NewConfigure{MkHalign}[6]{%
6326 \def\T:halign{\PushMacro\:MkHalign:|<init :MkHalign:|>#1}%
6327 \def\t:halign{#2\PopMacro\:MkHalign:
6328 \global\let\:MkHalign:|=\:MkHalign:}%
6329 \def\R:halign{\TT:halign \gHAdvance\HRow |by 1 \gHAssign\HCol|=1
6330 #3}%
6331 \def\r:halign{\end:omit#4}%
6332 \def\D:halign{\:nopartrue
6333 |<save dH|>%
6334 |<cond TD for multispan|>%
6335 \ifnum\MS:count=\ifx \:MULTISPAN\:UnDef \MS:count
6336 \else \:MULTISPAN\fi
6337 \expandafter\gdef\csname dH\MkHalign:d\endcsname
6338 {|<cond /TD for multispan|>}\fi}%
6339 \def\d:halign{\csname dH\ifnum \MkHalign:d<1 1\else \MkHalign:d\fi
6340 \endcsname |<recall dH|>}}
6341 \Configure{MkHalign}{}{}{}{}{}{}
6342 \HAssign\dH:cnt|=0
6343 >>>
6344
6345 \<save dH\><<<
6346 \gHAdvance\dH:cnt by 1
6347 \edef\:tempa{\global\let\expandafter\noexpand\csname xc\dH:cnt\endcsname
6348 \expandafter\noexpand\csname dH\MkHalign:d\endcsname}%
6349 \:tempa
6350 \expandafter\xdef\csname \dH:cnt :tempa\endcsname{%
6351 \global\let \expandafter\noexpand\csname dH\MkHalign:d\endcsname
6352 \expandafter\noexpand\csname xc\dH:cnt\endcsname}%
6353 >>>
6354
6355 \<recall dH\><<<
6356 \csname \dH:cnt :tempa\endcsname
6357 \gHAdvance\dH:cnt by -1
6358 >>>
6359
6360 Nonleading \`'\csname dH\MkHalign:d\endcsname' produce improper closing
6361 delimiters in \`'\multispan' of index $>$ 1. In such cases, only the
6362 outcome of the first \`'\D:halign' contribute for the openning
6363 delimiter---occuring in the iteration in which
6364 \`'\MS:count=\:MULTISPAN'.
6365
6366 The \`'\ifnum \MkHalign:d<1 1\else \MkHalign:d\fi' is needed because we
6367 can get down to 0 if the last entry is a \''\multispan'.
6368
6369
6370
6371
6372 \<math config util\><<<
6373
6374 >>>
6375
6376 \<init :MkHalign:\><<<
6377 \Configure{halignTB<>}{MkHalign}{<>}%
6378 >>>
6379
6380
6381
6382 The saving \`'\csname dH\MkHalign:d\endcsname' and loading is to
6383 protect from changes that may occur inside the entity in the meaning
6384 of \''\d:halign'. Don't we need the same for \''\r:halign'?
6385
6386 The following is for tracing users definitions to be used in extensions
6387 that need to do reverse eng of the users input.
6388
6389
6390 \<shared configNO\><<<
6391 \NewConfigure{TraceTables}[8]{\def\trc:T{#1}\def\trc:eT{#2}%
6392 \def\trc:t{#3}\def\trc:et{#4}\def\trc:R{#5}\def\trc:eR{#6}%
6393 \def\trc:r{#7}\def\trc:er{#8}\d:TrcHlgn}
6394 \def\d:TrcHlgn#1#2#3#4{\def\trc:D{#1}\def\trc:eD{#2}%
6395 \def\trc:d{#3}\def\trc:ed{#4}}
6396 >>>
6397
6398
6399 The \''\:removeindenttrue' is important, for instance, in case of
6400 a \''\noalign{...}'.
6401
6402 When we meet \`'&&', which signals a loop.
6403
6404
6405 We place \''#' under catcode 13. \''\noalign' is ignored.
6406
6407
6408
6409 \<html blocks for halign tables\><<<
6410 \def\SaveMkHalignConfig{\let\sT:halign|=\T:halign
6411 \let\st:halign|=\t:halign
6412 \let\sR:halign|=\R:halign
6413 \let\sr:halign|=\r:halign
6414 \let\sD:halign|=\D:halign
6415 \let\sd:halign|=\d:halign}
6416 \def\RecallMkHalignConfig{\let\T:halign|=\sT:halign
6417 \let\t:halign|=\st:halign
6418 \let\R:halign|=\sR:halign
6419 \let\r:halign|=\sr:halign
6420 \let\D:halign|=\sD:halign
6421 \let\d:halign|=\sd:halign}
6422 >>>
6423
6424
6425
6426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6427 \SubSection{/omit and /span}
6428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6429
6430 \<html blocks for halign tables\><<<
6431 \let\:omit|=\omit
6432 \def\om:t{\:omit \BB:halign
6433 \gdef\end:omit{\gdef\end:omit{}\d:halign}}
6434 \let\end:omit|=\empty
6435 >>>
6436
6437
6438 A \''\multispa' is a sequence of \''\span''s. Each \''\span'
6439 puts \`'\HRow.\HCol;' in \''\new:span;'. Next compilation
6440 retrieves this info to compute \''\:MULTISPAN'.
6441
6442
6443 \<cond TD for multispan\><<<
6444 \gHAdvance\MS:count |by -1
6445 \ifnum \MS:count > 0 \else
6446 \end:omit \relax:shrp \derive:TD
6447 \HAssign\:MULTISPAN|=1 \let\:mALIGN|=\empty
6448 \expandafter\add:span\old:span \gHAssign\MS:count|=\:MULTISPAN
6449 \relax #5%
6450 \fi
6451 \xdef\Step:Col{\ifx \HMultispan\:UnDef 1 \else \HMultispan\fi}%
6452 >>>
6453
6454 \<cond /TD for multispan\><<<
6455 \ifnum \MS:count<2 #6\relax
6456 \gHAdvance\HCol \Step:Col\relax \fi
6457 >>>
6458
6459
6460
6461
6462
6463
6464 % \ifnum \MS:count<2 #6 \gHAdvance\HCol |by 1 \fi
6465
6466
6467 For some reason \`'\if:latex\@multicnt\else\mscount\fi'
6468 didn't work for \''\MS:count>0' on
6469
6470 \Verbatim
6471 \halign{#\qquad& \$# each\cr
6472 \omit\span\omit\hfil
6473 Shipping Charges\hfil\cr
6474 1--10&1.30\cr11--100&1.00\cr
6475 111--&0.70\cr}
6476 \EndVerbatim
6477
6478
6479 Tried to put \`'\iffalse{\fi \let\cr|=\ext:cr \let\crcr|=\ext:crcr
6480 \iffalse}\fi ' at start of cell. It didn't work, because I couldn't
6481 restore the \''\cr' and \''\crcr' before the \''\cr' is read at end
6482 of line. This doesn't look like an important because
6483 the redefined version just has a \''\gdef' in it and produces no code
6484 of itself. However, it is important because problems sometimes
6485 arise if a nonnative instance is present, for instance, in
6486 \`'\openup10pt \halign{
6487 $2^{#}$\quad&
6488 $\overbrace{2\cdots 2}^{#
6489 \rm times}$\quad& #\cr
6490 2&2&4\cr 3&3&8\cr }
6491 '.
6492
6493
6494 See Knuth 386 for the
6495 hiding
6496 \`'\iffalse{\fi\let\cr|=\ext:cr\iffalse}\fi ' of \''\cr'.
6497
6498 \<html blocks for halign tables\><<<
6499 \let\ext:cr|=\cr \let\ext:crcr|=\crcr
6500 >>>
6501
6502 \<html blocks for halign tables\><<<
6503 \let\:span|=\span
6504 \def\add:span#1;{\def\:tempa{#1}\edef\:temp{\HRow .\HCol}%
6505 \ifx \:temp\:tempa \Advance:\:MULTISPAN |by 1 \fi
6506 \ifx \:tempa\empty \let\HMultispan|=\:MULTISPAN
6507 \else
6508 |<align for multispan in latex|>%
6509 \expandafter\add:span
6510 \fi }
6511 >>>
6512
6513
6514
6515
6516
6517
6518
6519 \<align for multispan in latex\><<<
6520 \let\:temp|=\relax
6521 \def\:temp##1.{\def\:temp####1|<par del|>{\def\:temp{####1}}%
6522 \afterassignment\:temp\tmp:cnt}%
6523 \expandafter\expandafter\expandafter\:temp\expandafter\:tempa|<par del|>%
6524 \edef\:tempb{\HRow.\HCol\:temp}\ifx\:tempa\:tempb
6525 \expandafter\ifx \csname \expandafter\string\:temp :T:D\endcsname\relax
6526 \else \edef\:mALIGN{\expandafter\noexpand
6527 \csname \expandafter\string\:temp :T:D\endcsname}%
6528 \fi\fi
6529 >>>
6530
6531 \<NO\><<<
6532 \edef\:temp{\HRow .\HCol<}%
6533 \ifx \:temp\:tempa \def\:mALIGN{\l:TD}\fi
6534 \edef\:temp{\HRow .\HCol-}%
6535 \ifx \:temp\:tempa \def\:mALIGN{\c:TD}\fi
6536 \edef\:temp{\HRow .\HCol>}%
6537 \ifx \:temp\:tempa \def\:mALIGN{\r:TD}\fi
6538 >>>
6539
6540
6541
6542 \<before TeXhalign\><<<
6543 \let\sv:end:omit|=\end:omit \let\end:omit|=\empty
6544 \let\ms:count|=\MS:count \HAssign\MS:count|=0
6545 \let\lgn:r|=\HRow \let\lgn:c|=\HCol \HAssign\HRow|=0
6546 \def\span{\xdef\new:span{\new:span\HRow.\HCol;}\:span}%
6547 \let\sv:new:span|=\new:span \let\new:span|=\empty
6548 \gHAdvance\Halgn:cnt |by 1 \edef\halign:id{\Halgn:cnt}%
6549 \edef\old:span{\LikeRef{|<halign tag|>}}%
6550 \ifx \old:span\space \def\old:span{;}\fi
6551 >>>
6552
6553 The \`'\ifx \old:span\space \def\old:span{;}\fi' is needed for first
6554 runs when no info is yet available.
6555
6556 \<after TeXhalign\><<<
6557 \Tag{|<halign tag|>}{\new:span;}%
6558 \global\let\new:span|=\sv:new:span
6559 \iffalse{\fi \let\span|=\:span \iffalse}\fi
6560 \global\let\HRow|=\lgn:r \global\let\HCol|=\lgn:c
6561 \global\let\MS:count|=\ms:count
6562 \global\let\new:row|=\sv:new:row
6563 \global\let\end:omit|=\sv:end:omit
6564 >>>
6565
6566 \<html blocks for halign tables\><<<
6567 \HAssign\Halgn:cnt|=0
6568 >>>
6569
6570
6571
6572
6573 The \''\mu:span' Provides a little movement to
6574 avoid oscilation of multi spans around incorrect values.
6575 It is attached to \''\TitleCount' ingeneral, but not
6576 within \`'\begin{longtable}...\end{longtable}'.
6577 In that environment, \''\caption' may appear, and so change
6578 the value of \''\TitleCount' in the middle of a table, within
6579 a \''\multispan'.
6580
6581
6582
6583
6584 \<halign tag\><<<
6585 |<auto tag|>M\halign:id x\mu:span>>>
6586
6587
6588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6589 \SubSection{TD Script}
6590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591
6592 Through \''\Configure{MkHalign}{....}' with entries of the form
6593 \`'row col insertion ' (space at end:
6594 \`'\Contribute{halignTD}{1 1 - }' is fine but
6595 not \`'\Contribute{halignTD}{1 1 -}'. The first character may be a
6596 code
6597 \''<', \''-', \''>', \''^', \''=', \''-', or \''_'. A row of
6598 value 0 applies for a full column, a column of 0 stands for a full
6599 row, and row and col of 0 stand for a full table.
6600
6601
6602
6603
6604 \<html blocks for halign tables\><<<
6605 \def\derive:TD{%
6606 \bgroup \no:actv
6607 \xdef\:temp{\noexpand\expandafter\noexpand\:temp
6608 \noexpand\halign:TD\:MkHalign: -0 0 1 |<par del|>}%
6609 \egroup
6610 \let\hT:D|=\:temp
6611 \def\:temp##1 ##2 ##3 {\ifnum -1=##1##2##3 \else
6612 |<process TD op|> \expandafter\:temp \fi}%
6613 \def\:tempa##1\empty{}%
6614 \edef\hT:D{\hT:D}}
6615 >>>
6616
6617
6618
6619
6620
6621 \<process TD op\><<<
6622 \ifnum \HRow=##1 \ifnum \HCol=##2 \:TDcode ##3\fi\fi
6623 \ifnum \HRow=##1 \ifnum 0=##2 \:TDcode ##3\fi\fi
6624 \ifnum 0=##1 \ifnum \HCol=##2 \:TDcode ##3\fi\fi
6625 \ifnum 0=##1 \ifnum 0=##2 \:TDcode ##3\fi\fi
6626 >>>
6627
6628 \<html blocks for halign tables\><<<
6629 \def\:TDcode#1{|<process TD code|>\EndTD:CLASS}
6630 \catcode`\_=13 \catcode`\^=13
6631 \pend:defI\:TDcode{\TD:CLASS}%
6632 \let\:temp|=\relax \let\:tempa|=\relax
6633 \edef\no:actv{\let\noexpand\noexpand\noexpand^|=\:temp
6634 \let\noexpand\noexpand\noexpand_|=\:tempa}
6635 \catcode`\_=8 \catcode`\^=7
6636 \def\:temp{^} \def\:tempa{_}
6637 \edef\no:actv{\no:actv}
6638 >>>
6639
6640
6641 \<html blocks for halign tablesNOOO\><<<
6642 \def\:TDcode#1{|<process TD code|>\EndTD:CLASS}
6643 \catcode`\_=13 \catcode`\^=13
6644 \pend:defI\:TDcode{\TD:CLASS
6645 \ifx _##1 \o:TD \expandafter\:tempa \fi
6646 \ifx ^##1 \t:TD \expandafter\:tempa\fi}%
6647 \let\:temp|=\relax \let\:tempa|=\relax
6648 \edef\no:actv{\let\noexpand\noexpand\noexpand^|=\:temp
6649 \let\noexpand\noexpand\noexpand_|=\:tempa}
6650 \catcode`\_=8 \catcode`\^=7
6651 \def\:temp{^} \def\:tempa{_}
6652 \edef\no:actv{\no:actv}
6653 >>>
6654
6655
6656
6657
6658
6659 \<process TD codeOLDTD\><<<
6660 \ifx <#1 \l:TD \expandafter\:tempa \fi
6661 \ifx -#1 \c:TD \expandafter\:tempa \fi
6662 \ifx >#1 \r:TD \expandafter\:tempa \fi
6663 \ifx ^#1 \t:TD \expandafter\:tempa \fi
6664 \ifx =#1 \b:TD \expandafter\:tempa \fi
6665 \ifx ||#1 \m:TD \expandafter\:tempa \fi
6666 \ifx _#1 \o:TD \expandafter\:tempa \fi
6667 \ifx p#1 \p:TD \expandafter\:tempa \fi
6668 \expandafter#1\empty
6669 >>>
6670
6671
6672
6673 \<process TD code\><<<
6674 \expandafter
6675 \ifx \csname \string#1:T:D\endcsname\relax \else
6676 \csname \string#1:T:D\endcsname \expandafter\:tempa \fi
6677 \expandafter#1\empty
6678 >>>
6679
6680
6681 \<html config util\><<<
6682 \NewConfigure{halignTD}[2]{\c:def\TD:CLASS{#1}%
6683 \c:def\EndTD:CLASS{#2}\scan:halignTD}
6684 \def\scan:halignTD#1{\def\:temp{#1}\ifx \:temp\empty\else
6685 \expandafter \sc:halignTD\fi{#1}}
6686 \def\sc:halignTD#1#2{\expandafter\def\csname
6687 \string#1:T:D\endcsname{#2}\scan:halignTD}
6688 >>>
6689
6690
6691 We could also have used \`'\Configure{halignTD} {CLASS="NOWRAP}{"}
6692 { LEFT}{ CENTER}{ RIGHT}
6693 { TOP}{ BASELINE}{ MIDDLE}{ BOTTOM}' fot DTD4.0s.
6694
6695
6696 \<html config util\><<<
6697 \NewConfigure{halignTR}[1]{\def\halignTR{#1}}
6698 \Configure{halignTR}{}
6699 >>>
6700
6701 \<html config util\><<<
6702 \def\halignTBL{\expandafter\ifx \csname v:TBL\endcsname\relax
6703 \else \expandafter\ifx \csname \v:TBL :T:BL\endcsname\relax\else
6704 \csname \v:TBL :T:BL\endcsname
6705 \fi\fi}
6706 \NewConfigure{halignTBL}[1]{\scan:halignTBL{#1}}
6707 \def\scan:halignTBL#1{\def\:temp{#1}\ifx \:temp\empty\else
6708 \expandafter \sc:halignTBL\fi{#1}}
6709 \def\sc:halignTBL#1#2{\expandafter\def\csname
6710 \string#1:T:BL\endcsname{#2}\scan:halignTBL}
6711 >>>
6712
6713
6714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6715 \SubSection{Utilities}
6716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6717
6718
6719
6720
6721
6722 The global is because the table starts within the first entry.
6723
6724 \<html blocks for halign tables\><<<
6725 \def\halign:TB#1<>#2|<par del|>{#1}
6726 \def\halign:TD#1<>#2|<par del|>{#2}
6727 >>>
6728
6729
6730
6731
6732
6733
6734
6735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6736 \Section{A Realization for halign}
6737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6738
6739 \<html halign\><<<
6740 \:CheckOption{no-halign} \if:Option \else
6741 |<halign tables from TeX|>
6742 \fi
6743 >>>
6744
6745
6746
6747 This is the corner stone for deciding the case.
6748
6749
6750 \HTable{
6751 [C10]Witin Picture Environment?\cr
6752 Y&[C10]tex:align\cr
6753 N&[10]within edef (:halign)?\cr
6754 &Y&tex halign\cr
6755 &N&[C10]remove `to dim' (:hlgn: + hl:gn)\cr
6756 &&[C10]change catcode of {\tt \char`\#} (hlg:n)\cr
6757 &&[C10]within a parameter or a def? (hal:gn)\cr
6758 &&Y&[C10]tex:align + PRE\cr
6759 &&N&[C10]open delimiter? (:Hlign)\cr
6760 &&&{\tt\string\bgroup}&[C10]tex:align + PRE\cr
6761 &&{\tt\char`\{}&[C10]go for hypertext table\cr
6762 }
6763
6764
6765
6766
6767
6768
6769 Check whether we are in \''\Picture' environment. This can happen
6770 implicitly through environment \`'\[...\]' or through nesting in a
6771 construct that explicitly activates the picture mode.
6772
6773 \<halign tables from TeX\><<<
6774 \def\h:halign{\ifx \EndPicture\:Undef
6775 \let\to:dim|=\empty \expandafter\:halign
6776 \else \expandafter\TeXhalign:cr\fi}
6777 \:CheckOption{base} \if:Option \else
6778 \def\:temp{\Protect\h:halign}
6779 \HLet\halign|=\:temp
6780 \fi
6781 >>>
6782
6783 \SubSection{Check for /edef Environment}
6784
6785 ENSURE that for cases that reduce to \`'\TeXhalign:cr' the
6786 macro get into edef.
6787
6788
6789
6790
6791
6792
6793 \<halign tables from TeX\><<<
6794 \let\r:lax|=\relax
6795 \def\r:relax{\r:lax}
6796 \let\rl:x|=\relax
6797 \def\:halign{%
6798 \let\rl:x|=\r:relax
6799 \ifx \rl:x\r:relax \expandafter\nodim:hlgn: |%halign not in edef|%
6800 \else \expandafter\TeXhalign:cr |%halign in edef|%
6801 \fi
6802 }
6803 >>>
6804
6805 \SubSection{Remove Dimension}
6806
6807 Remove the dimension in case of \`'\halign to dim{...}'
6808 or \`'\halign spread dim{...}' and store in \''\to:dim'.
6809 The dimension can be nested within another macro
6810
6811 \<halign tables from TeX\><<<
6812 \def\nodim:hlgn:{\futurelet\:temp\hl:gn}
6813 \def\hl:gn{\ifx \:temp\bgroup \let\:tempa|=\hlg:n
6814 \else \def\:tempa##1{\append:def\to:dim{##1}\nodim:hlgn:}\fi
6815 \:tempa}
6816 >>>
6817
6818
6819 Without recording, and using the dimension,
6820 some pictures can get corrupted. For instance,
6821 an overlap of index with the picture may
6822 %%
6823 \ifHtml[\HPage{occur}\Verbatim
6824 \input tex4ht.sty \Preamble{html}
6825 \EndPreamble
6826
6827 \catcode`\@=11
6828
6829 \def\eqalignno#1{\displ@y \tabskip\centering
6830 \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
6831 &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
6832 &\llap{$\@lign##$}\tabskip\z@skip\ crcr #1\ crcr}}
6833
6834 \eqalignno{
6835 li&= 1\ cr
6836 &> line 2& (7)}
6837
6838 \ bye
6839 \EndVerbatim\EndHPage{}]\fi
6840
6841 \SubSection{Check for Embedded Def}
6842
6843 Within macros and parameters, and definitions, the catcode of
6844 characters in general, and \`'#' in particular, can't change. Hence,
6845 in such cases \`'@2' is empty.
6846
6847 \<halign tables from TeX\><<<
6848 \catcode`\#|=13 \catcode`\~|=6
6849 \def\hlg:n{\begingroup \catcode`\#|=13 \let#|=\relax \hal:gn}%
6850 |<process pattern of halign tbl|>
6851 |<halign defs in catcode 13|>
6852 \catcode`\#|=6 \catcode`\~|=13
6853 >>>
6854
6855
6856 If catcodes don't change, we can't get
6857 the catcode 13 for processing the parameters, and the empty flag
6858 comes up.
6859
6860 \<halign defs in catcode 13\><<<
6861 \long\def\hal:gn~1{\p:lgn~1#|<par del|>%
6862 \ifx \:temp\empty
6863 |<embedded halign|>%
6864 \else \def\:temp{\endgroup\:hlign{~1}}\fi \:temp}
6865 \long\def\p:lgn~1#~2|<par del|>{\def\:temp{~2}}
6866 >>>
6867
6868 \SubSection{/halign Not Within Parameters}
6869
6870 By now we know that we are not within a picture or embeded in other
6871 macro or a parameter, and that we have \`'\halign\bgroup...\egroup' or
6872 \`'\halign{...}'. We are going to scan \''\bgroup' or
6873 \`'{...}'.
6874
6875 \<halign tables from TeX\><<<
6876 \long\def\:hlign#1{%
6877 \def\:temp{#1}\def\:tempa{\bgroup}\ifx \:temp\:tempa
6878 \endgroup |<halign into pre|>%
6879 \expand:after{\HRestore\noalign \TeXhalign:cr\bgroup}%
6880 \else |<halign into MkHalign|>%
6881 \fi}
6882 >>>
6883
6884
6885
6886 \<halign into pre\><<<
6887 \:warning{\noexpand\halign translated into linear text}%
6888 >>>
6889
6890
6891 In the above if statement, \''\expandafter' does not work for nested
6892 halign in the true part.
6893
6894 If we scan \''\bgroup' we are going after all to use the original
6895 definition of \''\halign'. Otherwise, we are going for \''\HTable',
6896 and for such a case we want the following environment. The variable
6897 \`'#' controls where patterns should be included in entries and it is
6898 used for spliting the patterns into the two parameters of
6899 \`'\HTableScript'.
6900
6901
6902
6903
6904
6905 \SubSection{Embedded /halign}
6906
6907 The \''\halign' are transformed into pictures
6908 or \''\TeXhalign:cr'.
6909
6910 We now have a command of the form \`'\halign\bgroup...' or
6911 a break up on a case of the form \`'\halign{...body...'.
6912 The parameter \`'~1' is either \''\bgroup' or \`'...body...'.
6913 If we are lucky, the body doesn't start with a \`'#' or \''\bgroup'.
6914
6915 \<embedded halign\><<<
6916 \expandafter\chs:halgn\string ~1|<par del|>%
6917 \:tempb{%
6918 \csname a:embedded-halign\endcsname
6919 \ifmmode
6920 \vbox{|<recall sharp|>$$\TeXhalign:cr \to:dim{~1}$$}%
6921 \else \vbox{|<recall sharp|>\TeXhalign:cr \to:dim{~1}}\fi
6922 \:nopartrue
6923 \csname b:embedded-halign\endcsname
6924 }%
6925 \let\:temp|=\endgroup
6926 \:tempb|<par del|>%
6927 \:tempb\:temp{\endgroup
6928 |<halign into pre|>%
6929 \HRestore\noalign \TeXhalign:cr~1}\:tempa|<par del|>%
6930 >>>
6931
6932 \<halign tables from TeX\><<<
6933 \NewConfigure{embedded-halign}{2}
6934 \Configure{embedded-halign}
6935 {\expand:after{\Picture+}\pic:hlng{ \a:@Picture{pic-halign}}}
6936 {\EndPicture}
6937 >>>
6938
6939 The \`'\vbox{|<recall sharp|>\TeXhalign:cr \to:dim{@1}}' is needed to
6940 keep the picture in one page. Without this we get from tex4ht.c
6941 \ifHtml\HPage{complaints}\Verbatim
6942 \documentclass{book}
6943
6944 \input tex4ht.sty
6945 \Preamble{html}
6946 \begin{document}
6947
6948 \EndPreamble
6949
6950 \halign{\empty{#}&&{#}\cr phi&varphi\cr}
6951 \end{document}
6952
6953 \EndVerbatim \EndHPage{}\fi{} of mismatches \`'\specals{+}' (due to split
6954 over pages?).
6955
6956 An \''\halign{...}' can be in math mode \`'$$....$$', but
6957 not within inline math mode. If it is there, there are quite
6958 a few restctions (not clear of which kind) on what can appear in the math
6959 code outside the \`'\halign'. Hence, we put everything into math mode
6960 in a sepearte box just for an extra precaution.
6961
6962 % \:warning{\noexpand\halign translated into a picture}
6963
6964
6965 \''\TeXhalign:cr' reestablishes the meaning of \''\cr' and \''\crcr'
6966 for picture-mode, but not for the second one. The later case
6967 may cause problems.
6968
6969
6970 Pictures might be called for also with \`'#' having catcode 13,
6971 as is the case with \`'\halign{\empty{#}&&{#}\cr phi&varphi\cr}'
6972 (but not with
6973 \`'\halign{\empty #&& #\cr phi&varphi\cr}').
6974 In this case, the scanning in \`'\p:lgn@1#|<par del|>%' can't detect
6975 the sharp characters that are embedded in braces. That is, a neccesary
6976 condition for getting tabular representation is at least one \`'#' out
6977 of braces, to ensure that such characters can get catcode 13.
6978
6979
6980
6981 \<recall sharp\><<<
6982 \Rc:sharp
6983 >>>
6984
6985 \<halign tables from TeX\><<<
6986 \catcode`\#=13
6987 \def\Rc:sharp{\let#=\sv:sharp}
6988 \catcode`\#=6
6989 \def\:temp{\let\sv:sharp=##}\:temp
6990 >>>
6991
6992 \SubSection{Utilities fo Embedded /halign}
6993
6994 \<halign tables from TeX\><<<
6995 \def\chs:halgn#1{\def\:temp{#1}%
6996 \def\:tempa##1##2##3##4##5{\def\:tempa{##1}\def\:tempb{##2}%
6997 \def\:tempc{##3}\def\:tempd{##4}\def\:tempe{##5}}%
6998 \expandafter\:tempa\string\bgro
6999 \ifx \:temp\:tempa \expand:after{\expandafter\try:b\string}%
7000 \else \expandafter\brc:halign \fi}
7001 \def\try:b{\try:ch\:tempb\try:g}
7002 \def\try:g{\try:ch\:tempc\try:r}
7003 \def\try:r{\try:ch\:tempd\try:o}
7004 \def\try:o#1{\def\:temp{#1}%
7005 \ifx \:temp\:tempe \def\:tempb{|<bgroup halign|>}%
7006 \else \let\:temp|=\empty
7007 \def\:tempb{|<braced halign|>}\fi
7008 |<tempa = consume the rest of @1|>\:tempa}
7009 \def\try:ch#1#2#3{\def\:temp{#3}%
7010 \ifx \:temp#1 \expand:after{\expandafter#2\string}%
7011 \else \expandafter\brc:halign \fi}
7012 >>>
7013
7014 \<halign tables from TeX\><<<
7015 \def\brc:halign{%
7016 \let\:temp|=\empty \def\:tempb{|<braced halign|>}%
7017 |<tempa = consume the rest of @1|>\:tempa}
7018 >>>
7019
7020 \<tempa = consume the rest of @1\><<<
7021 \long\def\:tempa##1|<par del|>{}%
7022 >>>
7023
7024 \<bgroup halign\><<<
7025 \let\:tempb|=\def\:tempa
7026 >>>
7027
7028 \<braced halign\><<<
7029 \let\:tempb|=\:tempa
7030 >>>
7031
7032
7033 \SubSection{/halign into {\tt <PRE>}}
7034
7035
7036
7037
7038 We temporariliy get out from display mode, because we want the
7039 \`'<PRE>' before \''\halign' and nothing is allowed before
7040 \''\halign' in display mode. The enclosure within table is
7041 to group the content for protection from embedding \''<CENTER>' commands and
7042 the like.
7043
7044
7045 \SubSection{/halign into /MkHalign}
7046
7047
7048 We now have a command of the form \`'\halign{....}' or
7049 a break up on a case of the form \`'\halign{....\egroup'.
7050
7051
7052
7053 \<halign into MkHalign\><<<
7054 \let\tabskip|=\tmp:dim \let\hrulefill|=\empty
7055 \let\hidewidth|=\empty
7056 \expand:after{\h:align#1\cr|<par del|>#1|<par del|>}%
7057 >>>
7058
7059
7060
7061 The pattern of \''\halign' can end with a \''\cr' or a \''\crcr'. We
7062 first check whether \''\cr' present, and if so whether or not it is
7063 preceded by a \''\crcr'.
7064
7065 \<halign tables from TeX\><<<
7066 \catcode`\#|=13 \catcode`\@|=6
7067 \long\def\h:align@1\cr@2|<par del|>{\def\:temp{@2}\ifx \:temp\empty
7068 \expandafter\h:alignII \else \crcr:align@1\crcr|<par del|>\fi}
7069 \def\crcr:align@1\crcr@2|<par del|>{\def\:temp{@2}\ifx \:temp\empty
7070 \expandafter\expandafter\expandafter\h:alignI \else
7071 \expandafter\expandafter\expandafter\h:alignII \fi}
7072 \long\def\h:alignI@1\cr@2|<par del|>{%
7073 \SaveMkHalignConfig |<halign configuration for halign|>%
7074 \MkHalign#{@1}@2\EndMkHalign \RecallMkHalignConfig}
7075 \def\h:alignII@1\crcr{\h:alignI@1\cr}
7076 \catcode`\#|=6 \catcode`\@|=11
7077 >>>
7078
7079
7080
7081
7082
7083 \<halign configuration for halign\><<<
7084 \Configure{MkHalign}{\hlg:a}{\hlg:b}
7085 \hlg:c\hlg:d{\hlg:e\RecallMkHalignConfig}\hlg:f
7086 >>>
7087
7088
7089
7090 \<html config util\><<<
7091 \NewConfigure{halign}[6]{\c:def\hlg:a{#1}%
7092 \c:def\hlg:b{#2}\c:def\hlg:c{#3}\c:def\hlg:d{#4}%
7093 \c:def\hlg:e{#5}\c:def\hlg:f{#6}}
7094 \NewConfigure{pic-halign}[1]{\def\pic:hlng{#1}}
7095 >>>
7096
7097
7098 \<math config util\><<<
7099 \def\:halign:{<>}
7100 >>>
7101
7102
7103
7104
7105
7106 We must put in at least the \`'<>'.
7107
7108
7109 % [[gif\r:brk]
7110
7111 %%%%%%%%%%%%%%%%%%%%%%%
7112 \SubSection{noalign}
7113 %%%%%%%%%%%%%%%%%%%%%%%%%
7114
7115 In TeX4ht \`'\everycr\noalign' causes a loop because the definition of
7116 \''\halign' includes \''\cr'. We declare a loop when 100 cycles are
7117 encountered. Another possible problem is due to \''\hline'
7118 which contains \''noalign' at its start.\ifHtml[\HPage{more}\Verbatim
7119 \begin{tabular}{||l|c|c|c||} \hline
7120 \multicolumn{4}{|c|}{\LaTeX\ size changing commands}\\ \hline
7121 Style option & 10pt (default) & \tt 11pt & \tt 12pt\\ \hline
7122 \end{tabular}
7123 \EndVerbatim\EndHPage{}]\fi
7124
7125 If we want to go for optional \''\noalign' with response to a parameter
7126 in \''\Preamble', we need to take care of places that needs it html interpretation
7127 (in tables?).
7128
7129
7130
7131 \<halign tables from TeX\><<<
7132 |<noalign|>
7133 >>>
7134
7135
7136
7137
7138 \<noalign\><<<
7139 \HAssign\noalign:N|=0
7140 \def\:tempc#1{|<cycle protection fo noalign|>%
7141 \vtop{\IgnorePar\a:noalign\vtop{\IgnorePar#1}\b:noalign}\cr
7142 \global\tmp:toks|=\everycr \global\everycr{}\cr
7143 \o:noalign:{\global\everycr|=\tmp:toks \gHAssign\noalign:N|=0 }%
7144 }
7145 \HLet\noalign|=\:tempc
7146 |<another alternative for noalign|>
7147 >>>
7148
7149 We probbaly can remove the cycle protection.
7150
7151 The internal \''\top' is to ensure vertical mode for material which
7152 assumes it. In the extreem, that also prevents infinite loops.
7153
7154 % \h:noalign
7155
7156 \<shared config\><<<
7157 \NewConfigure{noalign-}[2]{\c:def\a:noalign{#1}\c:def\b:noalign{#1}}
7158 >>>
7159
7160 Any reason left for keeping both cases?
7161
7162 \<shared config\><<<
7163 \:CheckOption{no-halign} \if:Option \else
7164 \NewConfigure{noalign}{2}
7165 \fi
7166 >>>
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178 The \''\Protect' is needed, for instance, in \''\endalignat'
7179 of amstex.tex during a pre-edef stage.
7180
7181 The looping can happen in
7182 \''\displaylines', \''\eqalignno', and \''\leqalignno'
7183 due to the first command below (\''\@align'?.).
7184
7185
7186 \<cycle protection fo noalign\><<<
7187 \gHAdvance\noalign:N by 1
7188 \ifnum \noalign:N>100
7189 \global\let\noalign|=\o:noalign:
7190 \:warning{TeX4ht can't handle
7191 \string\everycr{...\string\noalign...}}%
7192 \fi
7193 >>>
7194
7195
7196 Removed \`'\let\dotfill|=\empty'. Did I have any reason
7197 to put it there in first place?
7198
7199
7200
7201 \Chapter{Verbatim Enviroments}
7202
7203
7204 \<local env\><<<
7205 |<blocs for local env|>
7206 \ifHtml |<html local env|>
7207 \fi
7208 |<verbatim|>
7209 >>>
7210
7211
7212
7213 \Section{Verbatim Text}
7214
7215
7216
7217
7218 NOTE: VERBATIM WAS THERE for javascript and the like????
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229 \SubSection{Between Paragraphs}
7230
7231 For the option \`'\Verbatim-', it should be noted the requested
7232 special character should not come from the word \`'EndVerbatim'.
7233 Letters within the environment carry categoty code 11, space, tab and
7234 end-of-line characters carry category code 13, and the other
7235 characters have category code 12. {CHECK TABS}
7236
7237 \<verbatim\><<<
7238 \def\V:rbatim{\begingroup \begin:Verb \Verb:env }
7239 \def\:EndVerbatim{\end:Verb \endgroup }
7240 >>>
7241
7242 \<the /EndVerbatim delimiter\><<<
7243 {
7244 \xdef\Verb:atim#1\EndVerbatim{\noexpand\vrb:tt
7245 \leavevmode#1\noexpand\:EndVerbatim}
7246 \catcode`\/|=0 /catcode`/\|=12
7247 /xdef/Ver:batim#1\EndVerbatim{/noexpand/vrb:tt
7248 /leavevmode#1/noexpand/:EndVerbatim}
7249 }
7250 >>>
7251
7252 Without the \''/leavevmode' the header is lost when
7253 \''\Verbatim' is followed by empty line.
7254 \ifHtml[\HPage{test}\Verbatim
7255 \Verbatim
7256
7257 x
7258
7259 y
7260
7261 \ EndVerbatim
7262
7263
7264 \Verbatim
7265 x
7266
7267 y
7268
7269 \ EndVerbatim
7270
7271 \EndVerbatim\EndHPage{}]\fi
7272
7273
7274
7275 \Verbatim
7276
7277 > > 5. Also, why did you go in the first place to `alltt' and
7278 > > not `verbatim'?
7279 >
7280 > Verbatim is an ugly beast. It can't be placed in the argument of
7281 > another environment - e.g., I can't create a new environment like this:
7282 >
7283 > \newenvironment{\test}
7284 > {\fontsize{11}{12}\selectfont\begin{verbatim}}
7285 > {\end{verbatim}}
7286
7287 \EndVerbatim
7288
7289
7290
7291
7292
7293
7294
7295
7296 \<html config util\><<<
7297 \NewConfigure{tt}[1]{\let\vrb:tt|=#1}
7298 \let\vrb:tt|=\tt
7299 >>>
7300
7301 \<verbatim\><<<
7302 \def\Verb:env{\no:catcodes0{64}{12}\no:catcodes{65}{90}{11}%
7303 \no:catcodes{91}{96}{12}\no:catcodes{97}{122}{11}%
7304 \no:catcodes{123}{255}{12}%
7305 \catcode`\^^M|=13 \catcode`\ |=13 \catcode`\^^I|=13
7306 \:Verbatim \::Verbatim }%
7307 \def\::Verbatim{\futurelet\:temp\V:erbatim}
7308 \def\V:erbatim{%
7309 \ifx -\:temp \expandafter\Ve:rbatim
7310 \else \let\start:verb|=\Ver:batim \expandafter\Ver:sp \fi }
7311 \def\Ver:sp{%
7312 \ifx \ver:sp\:temp \expandafter\Ver:assg
7313 \else \expandafter\Ver:ln \fi }
7314 \def\Ver:ln{%
7315 \ifx \ver:ln\:temp \expandafter\Ver:assg
7316 \else \expandafter\start:verb \fi }
7317 \def\Ver:assg{\afterassignment\start:verb\let\:temp|=}
7318 |<optional control char in /Verbatim|>
7319 |<space and eoln chars in /Verbatim|>
7320 |<the /EndVerbatim delimiter|>
7321 >>>
7322
7323
7324 \<optional control char in /Verbatim\><<<
7325 {
7326 \catcode`\/|=0
7327 /catcode`/\|=12
7328 /gdef/Ve:rbatim#1#2{/catcode`#2|=0
7329 /ifx #2\/let/start:verb|=/Verb:atim
7330 /else /let/start:verb|=/Ver:batim /fi
7331 /futurelet/:temp/Ver:sp}
7332 }
7333 >>>
7334
7335
7336 \<space and eoln chars in /Verbatim\><<<
7337 {
7338 \catcode`\^^I|=13 \catcode`\/|=0 \catcode`\\|=12
7339 /catcode`/.|=10 /catcode`/^^M|=13 /catcode`/ |=13%
7340 /gdef/:Verbatim{%
7341 .../def^^M{/ht:everypar{/Verb:eoln}/Verb:boln/par/leavevmode}%
7342 .../def {/Verb:sp}%
7343 .../let/ver:sp|= %
7344 .../let/ver:ln|=^^M%
7345 .../def^^I{/leavevmode }}}
7346 >>>
7347
7348 The following establishes a configurartion according to
7349 what should appear at the start, end, and each end-of-ln.
7350
7351
7352
7353
7354 % \def\Verb:eoln{\hfil\break\null}
7355
7356 \<verbatim\><<<
7357 \NewConfigure{VerbatimEnv}[2]{\def\begin:Verb{#1}\def\end:Verb{#2}}
7358 \Configure{VerbatimEnv}
7359 {\par \edef\leftsk:p{\hskip\Verb:Left}%
7360 \leftskip|=\z@ \parindent|=\z@ \ht:everypar{\verb:config}}
7361 {\aft:Verb\par}
7362 \def\verb:config{\bef:Verb\csname leftsk:p\endcsname
7363 \def\verb:config{\Verb:boln \def\Verb:eoln{\leavevmode\par}\leftsk:p}}
7364 >>>
7365
7366 % \def\Verb:eoln{\par \everypar{\verb:config}%
7367 % \def\Verb:eoln{\par}}
7368 %
7369
7370
7371 The following uses the above vehicle to establish a configuration
7372 in accordance to what should appear at the start, end, and
7373 before each of the non-leading lines.
7374
7375
7376
7377
7378
7379 \<html config util\><<<
7380 \NewConfigure{HVerbatim}[4]{\c:def\bef:Verb{#1\Verb:eoln}%
7381 \c:def\aft:Verb{\ht:everypar{}#2}%
7382 \c:def\Verb:eoln{#3}\c:def\Verb:boln{#4}}
7383 \NewConfigure{HVerbatim+}[2]{\d:def\Verb:Left{#1}%
7384 \def\Verb:sp{#2}}
7385 >>>
7386
7387
7388
7389
7390
7391
7392
7393 The above has left margin of \''\Verb:Left' and typically has
7394 inappropriate space above and below the code. The following takes the
7395 left margin of the html code.
7396
7397 \Verbatim
7398 \Configure{HVerbatim}
7399 {\HtmlPar\HCode{<NOBR><CODE>}}
7400 {\HChar{160}\HCode{</CODE></NOBR>}}
7401 {\HChar{160}\HCode{</CODE></NOBR><BR><NOBR><CODE>}}
7402 \EndVerbatim
7403
7404
7405
7406 %
7407 %\Configure{HVerbatim}
7408 % {\IgnoreIndent \HObey \par \leavevmode}
7409 % {\EndHObey\IgnoreIndent \par}
7410 % {\hfil\break\null \HCode{\html:invisible}\nobreak \hskip
7411 % \ifdim \leftskip>0pt \leftskip \else 2em \fi}
7412
7413
7414 The \`'\leavevmode' is needed for the case that the commands start
7415 paragrphs, to ensure that \`'\everypar' operations would be performed
7416 outside the groups of the commands.
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426 \Section{JavaScript}
7427 Note that the first parameter of \''\ScriptCommand' must be in
7428 braces, without surrounding spaces.
7429
7430 \<scripting commands\><<<
7431 \def\ScriptCommand{\begingroup \catcode`\\|=12
7432 \:DefScript}
7433 \def\:DefScript#1{\endgroup \Def:Script#1|<par del|>}
7434 \def\Def:Script#1#2|<par del|>{%
7435 \expandafter\let\csname :#2:\endcsname|=\empty
7436 \edef\:temp{\long\def\expandafter\noexpand\csname a:#2\endcsname
7437 ####1\expandafter\noexpand\csname End#2\endcsname
7438 {####1\noexpand\:EndVerbatim}}\:temp
7439 \long\expandafter\def\csname
7440 b:#2\endcsname##1#1End#2{##1\:EndVerbatim}%
7441 \edef\:temp{\noexpand\DefScript:
7442 \expandafter\noexpand\csname #2\endcsname
7443 {\expandafter\noexpand\csname a:#2\endcsname}%
7444 {\expandafter\noexpand\csname b:#2\endcsname}}\:temp
7445 }
7446 >>>
7447
7448 The \''\long' above is for cases that the new command is embeded
7449 in other commands as is the case, for instance, in \''\CssFile'.
7450
7451
7452
7453 \`'\begin{keep}-\
7454 AAAAAAAAAAAAAAAAA
7455 BBBBB
7456 \end{keep}'
7457 or
7458 \`'\begin{keep}
7459 AAAAAAAAAAAAAAAAA
7460 BBBBB
7461 \end{keep}'
7462
7463
7464
7465 \<scripting commands\><<<
7466 \def\DefScript:#1#2#3#4#5{\def#1{\call:script{#2}{#3}{#4}{#5}}}
7467 \def\call:script#1#2#3#4{\begingroup \vrb:tt
7468 \leftskip|=\z@ \parindent|=\z@
7469 \Configure{HVerbatim}{\empty}{\empty}%
7470 {\special{t4ht=}\empty}{\empty}%
7471 \Configure{HVerbatim+}{\z@}{\hbox{ }}%
7472 #3\ht:special{t4ht@@}%
7473 \let\Verb:atim|=#1\let\Ver:batim|=#2%
7474 \def\:EndVerbatim{\ht:special{t4ht@@}%
7475 #4\endgroup\ignorespaces}\Verb:env}
7476 >>>
7477
7478 % \let\html:invisible|=\empty
7479
7480
7481
7482
7483 A \`'\Configure{HVerbatim}{}{}{}{}' above will be problematic for
7484 the \`'hooks' option. The \`'\special{t4ht=}'is to ensure
7485 pseudo code at empty lines.
7486
7487
7488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7489 \Section{Cascade Style Sheets}
7490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7491
7492
7493
7494 \<scripting commands\><<<
7495 \def\a:rootfont:{-}
7496 \:CheckOption{fonts+} \if:Option \def\a:rootfont:{+}
7497 \else
7498 \Log:Note{for marking of the base font,
7499 use the command line option `fonts+'}%
7500 \fi
7501 >>>
7502
7503 The above option requests css font information for the root font of
7504 the file.
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520 \''\xml:empty' is for inserting the \''/' at end of tags by demand.
7521
7522 The \''\edef\Preamble{\Preamble}' is needed for context where the
7523 command line arguments come indirectly through an \''\env' macro.
7524
7525 \<utilities\><<<
7526 \ifx \xml:empty\:UnDef
7527 \edef\Preamble{\Preamble}
7528 \:CheckOption{xhtml}
7529 \if:Option \else \:CheckOption{xml}\fi
7530 \if:Option
7531 \def\xml:empty{ /}
7532 \long\def\:xhtml#1{#1}
7533 \else
7534 \Log:Note{for XML code, use the command line option
7535 `xml' or `xhtml'}%
7536
7537 \let\:xhtml|=\:gobble
7538 \let\xml:empty|=\empty
7539 \fi \fi
7540 >>>
7541
7542
7543
7544
7545
7546 Default font (the extra code is neded in order to activate it
7547 within the dvi file before a change in font, e.g., for a title):
7548
7549 \<start html file\><<<
7550 \ht:special{t4ht>\jobname.tmp}{\everyhbox{}\hbox
7551 {x\ht:special{t4ht;\a:rootfont:}x}}%
7552 \ht:special{t4ht<\jobname.tmp}%
7553 >>>
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572 \<early Configure\><<<
7573 \NewConfigure{Css}[1]{\def\aa:Css{#1}}
7574 >>>
7575
7576
7577
7578 \<html utilitiesNO\><<<
7579 \tmp:cnt|=\time \divide\tmp:cnt |by 60
7580 \edef\:temp{\the\tmp:cnt}
7581 \multiply\tmp:cnt |by -60 \advance\tmp:cnt |by \time
7582 \edef\:today{\the\year-\ifnum \month<10 0\fi
7583 \the\month-\ifnum \day<10 0\fi\the\day
7584 \space\ifnum \:temp<10 0\fi \:temp
7585 :\ifnum \tmp:cnt<10 0\fi\the\tmp:cnt :00}
7586 >>>
7587
7588
7589
7590 \Chapter{Ditto: Positioned Elements and Gifs}
7591
7592 \<gif\><<<
7593 \ifHtml |<html gif|>
7594 \fi
7595 >>>
7596
7597
7598 \Section{Positioned Elements}
7599
7600 \<shared config\><<<
7601 \NewConfigure{Canvas}[3]{}
7602 >>>
7603
7604
7605
7606
7607 \Verbatim
7608 % * can be replaced by any distinguished character
7609 % \special{
7610 % * before-all
7611 % * after-all %right %left %height %depth
7612 % * before-char %x %y
7613 % * after-char
7614 % * line %x %y %thickness %length
7615 % * x-coefficients %A(x) + %B
7616 % * y-coefficients %C(y) + %D
7617 % }
7618 \EndVerbatim
7619
7620 \<html gif\><<<
7621 \def\Canvas{\ht:special{t4ht"}}
7622 \let\EndCanvas|=\Canvas
7623 >>>
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635 The attached source tries three renderings for `A<sub>x</sub>'. My
7636 understanding of the positioning mechanism is that, in all three cases,
7637 the reference point for `x' should be 0.7ex under the right leg of A.
7638 Moreover, the measurement 0.7ex should be with respect to the
7639 dimension of the font of A.
7640
7641 \Verbatim
7642
7643 /\
7644 /--\
7645 / \...........
7646 \/ } 0.7ex within font of A
7647 ./\.......}
7648
7649
7650 A<SPAN
7651 STYLE="position:relative"><SPAN
7652 STYLE="position:absolute; top:0.7ex"><SPAN
7653 STYLE="font-size: 70% ;">x</SPAN></SPAN></SPAN>
7654 \EndVerbatim
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665 \Section{/Picture Comamnd}
7666
7667
7668
7669
7670
7671 \<html gif\><<<
7672 \def\:img{%
7673 \ifx *\:temp \let\:temp|=\i:mgif \let\:next|=\:GIf
7674 \else \ifx +\:temp \let\:temp|=\i:mgif \let\:next|=\:Gif
7675 \else \ifx [\:temp \let\:temp|=\im:g
7676 \else \def\:temp{\im:g[{\csname
7677 a:Picture-alt\endcsname}]}%
7678 \fi \fi \fi \:temp}
7679 >>>
7680
7681 \<html config util\><<<
7682 \NewConfigure{Picture-alt}{1}
7683 \Configure{Picture-alt}{}
7684 >>>
7685
7686
7687
7688
7689 \''\Configure{Picture-alt}' is for \''\Picture{...}' commands; it
7690 provides the default content. The other two commands tell whether the
7691 bit maps and given alyternate values, respictively, are to be used.
7692 The are used, iff the argument has non empty value (the argument
7693 itself is not used).
7694
7695
7696
7697
7698 Without the \''\leavevmode' above, the start of paragraph can
7699 \HPage{enter}
7700 \Verbatim
7701 \Picture{OSU.gif xx yy}
7702
7703 \Picture{OSU.gif xx yy }
7704
7705 \Picture{OSU.gif}
7706
7707
7708 \Picture{OSU.gif }
7709
7710
7711
7712 \Picture[xx]{OSU.gif xx yy}
7713
7714 \Picture[xx]{OSU.gif xx yy }
7715
7716 \Picture[xx]{OSU.gif}
7717
7718 \Picture[xx]{OSU.gif }
7719 \EndVerbatim
7720 \EndHPage{}
7721 into the \''<IMG ..>' tag.
7722
7723
7724
7725
7726 Empty file name is a request for a default name of the form
7727 \`'\jobname%\romannumeral
7728 \P:ctureCount'.
7729
7730
7731
7732 \<gif\><<<
7733 \def\P:ct{\leavevmode \futurelet\:temp\:img}
7734 \let\Picture|=\P:ct
7735 \def\yes:pic{\PictureOn}
7736 \def\no:pic{\PictureOff}
7737 >>>
7738
7739
7740
7741
7742 \Section{Call to Specials of Gif}
7743
7744
7745 \<gif\><<<
7746 \def\i:mgif#1{\futurelet\:temp\:gif}
7747
7748 \def\:gif{%
7749 \ifx \:temp[\expandafter\:GifText
7750 \else \expandafter\:next \fi }
7751 >>>
7752
7753 The following macro is for imported pictures \`'\Picture{....}' and
7754 \`'\Picture[...]{...}'.
7755
7756 \<html gif\><<<
7757 \def\xim:g[#1]#2{{\cond:pic{%
7758 \def\gif:nm{\edef\gif:nm}\gif:name{#2}%
7759 \expandafter\get:ext\gif:nm.|<par del|>%
7760 \edef\PictureFile{\gif:nm\ifx\:temp\empty \PictExt\fi}%
7761 \Needs-\PictureFile \ht:special{t4ht@-}%
7762 \a:IMG\ht:special{t4ht=\PictureFile}\b:IMG
7763 \a:PictureAlt{#1}\b:PictureAlt \d:IMG
7764 \a:PictureAttr{\at:IMG}\e:IMG}}\After:Picture}
7765 \def\noim:g[#1]#2{}
7766 \let\im:g|=\xim:g
7767 >>>
7768
7769 \<html config util\><<<
7770 \NewConfigure{PictureAlt}{2}
7771 \NewConfigure{PictureAttr}[1]{\def\a:PictureAttr##1{#1}}
7772 \Configure{PictureAlt} {\NoFonts} {\EndNoFonts}
7773 \Configure{PictureAttr} {\HCode{\Hnewline #1}}
7774 >>>
7775
7776
7777
7778 The following macro is for labeled bit pictures \`'\Picture+{....}'
7779 and \`'\Picture*{...}'.
7780
7781
7782
7783 \<html gif\><<<
7784 \def\strt:gf#1#2{#2%
7785 \csname a:PictureAlt*+\endcsname
7786 \let\sv:sp\sp
7787 \let\sv:sb\sb
7788 \ifx \s:p\:UnDef \else \let\sp\s:p \fi
7789 \ifx \s:b\:UnDef \else \let\sb\s:b \fi
7790 \if #1!\ht:special{t4ht!\:AltPicture:}%
7791 \global\let\:AltPicture:|=\empty \fi |% send to char map|%
7792 \ht:special{t4ht||}%
7793 \ht:special{t4ht++\PictureFile}%
7794 \iprt:special
7795 }
7796 \def\nd:gf#1#2{%
7797 \let\ht:special|=\tex:special
7798 \ht:special{t4ht+}%
7799 \if #1!\ht:special{t4ht!}\fi |%stop sending to char map|%
7800 \let\sp\sv:sp
7801 \let\sb\sv:sb
7802 \ht:special{t4ht||}%
7803 \csname b:PictureAlt*+\endcsname
7804 \ifx #2\relax \else \csname a:PictureAttr*+\endcsname{#2}\e:IMG\fi
7805 }
7806 \def\img:alt{\ht:special{t4ht@-}%
7807 \a:IMG\ht:special{t4ht=\PictureFile}\b:IMG}
7808 >>>
7809
7810
7811
7812
7813
7814
7815
7816
7817 \<shared config\><<<
7818 \NewConfigure{PictureAlt*+}{2}
7819 \NewConfigure{PictureAttr*+}[1]{%
7820 \expandafter\def\csname a:PictureAttr*+\endcsname##1{#1}%
7821 }
7822 \Configure{PictureAttr*+}{\ht:special{t4ht=#1}}
7823 >>>
7824
7825
7826
7827
7828
7829
7830 \Verbatim
7831 flag ){ `<make a special for dvi driver`> }
7832 else switch( get_char() ){
7833 case '+': { `<out gif filename`>
7834 case '@': { `<write to lg file`> break; }
7835
7836 case '+': { while( special_n-- > 0 ) (void) get_char(); break; }
7837 case '=': Contribution of text (\''\HCode').
7838 case '<':
7839 case '>': { `<redirect html output`> break; }
7840 case '!': { `<handle char map mode`> break; }
7841 case '|': { gif_ch = !gif_ch; break; }
7842
7843 case "..." : Positioned dvi code
7844
7845 \item \`'.extension for root file'
7846
7847
7848 \item \`'@@' for char mode (what is this????) e.g., javascript
7849 \item \`'@+' for note to lg file (where is this???)
7850 \item \`'@-' for removing left margins from char maps
7851
7852
7853 \HCode{<HR>}
7854
7855 \item \`'@%P' --- On-off modes for traceing of POP, PUSH in DVI
7856 \item \`'@%D' --- On-off modes for traceing CHAR...RAHC in DVI
7857 \item \`'@%H' --- On-off modes for traceing h spaces
7858 \item \`'@%V' --- On-off modes for traceing v spaces
7859 \item \`'@%R' --- On-off modes for traceing x rulers
7860
7861
7862 In all the above, uppercase for plus, lowercase for minus 1
7863
7864 \item \`'@%%x...pre...x...post...' --- Group tracing.
7865 Default \`'<!-- DVI ' and \`'\n-->', where \''\n' represents
7866 new line char (i.e., \`'\Hnewline').
7867 \`'x' can be any character. if it is not there,
7868 the postfix is assumed to be empty.
7869 \item \`'@%...' --- Not used, if not of the above format
7870
7871 \HCode{<HR>}
7872
7873 \item \`':+...' increment by 1( define, if not defined)
7874 \item \`':-...' decrement by 1
7875 \item \`':>...' push current value
7876 \item \`':<...' pop current value
7877 \item \`':!...' display current value
7878 \item \`':|...' display top value
7879
7880 \item \`';-' --- yes default font
7881 \item \`';+' --- no default font
7882 \item \`';%' --- insert font size
7883 \item \`';=' --- insert css name of ch
7884
7885
7886 \item \`';i' --- i=1 (before ch-name),2 (between ch-name and ch),3
7887 (after ch), 4 (before img-src), 5 (between img-src and alt), 6
7888 (between alt and name), 7(after name).
7889 \item \`';8' --- PauseFontStyle
7890 \item \`';9' --- ContFontStyle
7891
7892 \item \`'~' --- on/off for transport data to group boundaries
7893 \item \`'~<....' --- transport back
7894 \item \`'~>....' --- transport forward
7895
7896 \EndVerbatim
7897
7898
7899
7900
7901
7902
7903 \Section{The Environment of Gif}
7904
7905
7906
7907 \<html config util\><<<
7908 \NewConfigure{IMG}{5}
7909 >>>
7910
7911
7912 The third and forth parameters are separated by user
7913 cotributed attr-list.
7914
7915
7916
7917
7918 \<html config util\><<<
7919 \NewConfigure{Picture}[1]{\def\PictExt{#1}}
7920 \Configure{Picture}{.png}
7921 >>>
7922
7923 \<picture off\><<<
7924 \let\im:g|=\noim:g
7925 >>>
7926
7927 \<picture on\><<<
7928 \let\im:g|=\xim:g
7929 >>>
7930
7931
7932
7933 GIF:
7934 \List{*}
7935
7936 \item
7937 Lossless compression
7938 \item Supports 256 colors. Good for pictures that use only a few colors
7939 \item Relies on an algorithm copyrighted by Unisys. However, the patent
7940 expired (20 June 2003 in US; a year later in Canada, Germany,
7941 France, Italy, Japan, UK).
7942 \item Supports animation
7943 \item
7944 The name stands for Graphics Interchange Format
7945 \item Doesn't support unicode
7946 \EndList
7947
7948
7949 PNG:
7950
7951 \List{*}
7952 \item Losless compression superior to GIF
7953 \item Recommendation status at W3C:
7954 \Link[http://www.w3.org/Graphics/PNG/]{}{}{\tt
7955 http://www.w3.org/Graphics/PNG/}\EndLink{}.
7956 \item Developed as a patent-free alternative GIF
7957 \item Doesn't support animation
7958 \item The name stands for Portable Network Graphics
7959 \item Supports unicode
7960 \EndList
7961
7962
7963
7964 JPG:
7965 \List{*}
7966 \item
7967 Uses lossy compression that discards information the human eye cannot detect.
7968 \item
7969 Supports 16 million colors
7970 \item
7971 Good for photographs and complex graphics
7972 \item
7973 Noticeable reduction in quality for line drawings
7974 \item Named after the committee Joint Photographic Experts Group
7975 that defined the standard.
7976 \EndList
7977
7978
7979 \SubSection{With Char Map}
7980
7981 Independent block: no brackets.
7982
7983 Resolution can be an integer number or a pair of integer numbers
7984 separated by a comma. The first for x-resolution, the second for
7985 y-resolution. Then we can have a map for boundary characters made
7986 up of pairs: character to be replaced followed by replcment.
7987
7988
7989 For \`'\Picture+{}': (no box, no pre)
7990
7991 \<html gif\><<<
7992 \def\:Gif#1{\cond:pic{%
7993 \gif:name{#1}\csname a:Picture+\endcsname
7994 \strt:gf!\img:alt
7995 \def\EndPicture{\nd:gf!{\c:IMG\Pic:Img}%
7996 \let\EndPicture|=\:UnDef \csname b:Picture+\endcsname
7997 \After:Picture}}}
7998 >>>
7999
8000 \<html config util\><<<
8001 \NewConfigure{Picture+}{2}
8002 >>>
8003
8004
8005
8006
8007
8008
8009
8010
8011 For \`'\Picture*{}': Vertical box + pre. Might be a problem because
8012 vertical boxes assume the width of the page, and a few of them in a
8013 line may cause a picture to go out of the page boundaies---a problem
8014 for convert. If the content of the box is just a box, or boxes, as is
8015 the case in DraTeX, they the ebeded boxes induce the width.
8016 The \`'\hfill\break' may handle some of these cases.
8017
8018 \`'\Picture*{}.....\EndPicture' will go to \''\:GIf'.
8019 \`'\Picture*[..]{}.....\EndPicture' will go to \''\:GifText'.
8020
8021
8022 \<html gif\><<<
8023 \def\:GIf#1{\cond:pic{\ifvmode\vfill\break\else
8024 \ht:special{t4ht@[}\hfill\break.\ht:special{t4ht@]}\fi
8025 \gif:name{#1}\csname a:Picture*\endcsname
8026 \strt:gf!\img:alt
8027 \ifmmode \expandafter\vcenter\else \expandafter\vtop\fi
8028 \bgroup \let\EndPicture|=\:EndGIf \NoHtmlEnv }}
8029 \def\:EndGIf{%
8030 \egroup \nd:gf!{\c:IMG \Pic:Img}\csname b:Picture*\endcsname
8031 \After:Picture}
8032 >>>
8033
8034 \<html config util\><<<
8035 \NewConfigure{Picture*}{2}
8036 >>>
8037
8038
8039 \<html gif\><<<
8040 \def\After:Picture{\After:EndPicture
8041 \global\let\After:EndPicture|=\empty}
8042 \let\After:EndPicture|=\empty
8043 \def\AfterPicture#1{\append:def\After:EndPicture{#1}%
8044 \global\let\After:EndPicture|=\After:EndPicture}
8045 >>>
8046
8047
8048 \''<PRE>'s force line breaks also in visual browsers, and we don't
8049 want these breaks within formulas.
8050
8051 The \`'\let\:Gif|=\:gobble' is no good in the foolowing because it
8052 does not take care of the presence of \`'\EndPicture'. It is also not
8053 needed because \''\:Gif' has \''\cond:pic' to take care of it.
8054
8055
8056 \<html gif\><<<
8057 \def\iprt:special{%
8058 \def\ht:special##1{\tex:special{t4ht+##1}}}
8059 \let\tex:special|=\ht:special
8060 >>>
8061
8062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8063 \SubSection{With Given Text and Inline Text}
8064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8065
8066
8067
8068
8069 \`'\Picture*{}.....\EndPicture' will go to \''\:GIf'.
8070 \`'\Picture+{}.....\EndPicture' will go to \''\:Gif'.
8071 \`'\Picture*[..]{}.....\EndPicture' will go to \''\:GifText' with \`'\:next=\:GIf'.
8072 \`'\Picture+[..]{}.....\EndPicture' will go to \''\:GifText' with \`'\:next=\:Gif'.
8073
8074 Given text: \`'[non empty]'. Inline text: \`'[]'.
8075
8076
8077
8078 The following macro is for imported pictures \`'\Picture*+{....}' and
8079 \`'\Picture*+[...]{...}'.
8080
8081
8082 \<html gif\><<<
8083 \def\x:GifText[#1]#2{\cond:pic{%
8084 \ifx \:next\:GIf
8085 \def\gif:box{\vtop\bgroup \NoHtmlEnv \let\gif:box|=\egroup}%
8086 \else \let\gif:box|=\empty \fi
8087 \gif:name{#2}%
8088 \img:alt \def\:temp{#1}%
8089 \ifx \:temp\empty \else
8090 \csname a:PictureAlt*+[]\endcsname
8091 {#1}\csname b:PictureAlt*+[]\endcsname\fi
8092 \ht:special{t4ht>\jobname.tmp}% |%dump|%
8093 \strt:gf-\empty \gif:box
8094 \def\EndPicture{%
8095 \gif:box \nd:gf-\relax \ht:special{t4ht<\jobname.tmp}%
8096 \csname a:PictureAttr*+[]\endcsname{\c:IMG\Pic:Img}\e:IMG
8097 \After:Picture}%
8098 }}
8099 \let\:GifText|=\x:GifText
8100 \def\no:GifText[#1]{\:gobble}
8101 >>>
8102
8103
8104
8105 \<shared config\><<<
8106 \NewConfigure{PictureAlt*+[]}{2}
8107 \NewConfigure{PictureAttr*+[]}[1]{%
8108 \expandafter\def\csname a:PictureAttr*+[]\endcsname##1{#1}%
8109 }
8110 \Configure{PictureAlt*+[]} {\NoFonts} {\EndNoFonts}
8111 \Configure{PictureAttr*+[]} {\ht:special{t4ht=#1}}
8112 >>>
8113
8114
8115
8116 \<html gif\><<<
8117 \ifx \:DraCatCodes\:UnDef
8118 |<set basic Pic:Img|>
8119 \fi
8120 >>>
8121
8122 \<set basic Pic:Img\><<<
8123 \def\Pic:Img{\at:IMG}
8124 >>>
8125
8126
8127
8128 The \`'\everypar{t4ht="#1"}' can't be
8129 \List{disc}
8130 \item \`'{\everypar{}\HCode{#1}} --- the \''\leavevmode' can be
8131 ruinful (e.g., in \`'$$ \underbrace{1,...,1}
8132 s_{aaaaaaa}\underbrace{1,...,1}
8133 $$')
8134
8135 \item \`'{\IgnorePar\HCode{#1}} --- Besides of the above, it
8136 also ruins the paragraph break-up info (e.g., with \''\L' having a definition \`'\def\L{\Picture+[]...\EndPicture').
8137 \EndList
8138
8139
8140
8141 CHECK ISSUE OF ATTRIBUTES FOR IMAGES
8142
8143 \<picture off\><<<
8144 \let\:GifText|=\no:GifText
8145 >>>
8146
8147 \<picture on\><<<
8148 \let\:GifText|=\x:GifText
8149 >>>
8150
8151
8152 \SubSection{File Name}
8153
8154 We have a command of the form \''\gif:name{file-name attributes}'
8155
8156
8157
8158 \<html gif\><<<
8159 \def\gif:name#1{\edef\at:IMG{\noexpand\get:gfnm#1 |<par del|>}\at:IMG}
8160 >>>
8161
8162 The material within the if is for eliminating the extra space
8163 introduced before \`'|<par del|>'.
8164
8165 \<html gif\><<<
8166 \def\get:gfnm#1 #2|<par del|>{\def\at:IMG{#2}%
8167 \ifx \at:IMG\empty\else
8168 \expandafter\aT:IMG\at:IMG|<par del|>%
8169 \fi
8170 \gif:nm{#1}}
8171 \def\aT:IMG#1 |<par del|>{\def\at:IMG{#1}}
8172 >>>
8173
8174 It used to be as follows, which caused extra space at end of arguments.
8175
8176 \Verbatim
8177 \def\gif:name#1{\edef\at:IMG{\noexpand\get:gfnm#1 |<par del|>}\at:IMG}
8178 \def\get:gfnm#1 #2|<par del|>{\def\at:IMG{#2}\gif:nm{#1}}
8179
8180 \EndVerbatim
8181
8182
8183
8184
8185 \<html gif\><<<
8186 \def\NextPictureFile{\def\Next:PictureFile}
8187 \NextPictureFile{}
8188 \def\gif:nm#1{%
8189 \gHAdvance\P:ctureCount |by 1
8190 \xdef\PictureFile{#1}\ifx \PictureFile\empty
8191 \xdef\PictureFile{\Next:PictureFile}\fi
8192 \global\let\Next:PictureFile|=\empty
8193 \ifx \PictureFile\empty
8194 \bgroup \Advance:\P:ctureCount |by -\Pic:Cnt
8195 \xdef\PictureFile{\j:bname|<tail for file name|>\P:ctureCount
8196 x\Pic:Dm\PictExt}%
8197 \egroup
8198 \else
8199 \expandafter\get:ext\PictureFile.|<par del|>%
8200 \ifx\:temp\empty \xdef\PictureFile{\PictureFile\PictExt}\fi
8201 \fi
8202 \immediate\write-1{l. \the\inputlineno\space Writing
8203 \jobname.idv[\P:ctureCount] (\PictureFile)}%
8204 }%
8205 >>>
8206
8207 \<html gif\><<<
8208 \def\SavePicture#1{\def\:tempa{#1}\SaveP:cture}
8209 \Odef\SaveP:cture[#1]{%
8210 \edef\:tempb{\noexpand\Odef\expandafter\noexpand\:tempa[####1]{{%
8211 \let\noexpand\Log:Needs|=\noexpand\:gobble
8212 \noexpand\Picture[\HCode{#1}]{\PictureFile\space####1}}}}%
8213 \:tempb \expand:after{\global\expandafter\let\:tempa|=}\:tempa }
8214 >>>
8215
8216 Without the \''\HCode{#1}' above things like \''--&gt;' expand. Why
8217 the \''\HCode' is not a problem?
8218
8219
8220 \<html gif\><<<
8221 \def\NewPictureDomain#1{%
8222 \global\let\Pic:Cnt|=\P:ctureCount
8223 \def\Pic:Dm{#1} \ifx \Pic:Dm\empty
8224 \xdef\Pic:Dm{\P:c:Dm}%
8225 \gHAdvance\P:c:Dm |by 1
8226 \fi }
8227 \HAssign\P:c:Dm |= 0
8228 \let\Pic:Dm|=\empty
8229 \HAssign\Pic:Cnt|=1
8230 >>>
8231
8232
8233 \SubSection{Counter}
8234
8235 \<html gif\><<<
8236 \HAssign\P:ctureCount|=0
8237 \let\:AltPicture:|=\empty |%100 = default size|%
8238 >>>
8239
8240 \SubSection{Non-Html}
8241
8242
8243
8244 Don't do \''\let\EndPicture=\relax'. Within \''\PictureOff' it is treated as
8245 undefined.
8246
8247
8248
8249 \Section{Utilities for Gif}
8250
8251
8252 In \`'\pic:cond\a\b' the \`'\b' refers to the command to be used when
8253 already within a gif-picture. The \`'\a' is to be used if a
8254 gif-picture is to be opened.
8255
8256
8257 \<html gif\><<<
8258 \def\pic:gobble{\ifx \EndPicture\:UnDef \else \expandafter\:gobble\fi}
8259 \def\pic:gobbleII{\ifx \EndPicture\:UnDef \else \expandafter\:gobbleII\fi}
8260 \def\nopic:gobble#1{\ifx \EndPicture\:UnDef \else #1\fi}
8261 \def\pic:cond#1#2{%
8262 \ifx\EndPicture\:UnDef \def\end:condpic{\EndPicture}\expandafter#1%
8263 \else \let\end:condpic|=\empty \expandafter#2%
8264 \fi }
8265 \def\cond:pic#1{%
8266 \ifx \EndPicture\:UnDef #1\else
8267 \let\E:pic|=\EndPicture \PushMacro\E:pic
8268 \def\EndPicture{\PopMacro\E:pic \let\EndPicture|=\E:pic}\fi}
8269 >>>
8270
8271
8272
8273 \SubSection{Disabled Math}
8274
8275 Global on and off for some reason fails sometimes.
8276
8277
8278 \<html gif\><<<
8279 \def\PictureOff{%
8280 \expandafter\let\csname Pic:\Pic:On\endcsname|=\EndPicture
8281 \ifx \EndPicture\:UnDef \let\EndPicture|=\empty \fi
8282 |<picture off|>%
8283 \Advance:\Pic:On |by 1 }
8284 \def\PictureOn{%
8285 \ifnum \Pic:On>0
8286 \Advance:\Pic:On |by -1
8287 \ifnum \Pic:On=0 |<picture on|>%
8288 \fi
8289 \expand:after{\let\EndPicture|=}\csname Pic:\Pic:On\endcsname
8290 \ifx \EndPicture\relax \let\EndPicture|=\:UnDef\fi
8291 \else
8292 \:warning{\string\PictureOn\space without \string\PictureOff}%
8293 \fi }
8294 \HAssign\Pic:On |= 0
8295 >>>
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311 Don't go directly for \`'\PushMacro\EndPicture', just in case the
8312 user wants to use this stack.
8313
8314 Smash is most often used to produce comples patterns, so
8315 let su go and make them pictures.
8316
8317 \<html gif\><<<
8318 \def\:temp#1{\ifx \EndPicture\:Undef
8319 \relax\ifmmode\hbox{$#1$}\else \hbox{#1}\fi
8320 \else \o:smash:{#1}\fi}
8321 \HLet\smash|=\:temp
8322 >>>
8323
8324
8325
8326 The definition \''\def\HCode#1{\leavevmode\special{t4ht=#1}}' can be
8327 problematic for grouping in pictures because of the \''\leavevmode'
8328 that in immediate environment produces some side code.
8329
8330
8331 It looks like the following problems, or most
8332 of them, have been resolved with a fix to \''\noalign'.
8333
8334
8335 The \`'\openup10pt' causes too much space in
8336 %
8337 \ifHtml[\HPage{some pictures}\Verbatim
8338 \openup10pt \halign{
8339 $2^{#}$\quad&\(
8340 \overbrace{2\cdots 2}^{#\
8341 \rm times}\)\quad& #\ cr
8342 3&3&8\ cr }
8343 \EndVerbatim\EndHPage{}]\fi
8344 %
8345 and too much memory in
8346 %
8347 \ifHtml[\HPage{others}\Verbatim
8348 % \input tex4ht.sty \Preamble{html}
8349 % \EndPreamble
8350 %
8351 %\catcode`\@=11
8352 %
8353 %\def\eqalign#1{\null\,\vcenter{\openup\jot\m@th
8354 % \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
8355 % \ crcr#1\ crcr}}\,}
8356 %
8357 %\def\eqalignno#1{\displ@y \tabskip\centering
8358 % \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
8359 % &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
8360 % &\llap{$\@lign##$}\tabskip\z@skip\ crcr #1\ crcr}}
8361 %
8362 %\def\displ@y{\global\dt@ptrue\openup\jot\m@th
8363 % \everycr{%
8364 % \noalign{\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-1000\p@
8365 % \vskip-\lineskiplimit \vskip\normallineskiplimit \fi
8366 % \else \penalty\interdisplaylinepenalty \fi}}}
8367 %
8368 %
8369 %\def\displ@y{\global\dt@ptrue
8370 % \everycr{\noalign{\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-1000\p@
8371 % \vskip-\lineskiplimit \vskip\normallineskiplimit \fi
8372 % \else \penalty\interdisplaylinepenalty \fi}}}
8373 %
8374 %\def\openup{\afterassignment\@penup\dimen@=}
8375 %\def\@penup{\advance\lineskip\dimen@
8376 % \advance\baselineskip\dimen@
8377 % \advance\lineskiplimit\dimen@}
8378 %
8379 %\openup10pt \halign{
8380 % $2^{#}$\quad&\(
8381 % \overbrace{2\cdots 2}^{#\
8382 % \rm times}\)\quad& #\ cr
8383 % 3&3&8\ cr }
8384 %
8385 %\eqalignno{
8386 %li&= 1\ cr
8387 %&> line 2& (7)}
8388 %
8389 %\bye
8390 \EndVerbatim\EndHPage{}]\fi
8391 %
8392 Putting a \''\offinterlineskip' solves sometimes the problem
8393 in some pictures of getting too much vertical
8394 spcace, but may create
8395 \ifHtml[\HPage{improper pictures}\Verbatim
8396 % \input tex4ht.sty \Preamble{html}
8397 % \EndPreamble
8398 %
8399 %\catcode`\@=11
8400 %
8401 %\def\eqalignno#1{\displ@y \tabskip\centering
8402 % \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
8403 % &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
8404 % &\llap{$\@lign##$}\tabskip\z@skip\ crcr #1\ crcr}}
8405 %
8406 %\eqalignno{
8407 %li&= 1\ cr
8408 %&> line 2& (7)}
8409 %\bye
8410 \EndVerbatim\EndHPage{}]\fi{} with depth and hiehgt 0 (put
8411 in TeX4ht1.sty the picture in box0 and measure). The problem
8412 is because \''\def\offinterlineskip{\baselineskip-1000\p@
8413 \lineskip\z@ \lineskiplimit\maxdimen}' puts too much space
8414 in \''\lineskiplimit'.
8415
8416
8417
8418 \Chapter{Math}
8419
8420
8421 \<math config util\><<<
8422 \:CheckOption{base}
8423 \if:Option \else
8424 |<config math end-points|>
8425 |<sub and sup|>
8426 |<math classes|>
8427 |<grouped math classes|>
8428 |<built-in tex math ops|>
8429 \fi
8430 >>>
8431
8432
8433 \Section{End Points of Math Environments}
8434
8435
8436 The following become active only when they are being configured.
8437
8438
8439
8440 \<config math end-points\><<<
8441 \NewConfigure{$}[3]{%
8442 \def\a:mth{\bgroup#1}\def\b:mth{#2\egroup}%
8443 \def\c:mth{|<empty script base trap|>#3}%
8444 \everymath{\ifx \EndPicture\:UnDef
8445 $\a:mth\everymath{}\everydisplay{}$%
8446 \aftergroup\b:mth \c:mth \fi}}
8447 >>>
8448
8449
8450
8451
8452 \<config math end-points\><<<
8453 \NewConfigure{$$}[3]{%
8454 \def\a:display{\bgroup#1}%
8455 \def\b:display{#2\egroup}%
8456 \def\c:display{#3}%
8457 \everydisplay{\ifx \EndPicture\:UnDef
8458 $$\a:display\everymath{}\everydisplay{}$$%
8459 \aftergroup\b:display \c:display\fi}}
8460
8461 >>>
8462
8463
8464 Can't put \Verb'|<empty script base trap|>' into \Verb+\def\c:display{#3}%+
8465 because of cases such as \Verb+$$\halign{#\cr a\cr}$$+
8466
8467
8468 \<empty script base trap\><<<
8469 {\csname HCode\endcsname{}}%
8470 >>>
8471
8472 Tex4ht translate each \`'$$...$$' into \`'$$
8473 $$$$...$$' and upon
8474 reaching the second environment the mode is already horizontal. For
8475 such case, the above approach of distinguishing in-line and off-line
8476 display math don't work. This is a place where an implimentation
8477 within the tex engine can do a better work. On the other hand, all of
8478 this can be fixed within and XSL-like transformations on the final
8479 output of tex4ht.
8480
8481
8482 \''\halign' doesn't allow expansion into content to precede
8483 it within the math mode. Hence, the \''\aftergroup' below.
8484
8485
8486
8487
8488
8489
8490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8491 \Section{Math into Pictures}
8492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8493
8494
8495 \<config math end-points\><<<
8496 \def\PicDisplay{\pic:gobble\env:PD
8497 \def\:temp{$$}\pic:cond\Pic:math\:temp}
8498 \def\EndPicDisplay{\end:condpic\pic:gobble\endenv:PD}
8499 \def\Pic:math{\hfil\break
8500 \expand:after{\Picture*}\alt:Mth{ \c:Math}}
8501 >>>
8502
8503
8504 \<config math end-points\><<<
8505 \def\PicMath{\leavevmode\pic:gobble\env:PM\hbox\bgroup
8506 \everymath{}\everydisplay{}\pic:cond\pic:math$}
8507 \def\EndPicMath{\end:condpic\egroup\pic:gobble\endenv:PM}
8508 \def\pic:math{\expand:after{\Picture+}\alt:mth{ \c:math}}
8509 >>>
8510
8511
8512
8513
8514 \<config math end-points\><<<
8515 \NewConfigure{PicDisplay}[4]{\def\alt:Mth{#3}%
8516 \ifx \alt:Mth\empty\else \def\alt:Mth{[#3]}\fi\def\c:Math{#4}%
8517 \c:def\env:PD{#1}\c:def\endenv:PD{#2}}
8518 \NewConfigure{PicMath}[4]{\def\alt:mth{#3}%
8519 \ifx \alt:mth\empty\else \def\alt:mth{[#3]}\fi\def\c:math{#4}%
8520 \c:def\env:PM{#1}\c:def\endenv:PM{#2}}
8521 >>>
8522
8523 \`'\Configure{PicDisplay}{}{}{[ALT]}{extra-attributes}'
8524 \`'\Configure{PicMath}{}{}{[ALT]}{extra-attributes}'
8525
8526
8527 \Section{Non-Pictorial Math}
8528
8529
8530 \SubSection{Dvi Math}
8531
8532
8533 \<config math end-points\><<<
8534 \def\DviMath{\a:DviMath\leavevmode \MathClass |<same page|> \DviSend}
8535 \def\EndDviMath{\EndDviSend |<end same page|>\EndMathClass \b:DviMath}
8536 \NewConfigure{DviMath}{2}
8537 >>>
8538
8539
8540
8541 The above need to be boxed to prevent page breaks within the send
8542 environment \`'\special{t4ht~}...\special{t4ht~}'..
8543
8544 \<same page\><<<
8545 \ht:special{t4ht@(}\vbox
8546 \bgroup{\expandafter\ifx\csname ht:everypar\endcsname\relax
8547 \expandafter\everypar
8548 \else \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}%
8549 \relpenalty=10000
8550 \binoppenalty=10000
8551 >>>
8552
8553 \<end same page\><<<
8554 \ht:special{t4ht@(}\egroup\ht:special{t4ht@)}%
8555 >>>
8556
8557 The penalty is to prohibit line breaks. For instance, the following
8558 formula under the mathml mode.
8559
8560 \Verbatim
8561 \documentclass{scrartcl}
8562 \begin{document}
8563 $a^{n_{1}+n_{2}+n_{3}}
8564 (1-p_{1})^{n_{4} +n_{6} +n_{7} +(N-n_{1}-...b- n_{7})}
8565 p_{2}^{n_{1} +n_{2} +n_{4} +n_{6}}
8566 (1-p_{2})^{n_{3} +n_{5} +n_{7} +(N-n_{1}-...b- n_{7})}
8567 p_{3}^{n_{1} +n_{3}+n_{4} +n_{7}}
8568 (1-p_{3})^{n_{2} +n_{5} +n_{6} +(N-n_{1}-...b- n_{7})}$
8569 \end{document}
8570 \EndVerbatim
8571
8572
8573 The specials remove the space at the start and end points of the box.
8574
8575
8576
8577 Examples:
8578
8579 \Verbatim
8580 \Configure{$} {\Tg<math>\DviMath} {\EndDviMath\Tg</math>} {}
8581 \Configure{$$} {\Tg<display>\DviMath} {\EndDviMath\Tg</display>} {}
8582
8583 \Configure{()} {\Tg<math>\DviMath$} {$\EndDviMath\Tg</math>}
8584 \Configure{[]} {\Tg<display>\DviMath$$} {$$\EndDviMath\Tg</display>}
8585 \EndVerbatim
8586
8587
8588
8589
8590 \SubSection{Positioned Math}
8591
8592
8593
8594 \<config math end-points\><<<
8595 \def\PMath{\bgroup\Canvas \x:SUBOff \x:SUPOff
8596 \let\Picture|=\empty \everymath{}\everydisplay{}}
8597 \def\EndPMath{\EndCanvas\egroup}
8598 \:CheckOption{PMath} \if:Option
8599 \def\:Pmath{$\PMath$\aftergroup\EndPMath}
8600 \def\:Pdisp{$$\PMath$$\aftergroup\EndPMath}
8601 \everymath{\:Pmath}
8602 \everydisplay{\:Pdisp}
8603 \fi
8604 >>>
8605
8606
8607 Example: \`' \def\({\PMath$} \def\){$\EndPMath} \def\[{\PMath$$}
8608 \def\]{$$\EndPMath}'.
8609
8610
8611
8612 \ifHtml[\HPage{positioned math}
8613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8614
8615
8616
8617
8618
8619
8620 \Verbatim
8621 \Css{.Canvas { position:absolute; }}
8622 \Css{.Canvas { font-size:100\%; }}
8623 \Css{.Canvas .cmr-7{ font-size:70\%; }}
8624 \Css{.Canvas .cmmi-7{ font-size:70\%; font-style: italic;}}
8625
8626 $ a \over b + c $
8627 \EndVerbatim
8628
8629
8630 \Tg<hr />
8631
8632
8633 \Verbatim
8634 \input tex4ht.sty \Preamble{html,sty,4.0s,PMath}
8635
8636 \Css
8637 BODY{ font-size : 200% }
8638 .Canvas { position: relative; }
8639 SPAN.cmr-7 .Canvas-char ,
8640 SPAN.cmmi-7 .Canvas-char ,
8641 SPAN.cmsy-7 .Canvas-char { font-size: 70% ; }
8642 SPAN.cmr-5 .Canvas-char ,
8643 SPAN.cmmi-5 .Canvas-char { font-size: 50% ; }
8644 \EndCss
8645
8646
8647 \EndPreamble
8648 aa
8649 $
8650 {{A+C \over B+D}+F \over X*Y}
8651 $
8652
8653 \bye
8654 \EndVerbatim
8655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8656 \EndHPage{}]\fi
8657
8658
8659
8660
8661
8662 \Section{Subscripts and Superscripts}
8663
8664
8665 \<sp and sb for catcode 13\><<<
8666 \ifnum \the\catcode`^=13
8667 \let\expandafter\noexpand
8668 \csname x:SUPOff\endcsname|=\noexpand\empty
8669 \let\expandafter\noexpand
8670 \csname x:SUPOn\endcsname|=\noexpand\empty
8671 \catcode`\noexpand ^|=\the\catcode`^\fi
8672 \ifnum \the\catcode`_=13
8673 \let\expandafter\noexpand
8674 \csname x:SUBOff\endcsname|=\noexpand\empty
8675 \let\expandafter\noexpand
8676 \csname x:SUBOn\endcsname|=\noexpand\empty
8677 \catcode`\noexpand _|=\the\catcode`_\fi
8678 >>>
8679
8680 The \''\x:SUBOff' (and \''\x:SUPOff') are activated only if the catcodes
8681 of \`'^' and \`'_', respectively, were not 13 when tex4ht.sty was
8682 loaded. If the catcode were 13, we need a user intervention, in which
8683 \`'\sp' and \`'\sb' should be referenced for math mode. That is,
8684 something along the lines \`'\ifmmode \expandafter\sp\else
8685 \expandafter current^\fi' will probably work most of the times.
8686
8687 TRY: Replace SUBOn with HSUBOn, SUBOff with HSUBOff, Ditto for SUP
8688
8689 \<sub and sup\><<<
8690 \let\s:b|=\sb
8691 \let\:sbb|=\sb |%DraTeX already uses \:sb|%
8692 \def\sb{\m:op\:sbb{SUB}}
8693 \catcode`\_|=8
8694 \:CheckOption{no_} \if:Option
8695 \let\s:b|=\:UndFi
8696 |<old SUB 0|>
8697 |<new SUB 0|>
8698 \def\no:restore{\let\no:restore|=\:UnDef}
8699 \else
8700 \Log:Note{for non active \string_,
8701 use the command line option `no\string_'}%
8702 |<old SUB 1|>
8703 |<new SUB 1|>
8704 \catcode`\_|=13
8705 |<math sb|>
8706 \def\x:SUBOff{\let_|=\s:b}
8707 \def\pr:sb{\ifx \EndPicture\:UnDef
8708 \expandafter\Protect\expandafter\S:b
8709 \else \expandafter\s:b \fi}
8710 |<old SUB 2|>
8711 |<new SUB 2|>
8712 |<old SUB 3|>
8713 |<new SUB 3|>
8714 \catcode`\_|=8
8715 \:CheckOption{_13} \if:Option
8716 \def\no:restore{\let\no:restore|=\:UnDef
8717 \mathcode`\_|="8000 \catcode`\_|=13 }
8718 \append:def\SUBOn{\mathcode`\_|="8000 \catcode`\_|=13 |<let sb|>}
8719 \else
8720 \Log:Note{for \string_ of catcode 13,
8721 use the command line option `\string_13'}
8722 \def\no:restore{\let\no:restore|=\:UnDef
8723 \mathcode`\_|="8000 \catcode`\_|=12 }
8724 \append:def\SUBOn{\mathcode`\_|="8000 \catcode`\_|=12 |<let sb|>}
8725 \fi
8726 \bgroup
8727 \SUBOn \def\:temp{|<let sb|>}
8728 \expandafter \egroup \:temp
8729 \fi
8730 >>>
8731
8732
8733 \<old SUB 0\><<<
8734 \let\x:SUBOff|=\empty \let\x:SUBOn|=\empty
8735 >>>
8736 \<new SUB 0\><<<
8737 \let\SUBOff|=\empty \let\SUBOn|=\empty
8738 >>>
8739
8740 \<old SUB 1\><<<
8741 \ifx \sys:sb\:UnDef \def\:tempaa{_}
8742 \else \def\:tempaa{\noexpand\sys:sb}\fi
8743 >>>
8744 \<new SUB 1\><<<
8745 \ifx \sys:sb\:UnDef \def\:tempa#1{\append:def\SUBOff{\let#1|=_}}
8746 \else \def\:tempa#1{\append:def\SUBOff{|<HSUBOff op|>}}\fi
8747 >>>
8748
8749 \<HSUBOff op\><<<
8750 \def#1{%
8751 \ifmmode \expandafter\s:b \else \expandafter\sys:sb \fi
8752 }%
8753 >>>
8754
8755 \<old SUB 2\><<<
8756 \edef\:SUBOff{\def\noexpand_{\:tempaa}}
8757 >>>
8758
8759 \<new SUB 2\><<<
8760 \:tempa_
8761 >>>
8762
8763 \<old SUB 3\><<<
8764 \def\x:SUBOn{\def_{\ifmmode \expandafter\pr:sb
8765 \else \expandafter\sys:sb\fi}|<let sb|>}
8766 \x:SUBOn
8767 >>>
8768
8769 \<new SUB 3\><<<
8770 \def\SUBOn{\catcode`\_|=8
8771 \def_{\ifmmode \expandafter\pr:sb
8772 \else \expandafter\sys:sb\fi}}
8773 \SUBOn
8774 >>>
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786 \<record external sub-sup\><<<
8787 \def\SUPOn{}
8788 \def\SUBOn{}
8789 >>>
8790
8791 \<record external sub-sup\><<<
8792 \edef\SUPOff{%
8793 \catcode`\noexpand ^|=\the\catcode`^\relax
8794 }
8795 \edef\SUBOff{%
8796 \catcode`\noexpand _|=\the\catcode`_\relax
8797 }
8798 \bgroup
8799 \catcode`\^|=13 \global\let\sys:sp|=^
8800 \catcode`\_|=13 \global\let\sys:sb|=_
8801 \egroup
8802 >>>
8803
8804
8805 \<sub and sup\><<<
8806 \let\s:p|=\sp
8807 \let\:spp|=\sp
8808 \def\sp{\m:op\:spp{SUP}}
8809 \catcode`\^|=7
8810 |<default sup sup config|>
8811 \:CheckOption{no^} \if:Option
8812 \let\s:p|=\:UndFi
8813 |<old SUP 0|>
8814 |<new SUP 0|>
8815 \else
8816 \Log:Note{for non active \string^,
8817 use the command line option `no\string^'}%
8818 |<old SUP 1|>%
8819 |<new SUP 1|>%
8820 \catcode`\^|=13
8821 |<math sp|>
8822 \def\x:SUPOff{\let^|=\s:p }
8823 \def\pr:sp{\ifx \EndPicture\:UnDef
8824 \expandafter\Protect\expandafter\S:p
8825 \else \expandafter\s:p \fi}
8826 |<old SUP 2|>
8827 |<new SUP 2|>
8828 |<old SUP 3|>
8829 |<new SUP 3|>
8830 |<sup 13|>
8831 \catcode`\^|=7
8832 \:CheckOption{^13} \if:Option
8833 |<sup sup 13 config|>
8834 \append:def\no:restore{\mathcode`\^|="8000 \catcode`\^|=13 }
8835 \append:def\SUPOn{\mathcode`\^|="8000 \catcode`\^|=13 |<let sp|>}
8836 \else
8837 \Log:Note{for \string^ of catcode 13,
8838 use the command line option `\string^13'}%
8839 \append:def\no:restore{\mathcode`\^|="8000 \catcode`\^|=12 }
8840 \append:def\SUPOn{\mathcode`\^|="8000 \catcode`\^|=12 |<let sp|>}
8841 \fi
8842 \bgroup
8843 \SUPOn \def\:temp{|<let sp|>}
8844 \expandafter \egroup \:temp
8845 \fi
8846 >>>
8847
8848
8849 \<default sup sup config\><<<
8850 \NewConfigure{\string^\string^}[2]{%
8851 \def\:tempa##1>{}\def\:temp{#1}\:warning{\string
8852 \Configure{\string\string\string ^\string\string
8853 \string^}{\expandafter\:tempa\meaning \:temp}{...}
8854 ignored; option \string^13 is not on}}
8855 >>>
8856
8857
8858
8859 \<sup 13\><<<
8860 \def\:sUp{%
8861 \let\:sUp|=^%
8862 \def^{\futurelet\:temp\next:hat}
8863 \def\next:hat{\ifx ^\:temp \expandafter\:dblhat\else
8864 \expandafter\:sUp\fi}%
8865 }
8866 >>>
8867
8868 \<sup sup 13 config\><<<
8869 \:sUp
8870 \def\:dblhat#1#2{\def\:temp{#2}%
8871 \def\:tempc{\def\:tempa####1>{}\:warning{\string^\string
8872 ^\expandafter\:tempa\meaning\:temp? \string\Configure{\string
8873 \string\string ^\string\string\string^}{\expandafter\:tempa
8874 \meaning \:temp}{...} or use option no\string^}}%
8875 \ext:chr \:tempc}
8876 \let\ext:chr|=\empty
8877 \NewConfigure{\string^\string^}[2]{%
8878 \NewConfigure{\string^\string^}{2}%
8879 \append:def\ext:chr{\def\:tempa{#1}\ifx \:temp\:tempa
8880 \def\:tempc{#2}\fi}}
8881 >>>
8882
8883
8884
8885 \<old SUP 0\><<<
8886 \let\x:SUPOff|=\empty \let\x:SUPOn|=\empty
8887 >>>
8888 \<new SUP 0\><<<
8889 \let\SUPOff|=\empty \let\SUPOn|=\empty
8890 >>>
8891 \<old SUP 1\><<<
8892 \ifx \sys:sp\:UnDef \def\:tempbb{^}
8893 \else \def\:tempbb{\noexpand\sys:sp}\fi
8894 >>>
8895 \<new SUP 1\><<<
8896 \ifx \sys:sp\:UnDef \def\:tempb#1{\append:def\SUPOff{\let#1|=^}}
8897 \else \def\:tempb#1{\append:def\SUPOff{|<HSUPOff op|>}}\fi
8898 >>>
8899
8900
8901
8902
8903
8904 \<HSUPOff op\><<<
8905 \def#1{%
8906 \ifmmode \expandafter\s:p \else \expandafter\sys:sp \fi
8907 }%
8908 >>>
8909
8910
8911 \<old SUP 2\><<<
8912 \edef\:SUPOff{\def\noexpand^{\:tempbb}}
8913 >>>
8914 \<new SUP 2\><<<
8915 \:tempb^
8916 >>>
8917
8918 \<old SUP 3\><<<
8919 \def\x:SUPOn{\def^{\ifmmode \expandafter\pr:sp
8920 \else \expandafter\sys:sp\fi}|<let sp|>}
8921 \x:SUPOn
8922 >>>
8923
8924 \<new SUP 3\><<<
8925 \def\SUPOn{%
8926 \def^{\ifmmode \expandafter\pr:sp
8927 \else \expandafter\sys:sp\fi}}
8928 \SUPOn
8929 >>>
8930
8931
8932
8933 \<let sp\><<<
8934 \let\sp=^%
8935 >>>
8936
8937 \<let sb\><<<
8938 \let\sb=_%
8939 >>>
8940
8941
8942
8943 \<math sp\><<<
8944 \if:Option
8945 \def\S:p{\m:op\s:p{SUP}}
8946 \else
8947 \def\S:p#1{\def\SuP:{#1}\futurelet\:temp\sup:sub}
8948 \:CheckOption{^13} \if:Option \catcode`\_|=13
8949 \else \catcode`\_|=12\fi
8950 \def\blank:space{
8951 }
8952 \def\sup:sub{\expandafter
8953 \ifx \blank:space\:temp \expandafter\sup:subA
8954 \else \expandafter\sup:subB\fi}
8955 \expandafter\def
8956 \expandafter\sup:subA\blank:space{\futurelet\:temp\sup:sub}
8957 \def\sup:subB{\ifx _\:temp \expandafter\SUP:SUB
8958 \else \expandafter\a:putSUP \fi }
8959 \catcode`\_|=8
8960 \def\a:putSUP{\sup:I \SuP:}
8961 \def\sup:I{\m:op\s:p{SUP}}
8962 \fi
8963 >>>
8964
8965
8966 \<math sb\><<<
8967 \if:Option
8968 \def\S:b{\m:op\s:b{SUB}}
8969 \else
8970 \def\S:b#1{\def\SuB:{#1}\futurelet\:temp\sub:sup}
8971 \def\blank:space{
8972 }
8973 \def\sub:sup{\expandafter
8974 \ifx \blank:space\:temp \expandafter\sub:supA
8975 \else \expandafter\after:sub\fi}
8976 \expandafter\def
8977 \expandafter\sub:supA\blank:space{\futurelet\:temp\sub:sup}
8978 |<extension of sub|>
8979 \def\a:putSUB{\sub:I \SuB:}
8980 \def\sub:I{\m:op\s:b{SUB}}
8981 \fi
8982 >>>
8983
8984
8985 % \def\sub:supB{\ifx ^\:temp \expandafter\SUB:SUP
8986 % \else \expandafter\after:sub\fi}
8987
8988
8989 \<utilities\><<<
8990 \NewConfigure{afterSUB}[2]{\expandafter
8991 \def \csname \meaning#1sb\endcsname{#2}}
8992 \NewConfigure{putSUB}[1]{\def\a:putSUB{#1}}
8993 \NewConfigure{putSUP}[1]{\def\a:putSUP{#1}}
8994 \:CheckOption{no^} \if:Option \else
8995 \:CheckOption{^13} \if:Option \catcode`\^|=13
8996 \else \catcode`\^|=12 \fi
8997 \Configure{afterSUB}^{\SUB:SUP}
8998 \catcode`\^|=7
8999 \fi
9000 >>>
9001
9002 The following is needed for a math prime after sub. For instance, \'+a_1'$+.
9003
9004 \<extension of sub\><<<
9005 \def\after:sub{\futurelet\:temp\choose:sub}
9006 \def\choose:sub{\expandafter
9007 \ifx \csname \meaning\:temp sb\endcsname\relax
9008 \expandafter \a:putSUB
9009 \else
9010 \expandafter\expandafter\csname \meaning\:temp sb\endcsname
9011 \fi
9012 }
9013 >>>
9014
9015
9016 We need to catch cases like the blank space appearing after the b
9017 within AmsTeX in an equation like:
9018 \Verbatim
9019 \begin{equation}
9020 a^b
9021 _c
9022 \end{equation}
9023 \EndVerbatim
9024 We can't use a declaration of the form
9025 \''\def\sub:supA#1{...'
9026 because the macro consumes the parameter following the space,
9027 and that parameter can a forbidden token.
9028
9029
9030
9031 The \`'\edef\:SUBSUPOff' doesnt wotk with \''\let' instead
9032 of \''\def' in the body. Why?
9033
9034
9035 \<sub and sup\><<<
9036 \def\m:op{\ifx \EndPicture\:UnDef \expandafter\:mop
9037 \else \expandafter\:m:p\fi}
9038 \def\:mop{\relax\ifmmode \expandafter \mo:p \else \expandafter\mop:\fi}
9039 \def\mo:p#1#2#3{{\csname a:#2\endcsname
9040 #1{#3}\csname b:#2\endcsname}}
9041 \def\mop:#1#2#3{#1}
9042 \def\:m:p#1#2{#1}
9043 >>>
9044
9045 \<sub and sup\><<<
9046 \NewConfigure{SUB}{2}
9047 \NewConfigure{SUP}{2}
9048 >>>
9049
9050 We need to pause the hyperext font for the case that the
9051 subscript itself comes with a font change. Without the
9052 pause we'll get a partial overlap with the \''<SUB/SUP>'
9053 font (e.g., \`'\it $\A_{\mathbf{R}}$').
9054
9055
9056 In case that \`'^' looses its original meaning, TeX will complain
9057 about double exponnet if it follows a quote symbol.\ifHtml[\HPage{'}\Verbatim
9058 \input tex4ht.sty \Preamble{html} \EndPreamble
9059
9060 $\overline{a'^b}$
9061
9062 \csname bye\endcsname
9063
9064 \EndVerbatim\EndHPage{}]\fi.
9065
9066 \SubSection{Merging Subscripts and Superscripts}
9067
9068 Two options \`'\Configure{SUBSUP}{ before }{ between }{ after }'
9069 and
9070 \`'\Configure{SUPSUB}{ before }{ between }{ after }', differing in the
9071 way the reorder the superscript and subscript. However, if the
9072 three parameters are empty, or just a single subscript / superscript
9073 is present, then \`'\Configure{SUB}{ before }{ after }'
9074 and \`'\Configure{SUP}{ before }{ after }' get into effect.
9075
9076 \<sub and sup\><<<
9077 \:CheckOption{no^} \if:Option \else \:CheckOption{no_}\fi
9078 \if:Option
9079 \NewConfigure{SUBSUP}[3]{}
9080 \NewConfigure{SUPSUB}[3]{}
9081 \NewConfigure{SUB/SUP}[6]{}
9082 \else
9083 \def\SUP:SUB#1#2{\let\chs:sbsp|=\:gobble\def\SuB:{#2}\SUBSUP:}
9084 \def\SUB:SUP#1#2{\def\chs:sbsp##1##2{##1}\def\SuP:{#2}\SUBSUP:}
9085 \let\SUBSUP:|=\empty
9086 \NewConfigure{SUBSUP}[3]{%
9087 \def\:temp{#1#2#3}\ifx \:temp\empty
9088 \def\SUBSUP:{\sub:I\SuB:\sup:I\SuP:}%
9089 \else \def\SUBSUP:{#1\s:b{\SuB:}#2\s:p{\SuP:}#3}\fi}
9090 \NewConfigure{SUPSUB}[3]{%
9091 \def\:temp{#1#2#3}\ifx \:temp\empty
9092 \def\SUBSUP:{\sup:I\SuP:\sub:I\SuB:}%
9093 \else \def\SUBSUP:{#1\s:p{\SuP:}#2\s:b{\SuB:}#3}\fi}
9094 \NewConfigure{SUB/SUP}[6]{%
9095 \def\:temp{#1#2#3#4#5#6}\ifx \:temp\empty
9096 \def\SUBSUP:{\sub:I\SuB:\sup:I\SuP:}%
9097 \else \def\SUBSUP:{\chs:sbsp
9098 {#1\s:b{\SuB:}#2\s:p{\SuP:}#3}%
9099 {#4\s:p{\SuP:}#5\s:b{\SuB:}#6}}\fi}
9100 \fi
9101 >>>
9102
9103
9104
9105 \SubSection{Early Activation of Sub/Sup Scripts}
9106
9107
9108 \<early latex subs/sups\><<<
9109 \ifx \config:opt\:UnDef \else
9110 |<defs for early latex subs/sups|>
9111 \fi
9112 >>>
9113
9114 \<defs for early latex subs/sups\><<<
9115 \append:def\:RestoreCatcodes{\early:sub\early:sup}
9116 \let\:IfFileExists\IfFileExists
9117
9118 % I am not sure why we used this declaration. It is from the original
9119 % TeX4ht sources, so it probably had some reason. The problem is that it
9120 % inserts extra tokens after \:IfFileExists, and if some package uses
9121 % something like \IfFileExists{foo.sty}{\@firstoftwo}{\@secondoftwo}{aa}{bb},
9122 % then it fails. I've found this issue with the Standalone class.
9123 % See https://tex.stackexchange.com/a/638965/2891 for example where it fails.
9124 % \long\def\IfFileExists#1#2#3{%
9125 % \csname recall:sub\endcsname
9126 % \csname recall:sup\endcsname
9127 % \expandafter\let\csname #1:sub\endcsname=\early:sub
9128 % \expandafter\let\csname #1:sup\endcsname=\early:sup
9129 % \let\early:sub=\relax \let\recall:sub\relax
9130 % \let\early:sup=\relax \let\recall:sup\relax
9131 % \:IfFileExists{#1}{#2}{#3}%
9132 % \expandafter\let\expandafter\early:sub\csname #1:sub\endcsname
9133 % \expandafter\let\expandafter\early:sup\csname #1:sup\endcsname
9134 % \early:sub \early:sup
9135 % }
9136 \ifx \o:document\:UnDef
9137 \pend:def\Preamble{%
9138 \csname recall:sub\endcsname
9139 \csname recall:sup\endcsname}
9140 \fi
9141 >>>
9142
9143 \</document recall sub/sup\><<<
9144 \csname recall:sub\endcsname
9145 \csname recall:sup\endcsname
9146 >>>
9147
9148 \<defs for early latex subs/sups\><<<
9149 \def\:CheckOption#1{\def\:temp{#1}%
9150 \:Optionfalse
9151 \expandafter\:ScanOptions\config:opt,,//}
9152 \def\:ScanOptions#1,#2//{\def\:next{#1}%
9153 \ifx \:next\empty
9154 \else \ifx \:temp\:next \:Optiontrue \let\:next\relax
9155 \else \def\:next{\:ScanOptions#2//}%
9156 \fi \fi \:next }
9157 |<cats early latex subs/sups|>
9158 \let\:CheckOption|=\:UnDef
9159 >>>
9160
9161
9162
9163 \<cats early latex subs/sups\><<<
9164 \let\early:sub=\empty
9165 \:CheckOption{early_} \if:Option
9166 \:CheckOption{no_} \if:Option \else
9167 \:CheckOption{_13} \if:Option
9168 \def\early:sub{%
9169 \xdef\recall:sub{%
9170 \mathcode`\noexpand\_=\the\mathcode`\_
9171 \catcode`\noexpand\_=\the\catcode`\_
9172 }
9173 \mathcode`\_="8000 \catcode`\_=13
9174 }
9175 \else
9176 \def\early:sub{%
9177 \xdef\recall:sub{%
9178 \mathcode`\noexpand\_=\the\mathcode`\_
9179 \catcode`\noexpand\_=\the\catcode`\_
9180 % \writesixteen{.....sub \the\catcode`\_}%
9181 }%
9182 \mathcode`\_="8000 \catcode`\_=12
9183 % \writesixteen{.....sub 12}
9184 }
9185 \fi
9186 \fi
9187 \else
9188 \Log:Note{for \string_ at preamble,
9189 use the command line option `early\string_'}%
9190 \fi
9191 >>>
9192
9193 \<cats early latex subs/sups\><<<
9194 \let\early:sup=\empty
9195 \:CheckOption{early^} \if:Option
9196 \:CheckOption{no^} \if:Option \else
9197 \:CheckOption{^13} \if:Option
9198 \def\early:sup{%
9199 \xdef\recall:sup{%
9200 \mathcode`\noexpand\^=\the\mathcode`\^
9201 \catcode`\noexpand\^=\the\catcode`\^
9202 }
9203 \mathcode`\^="8000 \catcode`\^=13
9204 }
9205 \else
9206 \def\early:sup{%
9207 \xdef\recall:sup{%
9208 \mathcode`\noexpand\^=\the\mathcode`\^
9209 \catcode`\noexpand\^=\the\catcode`\^
9210 % \writesixteen{.....sup \the\catcode`\^}%
9211 }%
9212 \mathcode`\^="8000 \catcode`\^=12
9213 % \writesixteen{.....sup 12}%
9214 }
9215 \fi
9216 \fi
9217 \else
9218 \Log:Note{for \string^ at preamble,
9219 use the command line option `early\string^'}%
9220 \fi
9221 >>>
9222
9223
9224 \Section{Math Classes}
9225
9226
9227
9228
9229
9230 The requests are placed on symbols of the fonts, which might be a
9231 problem for symbols not used in math.
9232
9233 \<math classes\><<<
9234 \def\MathClass{\ht:special{t4ht\string^}}
9235 \let\EndMathClass|=\MathClass
9236 \def\PauseMathClass{\ht:special{t4ht\string^-}}
9237 \def\EndPauseMathClass{\ht:special{t4ht\string^+}}
9238 >>>
9239
9240
9241
9242
9243 Math classes: Ordinary (0), large operators (1), binary operators (2),
9244 relation (3), opening del (4), closing delimiter (5),
9245 punctuation (7).
9246
9247
9248
9249 \SubSection{Configure Characters}
9250
9251
9252 Set the class delimiters for the symbols.
9253
9254 \<math classes\><<<
9255 \catcode`\^=7
9256 \NewConfigure{MathClass}[5]{\NoFonts \ht:special{t4ht@[}%
9257 \def\:temp{#2}\ifx \:temp\empty \else
9258 \ht:special{t4ht\string^#1#2#3#2#4}\fi
9259 \def\:temp{#5}\ifx \:temp\empty \else
9260 \bgroup \everypar{}\everymath{}\everydisplay{}%
9261 \hbox{${\ht:special{t4ht\string^#1}%
9262 {#5}^{{#5}^{#5}}\ht:special{t4ht\string^}}$}%
9263 \vbox{$${\ht:special
9264 {t4ht\string^#1}{#5}^{{#5}^{#5}}\ht:special{t4ht\string^}}$$}\egroup
9265 \fi
9266 |<math dummy paragraph|>%
9267 \ht:special{t4ht@]}\EndNoFonts
9268 }
9269 \NewConfigure{MathDelimiters}[2]{\NoFonts \ht:special{t4ht@[}%
9270 \bgroup \everypar{}\everymath{}\everydisplay{}%
9271 \hbox{${\ht:special
9272 {t4ht\string^4}#1\ht:special{t4ht\string^5}#2%
9273 \ht:special{t4ht\string^4}{}^{#1}\ht:special{t4ht\string^5}{}^{#2}%
9274 \ht:special{t4ht\string^4}{}^{{}^{#1}}\ht:special
9275 {t4ht\string^5}{}^{{}^{#2}}%
9276 \ht:special{t4ht\string^}}$}%
9277 \vbox{$${\ht:special
9278 {t4ht\string^4}#1\ht:special{t4ht\string^5}#2%
9279 \ht:special{t4ht\string^4}{}^{#1}\ht:special{t4ht\string^5}{}^{#2}%
9280 \ht:special{t4ht\string^4}{}^{{}^{#1}}\ht:special
9281 {t4ht\string^5}{}^{{}^{#2}}%
9282 \ht:special{t4ht\string^}}$$}%
9283 |<math dummy paragraph|>%
9284 \ht:special{t4ht@]}\egroup
9285 \EndNoFonts}
9286 \catcode`\^=12
9287 >>>
9288
9289 I am not sure why the following code was used in the original code for math classes.
9290 It forces new pages during the .4ht file processing, which leads to problems if some
9291 packages want to write some information to the aux file. I've found this isssue
9292 \Link[https://tex.stackexchange.com/a/737993/2891]{}{}this bug report\EndLink.
9293
9294 \<math dummy paragraph do not use\><<<
9295 {\everypar{}\noindent\vfill\break}
9296 >>>
9297
9298 So instead, we just use a paragraph. It seems to work fine with math class definitions.
9299
9300 \<math dummy paragraph\><<<
9301 {\everypar{}\noindent}>>>
9302
9303 \<math classes\><<<
9304 \HAssign\New:MathClass|=7
9305 \catcode`\/=0
9306 \catcode`\\=12
9307 /def/NewMathClass#1{/relax
9308 /expandafter/ifx /csname /expandafter/:gobble/string#1/endcsname/relax
9309 /gHAdvance/New:MathClass by 1/relax
9310 /ifnum /New:MathClass>78
9311 /:warning{Too many math classes}
9312 /else
9313 /HAssign#1/New:MathClass /def/:tempc{#1}/:NewMC
9314 0123456789:;<=>?%
9315 @ABCDEFGHIJKLMNO%
9316 PQRSTUVWXYZ[\]{/string^}{/string_}%
9317 `abcdefghijklmno%
9318 pqrstuvwxyz{/string{}||{/string}}{/string~}|<par del|>%
9319 /fi
9320 /else
9321 /:warning{/string#1 is already defined}
9322 /fi}
9323 /catcode`/\=0
9324 \catcode`\/=12
9325 \def\:NewMC#1{%
9326 \ifnum \:tempc=0 \expandafter\xdef\:tempc{#1}\expandafter\stop:do
9327 \else
9328 \expandafter\HAdvance\:tempc |by -1\relax
9329 \expandafter\:NewMC
9330 \fi
9331 }
9332 >>>
9333
9334 79 math classes: 0--78.
9335
9336
9337 \<math classes\><<<
9338 \NewConfigure{nolimits}[1]{\def\:temp{#1}\ifx \:temp\empty
9339 \let\nolimits|=\o:nolimits: \else
9340 \def\:temp{\o:nolimits:\futurelet\:temp\:nolimits}%
9341 \def\:nolimits{\ifx \:temp\limits \else
9342 \ifx \:temp\nolimits \else #1\fi\fi}%
9343 \HLet\nolimits|=\:temp \fi}
9344 \let\o:nolimits:|=\nolimits
9345 \NewConfigure{limits}[1]{\def\:temp{#1}\ifx \:temp\empty
9346 \let\limits|=\o:limits: \else
9347 \def\:limits{\ifx \:temp\nolimits \else#1\fi}%
9348 \def\:temp{\o:limits:\:l:mits}%
9349 \HLet\limits|=\:temp \fi}
9350 \let\o:limits:|=\limits
9351
9352 \def\::limits{\expandafter\ifx \blank:spc\:temp
9353 \afterassignment\:l:mits \tmp:cnt0%
9354 \else
9355 \ifx \limits\:temp\else
9356 \expandafter\expandafter\expandafter\:limits
9357 \fi
9358 \fi}
9359 \def\:l:mits{\futurelet\:temp\::limits}
9360 \catcode`\ =13\relax\def\blank:spc{\let\blank:spc= }\blank:spc%
9361 \catcode`\ =10\relax
9362 >>>
9363
9364
9365 Test case to check: \Verb=\[\sum\nolimits\limits_a^b u_s^2 \]=
9366
9367
9368 The assignment \`'\tmp:cnt0%' also consumes the space that follows.
9369
9370
9371
9372
9373 \<math classes\><<<
9374 \NewConfigure{displaylimits}[1]{\def\:temp{#1}\ifx \:temp\empty
9375 \let\displaylimits|=\o:displaylimits: \else
9376 \def\:displaylimits{\ifx \:temp\nolimits \else
9377 \ifx \:temp\limits \else #1\fi\fi}%
9378 \def\:temp{\o:displaylimits:\display:l:mits}%
9379 \HLet\displaylimits|=\:temp \fi}
9380 \let\o:displaylimits:|=\displaylimits
9381 \def\::displaylimits{\expandafter\ifx \blank:spc\:temp
9382 \afterassignment\display:l:mits \tmp:cnt0%
9383 \else\expandafter\:displaylimits \fi}
9384 \def\display:l:mits{\futurelet\:temp\::displaylimits}
9385 >>>
9386
9387
9388
9389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9390 \SubSection{Configure Grouped Classes}
9391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9392
9393 \`'\mathord{...}' et al request delimiters for their arguments. The
9394 \`'\special{t4ht^X}' , for `~'-`0' (digit) greater than 79, request
9395 the delimiters of class 0 to apply to the next group (created by the
9396 math ord). The \`'0' asks to ignore nested delimiters; can be
9397 replaced by \`'1' to request the sub delimiters.
9398
9399
9400
9401
9402 A \`'\special{t4ht\string^)*...*...}' is variant of
9403 \`'\Send{Group}{1}... \Send{EndGroup}{1}' for delimiters, without
9404 subdelimiters. Taking \`'(' (or any other character which below a
9405 digit and not + or -) instead of \`')' gives also the subdelimiters.
9406
9407 A \`'\special{t4ht\string^i)}' takes the delimiters from
9408 the characters of class i.
9409
9410
9411 \<grouped math classes\><<<
9412 \def\:temp{\a:mathord \o:mathord:} \HLet\mathord|=\:temp
9413 \let\a:mathord|=\empty
9414 \def\:temp{\a:mathop \o:mathop:} \HLet\mathop|=\:temp
9415 \let\a:mathop|=\empty
9416 \def\:temp{\a:mathbin \o:mathbin:} \HLet\mathbin|=\:temp
9417 \let\a:mathbin|=\empty
9418 \def\:temp{\a:mathrel \o:mathrel:} \HLet\mathrel|=\:temp
9419 \let\a:mathrel|=\empty
9420 \def\:temp{\a:mathopen \o:mathopen:} \HLet\mathopen|=\:temp
9421 \let\a:mathopen|=\empty
9422 \def\:temp{\a:mathclose \o:mathclose:} \HLet\mathclose|=\:temp
9423 \let\a:mathclose|=\empty
9424 \def\:temp{\a:mathpunct \o:mathpunct:} \HLet\mathpunct|=\:temp
9425 \let\a:mathpunct|=\empty
9426 >>>
9427
9428
9429
9430 \<grouped math classes\><<<
9431 \NewConfigure{FormulaClass}[4]{%
9432 \def\:temp{#2}%
9433 \expandafter\edef\csname a:\ifcase #1 mathord\or mathop\or
9434 mathbin\or mathrel\or mathopen\or mathclose\else
9435 mathpunc\fi\endcsname{\noexpand\ht:special
9436 {t4ht\string^\ifx\:temp\empty#1)\else )#2#3#2#4\fi}}}
9437 >>>
9438
9439
9440
9441
9442 \`'\Configure{FormulaClass}{class number}{char}{before}{after}':
9443 char+before+after=empty implies same markings as for single
9444 characters. In fact, can do the same for any sub formula with any function,
9445 not just the math functions.
9446
9447 \<grouped math classes\><<<
9448 \NewConfigure{FormulaClass*}[4]{%
9449 \def\:temp{#2}%
9450 \expandafter\edef\csname a:\ifcase #1 mathord\or mathop\or
9451 mathbin\or mathrel\or mathopen\or mathclose\else
9452 mathpunc\fi\endcsname{\ht:special
9453 {t4ht\string^\ifx\:temp\empty#1(\else (#2#3#2#4\fi}}}
9454 >>>
9455
9456 The following are generalizations, introduced for allowing temporary
9457 changs, like in \`'
9458 \renewcommand{\opname}[1]{%
9459 \Configure{mathop*}{*}{<mrow>}{</mrow>}{\Configure{FormulaClass}{0}{}{}{}}
9460 \mathop{\fam0#1}}'.
9461
9462 \<grouped math classes\><<<
9463 \NewConfigure{mathord}[4]{\Configure{FormulaClass}{0}{#1}{#2}{#3}%
9464 \pend:def\a:mathord{#4}}
9465 \NewConfigure{mathop}[4]{\Configure{FormulaClass}{1}{#1}{#2}{#3}%
9466 \pend:def\a:mathop{#4}}
9467 \NewConfigure{mathbin}[4]{\Configure{FormulaClass}{2}{#1}{#2}{#3}%
9468 \pend:def\a:mathbin{#4}}
9469 \NewConfigure{mathrel}[4]{\Configure{FormulaClass}{3}{#1}{#2}{#3}%
9470 \pend:def\a:mathrel{#4}}
9471 \NewConfigure{mathopen}[4]{\Configure{FormulaClass}{4}{#1}{#2}{#3}%
9472 \pend:def\a:mathopen{#4}}
9473 \NewConfigure{mathclose}[4]{\Configure{FormulaClass}{5}{#1}{#2}{#3}%
9474 \pend:def\a:mathclose{#4}}
9475 \NewConfigure{mathpunct}[4]{\Configure{FormulaClass}{6}{#1}{#2}{#3}%
9476 \pend:def\a:mathpunct{#4}}
9477 >>>
9478
9479
9480
9481 \<grouped math classes\><<<
9482 \NewConfigure{mathord*}[4]{\Configure{FormulaClass*}{0}{#1}{#2}{#3}%
9483 \pend:def\a:mathord{#4}}
9484 \NewConfigure{mathop*}[4]{\Configure{FormulaClass*}{1}{#1}{#2}{#3}%
9485 \pend:def\a:mathop{#4}}
9486 \NewConfigure{mathbin*}[4]{\Configure{FormulaClass*}{2}{#1}{#2}{#3}%
9487 \pend:def\a:mathbin{#4}}
9488 \NewConfigure{mathrel*}[4]{\Configure{FormulaClass*}{3}{#1}{#2}{#3}%
9489 \pend:def\a:mathrel{#4}}
9490 \NewConfigure{mathopen*}[4]{\Configure{FormulaClass*}{4}{#1}{#2}{#3}%
9491 \pend:def\a:mathopen{#4}}
9492 \NewConfigure{mathclose*}[4]{\Configure{FormulaClass*}{5}{#1}{#2}{#3}%
9493 \pend:def\a:mathclose{#4}}
9494 \NewConfigure{mathpunct*}[4]{\Configure{FormulaClass*}{6}{#1}{#2}{#3}%
9495 \pend:def\a:mathpunct{#4}}
9496 >>>
9497
9498
9499
9500
9501
9502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503 \Section{Renewed Commands}
9504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9505
9506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9507 \SubSection{Math Symbols from Macros}
9508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9509
9510 The \`'\MathSymbol' works on empty when the symbol comes from a font.
9511 That is, when the macro is defined as \`'\mathchar"xxxx'. A
9512 \`'\MathSymbol+' variant may be applied to force definitions. Warning
9513 messages are not helpful as the symbols may have nultiple definitions
9514 dependent on the style files being loaded.
9515
9516 \<built-in tex math ops\><<<
9517 \def\MathSymbol{\futurelet\:temp\:::MathSymbol}
9518 \def\:::MathSymbol{\if +\:temp
9519 \expandafter\:MathSymbol \else
9520 \expandafter\::MathSymbol \fi
9521 }
9522 \def\::MathSymbol#1#2{%
9523 \def\:tempb##1"##2///{##1}%
9524 \edef\:tempa{\expandafter\expandafter\expandafter\:tempb
9525 \expandafter\meaning\csname#2\endcsname"///}%
9526 \edef\:tempc{\string\mathchar}%
9527 \ifx \:tempa\:tempc
9528 \NewConfigure{#2}{1}\Configure{#2}{\csname o:#2:\endcsname}%
9529 \else
9530 \:MathSymbol{}{#1}{#2}%
9531 \fi
9532 }
9533 \def\:MathSymbol#1#2#3{%
9534 \def\:temp{{\math:sym#2{#3}}}%
9535 \expandafter\HLet\csname #3\endcsname\:temp
9536 \NewConfigure{#3}{1}\Configure{#3}{\csname o:#3:\endcsname}%
9537 }
9538 \def\math:sym#1#2{{\relax\ifmmode \expandafter#1\fi
9539 {\csname a:#2\endcsname}}}
9540 >>>
9541
9542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9543 \SubSection{/left and /right}
9544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9545
9546 Again, we don't want line breaks from \''<PRE>'s within
9547 formulas in visual browsers.
9548
9549 \<built-in tex math ops\><<<
9550 \def\:temp#1{\a:left{#1}\o:left:#1\b:left{#1}}
9551 \HLet\left|=\:temp
9552 \def\:temp#1{\a:right{#1}\o:right:#1\b:right{#1}}
9553 \HLet\right|=\:temp
9554 \NewConfigure{left}[2]{\def\a:left##1{#1}\def\b:left##1{#2}}
9555 \NewConfigure{right}[2]{\def\a:right##1{#1}\def\b:right##1{#2}}
9556 \Configure{left}{}{}
9557 \Configure{right}{}{}
9558 >>>
9559
9560
9561
9562 \SubSection{Fractions}
9563
9564
9565 \<built-in tex math ops\><<<
9566 \def\:tempc{\pic:gobble\a:over \o:over: \pic:gobble\b:over}
9567 \HLet\over|=\:tempc
9568 \NewConfigure{over}{2}
9569 \def\:tempc{\pic:gobble\a:atop \o:atop: \pic:gobble\b:atop}
9570 \HLet\atop\:tempc
9571 \NewConfigure{atop}{2}
9572 \def\::above{\pic:gobble\a:above \o:above:\tmp:dim
9573 \pic:gobble\b:above }
9574 \def\:above{\afterassignment\::above}
9575 \def\:tempc{\Protect\:above \tmp:dim|=}
9576 \HLet\above\:tempc
9577 \NewConfigure{above}{2}
9578 >>>
9579
9580 \<built-in tex math ops\><<<
9581 \def\::abovewithdelims#1#2{\pic:gobble\a:abovewithdelims
9582 \o:abovewithdelims:#1#2\tmp:dim\pic:gobble\b:abovewithdelims}
9583 \def\:abovewithdelims#1#2{\def\:temp{\::abovewithdelims#1#2}%
9584 \afterassignment\:temp\tmp:dim=}
9585 \def\:tempc{\Protect\:abovewithdelims }
9586 \HLet\abovewithdelims\:tempc
9587 \NewConfigure{abovewithdelims}{2}
9588 \def\:overwithdelims#1#2{\pic:gobble\a:overwithdelims
9589 \o:overwithdelims:#1#2\pic:gobble\b:overwithdelims}
9590 \def\:tempc{\Protect\:overwithdelims}
9591 \HLet\overwithdelims\:tempc
9592 \NewConfigure{overwithdelims}{2}
9593 \def\:atopwithdelims#1#2{\pic:gobble\a:atopwithdelims
9594 \o:atopwithdelims:#1#2\pic:gobble\b:atopwithdelims}
9595 \def\:tempc{\Protect\:atopwithdelims}
9596 \HLet\atopwithdelims\:tempc
9597 \NewConfigure{atopwithdelims}{2}
9598 >>>
9599
9600
9601
9602 \`'\Configure{over}
9603 {\Send{GROUP}{0}{[before]}[before-rule]}
9604 {[before-argument]\Send{EndGROUP}{0}{[after]}}'
9605
9606
9607
9608 \`'
9609 \Configure{over}
9610 {\special{t4ht\string~<<NOMINATOR>}\HCode
9611 {</NOMINATOR><DENOMINATOR>}}
9612 {\special{t4ht\string~></DENOMINATOR>}}'
9613
9614
9615
9616 Beware of nested formulas for proper arrangments of
9617 \`'\special{t4ht\string~...}'
9618
9619
9620
9621
9622
9623
9624 \SubSection{Radical's}
9625
9626 \<built-in tex math ops\><<<
9627 \def\:temp{\pic:gobble\a:radical\o:radical:}
9628 \HLet\radical|=\:temp
9629 \NewConfigure{radical}{1}
9630 >>>
9631
9632 \Verbatim
9633 \Configure{radical}{%
9634 [before-sign]%
9635 \Send{EndGROUP}{2}{[after-sign]}%
9636 \Send{GROUP}{3}{[before-body]}%
9637 \Send{EndGROUP}{3}{[after-body]}%
9638 }
9639 \EndVerbatim
9640
9641
9642 \SubSection{Mathchoice}
9643
9644 The following is disabled because \TeX{} evaluates the four parameters
9645 and then keeps one and throws away the other. With the picture
9646 environment enabled, we'll get messages in the log file of the form
9647 \`'--- needs --- a.idv[1] ==> ai.gif ---' for pictures that are not
9648 included in the code.
9649
9650
9651 \<built-in tex math ops\><<<
9652 \def\:temp#1#2#3#4{\a:mathchoice
9653 \o:mathchoice:{#1}{#2}{#3}{#4}\b:mathchoice }
9654 \HLet\mathchoice|=\:temp
9655 \NewConfigure{mathchoice}{2}
9656 >>>
9657
9658
9659
9660 The following, for \''\?phantom', is not needed because it is already
9661 covered by \''\mathchoice'.
9662
9663 \Verbatim
9664 \def\makeph@nt#1{\PictureOff
9665 \setbox\z@\hbox{#1}\finph@nt \PictureOn}
9666 \def\mathph@nt#1#2{\PictureOff
9667 \setbox\z@\hbox{$\m@th#1{#2}$}\finph@nt \PictureOn}
9668 \EndVerbatim
9669
9670
9671
9672
9673 \SubSection{Equation Numbers}
9674
9675 The \''\eqno' and \''\leqno' refer to what follow them in the math
9676 environment as left and right equation numbers, respectively. Tex
9677 typesets them within groups, so material can be sent to the end of the
9678 number with a \`'\Send{GROUP}{0}{...}'.
9679
9680 \<built-in tex math ops\><<<
9681 \def\:temp{\o:eqno:\a:eqno}
9682 \HLet\eqno|=\:temp
9683 \def\:temp{\o:leqno:\a:leqno}
9684 \HLet\leqno|=\:temp
9685 \NewConfigure{eqno}{1}
9686 \NewConfigure{leqno}{1}
9687 >>>
9688
9689
9690
9691
9692
9693
9694 In addition,
9695 \`'1140. We get into ordinary math mode from display math mode when
9696 the equation numbers \eqno and \leqno appear'.
9697 Hence, the \`'\everymath{}' is needed also for the display case.
9698 To be on the sure side, we also put \`'\everydisplay{}' in the math mode.
9699
9700
9701
9702
9703 \Chapter{Decorated Symbols}
9704
9705
9706
9707 \Section{Htf Classes: Requesting BackEnd Fonts through /specials}
9708
9709
9710 \<font config util\><<<
9711 \NewConfigure{htf}[9]{{%
9712 \tmp:cnt|=#1 \ifnum \tmp:cnt>255 \:warning{Code larger than
9713 255 in \string\Configure{htf}}\else
9714 \ht:special{t4ht;||\ifnum \tmp:cnt<10 00\else
9715 \ifnum \tmp:cnt<100 0\fi\fi
9716 \the\tmp:cnt#2#3#2#4#2#5#2#6#2#7#2#8#2#9#2\the\tmp:cnt}%
9717 \fi}}
9718 >>>
9719
9720
9721 A \`'\%x' requests character code in hexadecimal representation.
9722
9723
9724 \`'\Configure{htf}' is essentially a configuration on
9725 fonts, where even cases, for instance, the \`'\special{t4ht;|004...}'
9726 extra independent information for characters.
9727 Odd cases like \`'\special{t4ht;|003...}', on the other hand, are
9728 addition to the \`'IMG' and not an independent info !!!
9729
9730 \SubSection{Pausing}
9731
9732 \<font config util\><<<
9733 \def\NoFonts{\ht:special{t4ht;8}}
9734 \def\EndNoFonts{\ht:special{t4ht;9}}
9735 >>>
9736
9737
9738 Nesting is allowed.
9739
9740 \SubSection{Configurations}
9741
9742 Code for calls made from htf fonts. Should start with three
9743 digits defining a number smaller than 256. Odd numbers apply
9744 to gifs, and even to text. The odd are intended for insertion into
9745 IMG marks, the odd are not used yet.
9746
9747 The character part is prented for codes that are not given in
9748 cases of characters and image-characters, respectively.
9749 Code 000 is created to groups of non image characters, and the
9750 codes 002, 004, 006, add extras to individual characters. The
9751 od codes deal only with specific characters, not groups.
9752
9753 The corresponding formatting instructions in the css
9754 file are determined in the `Font' option within the
9755 perl script.
9756
9757
9758
9759 \<font config util\><<<
9760 \NewConfigure{FontCss}[2]{\def\a:FontCss:{#1}\def\a:FontCssPlus:{#2}}
9761 >>>
9762
9763 \<font config util\><<<
9764 \NewConfigure{htf-css}[2]{{%
9765 \def\:temp##1|<par del|>{\def\:tempa{##1}}%
9766 \afterassignment\:temp\tmp:cnt|=0#1|<par del|>%
9767 \def\:temp{\Configure{Needs}}%
9768 \ifx \:tempa\empty
9769 \expandafter\:temp\expandafter{\a:FontCss:}\Needs{("#1"): #2}%
9770 \else
9771 \expandafter\:temp\expandafter{\a:FontCssPlus:}\Needs{#1 #2}%
9772 \fi}}
9773 \NewConfigure{htf-attr}[2]{{%
9774 \Configure{Needs}{##1}%
9775 \Needs{Font\string_css\string_base: #1Font\string_css\string_mag: #2}}}
9776 >>>
9777
9778
9779 \`'\NewConfigure{htf-css}{number}{...}' for a class;
9780 \`'\NewConfigure{htf-css}{not-number}{...}' for a htf font.
9781
9782
9783
9784
9785 \`'\Configure{htf}{even}{+}{open}{name}{size}{mag}{ord}{ch}{end}{gif-id}'
9786
9787
9788
9789 \`'\Configure{htf}{odd}{+}{open}{alt}{class}{size}{mag}{ord}{end}': mag and
9790 ord must be integer patterns.
9791
9792
9793 \`'\Configure{htf-css}{4}{.underline{text-decoration:underline; }}' is
9794 alredy covered.
9795
9796
9797
9798 HOW \`'\Configure{htf-css}{4}{.small-caps{font-variant: small-caps; }}'
9799 differs from \`'\Css{.small-caps{font-variant: small-caps; }}'?
9800 The latter is alway introduced into the
9801 css file, wheras the earlier only conditionally when the font/class is in use.
9802
9803
9804 % \special{t4ht;||003"\Hnewline ALIGN="MIDDLE}
9805
9806
9807 % \special{t4ht;||003-MIDDLE}
9808
9809
9810
9811
9812
9813 We have
9814 \Verbatim
9815 \Configure{htf}
9816 {odd-for-img-chr}
9817 {distinguished delimiter ch+id}
9818 {prefix for file name, if the latter is desired}
9819 {prefix for alt, if the latter is desired}
9820 {c-template, if family name is desired}
9821 {c-template, if font size is desired}
9822 {c-template, if font mag is desired}
9823 {c-template, if ch ord is desired}
9824 {close of tag}
9825 \Configure{htf}
9826 {even-for-reg-chr}
9827 {distinguished delimiter ch+id}
9828 {prefix}
9829 {c-template, if family name is desired}
9830 {c-template, if font size is desired}
9831 {c-template, if font mag is desired}
9832 {c-template, if ch ord is desired}
9833 {postfix}
9834 {closing tag}
9835 \EndVerbatim
9836
9837
9838
9839 The id is to be used in Needs fo associating styles to the
9840 character decorations. Also, due to the id, we can assign to the
9841 same code of font different styles.
9842 \ifHtml[\HPage{example}\Verbatim
9843 \Configure{htf}{6}{+a}{}{}{<a..
9844 FONT="\%s}{\%s"}{MAG="\%d"}{ORD="\%d"}{>}
9845 $\leq$
9846 \Configure{htf}{6}{+b}{}{}{<b...
9847 FONT="\%s}{\%s"}{MAG="\%d"}{ORD="\%d"}{>}
9848 $\leq$
9849
9850 \Needs{a .......}
9851 \Needs{b .......}
9852 \EndVerbatim
9853
9854 produces
9855
9856 \Verbatim
9857 Font class 6 a: <a.. FONT="%s%s"MAG="%d"ORD="%d">
9858 Font class 6 b: <b... FONT="%s%s"MAG="%d"ORD="%d">
9859 l. 27 --- needs --- a ....... ---
9860 l. 28 --- needs --- b ....... ---
9861 \EndVerbatim\EndHPage{}]\fi
9862
9863 Newer:
9864
9865 \Verbatim
9866 Css: TD.caption{white-space: nowrap; }
9867 Font("cmex","10","100")
9868 Font("cmmi","10","100")
9869 Font("cmmi","5","100")
9870 Font("cmmi","7","100")
9871 Font("cmr","10","100")
9872 Font("cmr","5","100")
9873 Font("cmr","7","100")
9874 Font("cmsy","10","100")
9875 Font("cmsy","7","100")
9876 Font("cmti","10","100")
9877 Font("cmtt","10","100")
9878 Font_Class(1,""): <IMG SRC=""ALT=""CLASS="%s%s-%d--%x">
9879 Font_Class(3,"mva"): <IMG SRC=""ALT=""CLASS="%s-%d--%x"ALIGN="MIDDLE">
9880 Font_Class(6,"ul"): <SPAN CLASS="underline"></SPAN>
9881 Font_Css("sc"): .small-caps{font-variant: small-caps; }
9882 Font_Css("ul"): .underline{text-decoration:underline; }
9883 \EndVerbatim
9884
9885 The \`'Font(...)' indicates the fonts in use; it's format is determined
9886 by the system variable LGFNT, and can be changed within the env file
9887 through a `f' flagged field. The indicated fonts are used for deciding
9888 which entries in \`'htf.sty' should be introduced into the css file.
9889
9890 The \`'Font_Class(...)' indicates the classes in use within the fonts;
9891 it's format is determined by the system variable LGCLS, and can be
9892 changed within the env file through a `c' flagged field.
9893
9894 The \`'Font_Css' is a contribution from the TeX file, from
9895 \`'\Configure{htf-css}{...}' commands.
9896 It overides info found in \`'htf.sty'.
9897 Its format can be
9898 changed by \`'\Configure{FontCss}{...##1...}', before the
9899 \''\Preamble' command.
9900
9901 The \`'Css' is a contribution from the TeX file, from \`'\Css{...}'
9902 comamnds that preced the \''\CssFile' command. Its format can be changed
9903 by \`'\Configure{Css}{...##1...}', before the \''\Preamble' command.
9904
9905 The \`'\special{t4ht;,}' prevents notification to the
9906 log file of the change requested by \`'\Configure{htf}'.
9907
9908 \`'\Configure{htf-css}{cmmi}{font-style: italic;}'
9909 produces
9910 \`'Font_Css_Plus cmmi font-style: italic;'
9911 and that appears also in \`'htf.sty'.
9912 The following are already in \`'htf.sty'.
9913
9914
9915 %%%%%%%%%%%%%%%%%%%%%%
9916 \Section{New Accents}
9917 %%%%%%%%%%%%%%%%%%%%%%
9918
9919 \<accents\><<<
9920 \:CheckOption{new-accents} \if:Option
9921 |<new accents|>
9922 \else
9923 |<tools for accents|>
9924 |<old accents|>
9925 \fi
9926 >>>
9927
9928
9929
9930
9931
9932 Some accents of TeX are defined through commands of the form
9933 \`'\accent <number> <char>', and some throught macros (e.g., \''\b',
9934 \''\c', and \''\d'). Moreover,the \`'\accent <number> <char>' reduces
9935 to \`'\char <number>', whenever \''<char>' doesn't immediately follows
9936 \''<number>' (however, font changes, etc, are possible in between).
9937
9938 We can't decide the content of accented charaters without looking at
9939 the htf fonts. The accented characters of the source (la)tex files
9940 may go through transformations due to \''\uppercase' and
9941 \''\lowercase' operations (e.g., \'+\uppercase \'a+).
9942
9943 \<new accents\><<<
9944 \def\:temp{\leavevmode\ifx \d:mathaccent\empty
9945 \else \ht:special{t4ht\string~>1\d:mathaccent}\fi
9946 \ht:special{t4ht*\string^m}\o:mathaccent:}
9947 \HLet\mathaccent|=\:temp
9948 \def\:temp{\leavevmode\ht:special{t4ht*\string^t}\o:accent:}
9949 \HLet\accent|=\:temp
9950 \NewConfigure{accent}[6]{\ht:special{t4ht*\string^t#1#2#1#3#1#4#1#5#1#6}}
9951 \NewConfigure{mathaccent}[6]{\ht:special{t4ht#1\string
9952 ^m#1#2#1#3#1#4#1#5#1}\edef\d:mathaccent{#6}}
9953 \let\d:mathaccent|=\empty
9954 \NewConfigure{accented}[6]{\ht:special
9955 {t4ht*\string^a#1#2#1#3#1#4#1#5#1#6}}
9956 \NewConfigure{accenting}[3]{\ht:special{t4ht*\string^i#1#2#1#3#1#1}}
9957 >>>
9958
9959 %%%%%%%%%%%%%%%%%%%%%%
9960 \SubSection{Screening}
9961 %%%%%%%%%%%%%%%%%%%%%%
9962
9963 The following feature is used as in
9964
9965 \`'\Configure{HAccent}\hat{AEIOUaeiou{}}{\Picture+{}}{\EndPicture}'
9966
9967 and it screens which characters are allowed to use the native
9968 definitions of the accents, and which one the commands tailored for
9969 the hooks.
9970
9971
9972
9973
9974 \<new accents\><<<
9975 \NewConfigure{HAccent}[1]{\pic:Accent#1}
9976 \def\pic:Accent#1#2#3#4{\edef\:tempb##1{{\expandafter\:gobble\string#1}}%
9977 \pend:defI\:tempb{\choose:accent{####1}#2\relax|<par del|>}%
9978 \append:defI\:tempb{{#3}{#4}}%
9979 \expandafter\let\csname \string#1:\endcsname|=\:tempb
9980 \edef\:tempb{\noexpand\Protect\noexpand\acc:nm{\string#1}}%
9981 \HLet#1|=\:tempb}
9982 \def\acc:nm#1{\csname \string#1:\endcsname}
9983 >>>
9984
9985 The following sub-utilities iteratively search the dictionary to check
9986 whether the parameter is known.
9987
9988 \<new accents\><<<
9989 \def\choose:accent#1{\def\:accented{#1}\cs:accent}
9990 \def\realx:par{\relax}
9991 \def\cs:accent#1{\def\:tempa{#1}%
9992 \ifx \:tempa\realx:par \expandafter\pic:accent
9993 \else
9994 \ifx \:tempa\:accented
9995 \expandafter\expandafter\expandafter\nopic:accent
9996 \else \expandafter\expandafter\expandafter\cs:accent\fi
9997 \fi}
9998 \def\pic:accent#1|<par del|>#2#3#4{%
9999 #3\nopic:accent|<par del|>{#2}{}{}#4}
10000 \def\nopic:accent#1|<par del|>#2#3#4{\expandafter\expandafter
10001 \csname o:#2:\endcsname\expandafter{\:accented}}
10002 >>>
10003
10004 %%%%%%%%%%%%%%%%%%%%%%
10005 \Section{Old Accents}
10006 %%%%%%%%%%%%%%%%%%%%%%
10007
10008
10009
10010 For entries not in the given font tables (not specified in the
10011 \`'\Configure{accent}'), problems can arise for cases such as
10012 \`'csname \ifmmode m\else t\fi :\acn:no\endcsname{#2}' and
10013 \`'\hat{\char o}' when they don't go into pictures.
10014
10015 \SubSection{Accents through `accents' Configurations}
10016
10017 The
10018 \`'\Configure{accent}\^\hat{{A-in}{A-out}{B-in}{B-out}...{}{last-out}}
10019 {do-found} {do-not-found}' defines the text accent \''\^' and math
10020 accent \''\hat'. In cases that the text or math accent has no counter math
10021 accent, we fake \''\null' for the math part.
10022
10023 When \''\hat{foo}' is encountered, a search is made for an \`'??-i'
10024 that equals \`'foo' in the given accent table. If found, do-found is
10025 executed; otherwise, do-not-found is executed. The do-found can reference the
10026 ??-out through \`'#1'. The do-not-found can reference the
10027 old definition of \`'\hat' through \`'#1' and the foo through \`'#2'.
10028
10029
10030
10031 \SubSection{Foundation for Accents}
10032
10033
10034
10035
10036 \<tools for accents\><<<
10037 \NewConfigure{accent}[5]{%
10038 \expandafter\ifx \csname x:\string#2\endcsname\relax
10039 \expandafter\edef
10040 \csname x:\string#2\endcsname{\accent:cnt}%
10041 |<save old accent comamnd|>%
10042 |<new accent command|>%
10043 \Advance:\accent:cnt by 1
10044 \fi
10045 \edef\:tempa{\csname x:\string#2\endcsname}%
10046 |<get accent config|>%
10047 }
10048 \def\accent:cnt{0}
10049 >>>
10050
10051 The \`'\csname t:\accent:cnt\endcsname' part is for the text mode,
10052 and the \`'\csname m:\accent:cnt\endcsname' part is for math mode.
10053
10054
10055 \<save old accent comamnd\><<<
10056 \expandafter\let\csname t:\accent:cnt\endcsname|=#1%
10057 \expandafter\let\csname m:\accent:cnt\endcsname|=#2%
10058 >>>
10059
10060
10061 \<new accent command\><<<
10062 \edef\:temp{\ifx \accent:def\:UnDef \noexpand\def \else
10063 \noexpand\accent:def \fi
10064 \noexpand\:temp{\noexpand\ac:pc{\accent:cnt}}%
10065 \noexpand\HLet\noexpand#1|=\noexpand\:temp
10066 |<hook accent table|>}%
10067 \:temp
10068 \def\:temp{#1}\def\:tempa{#2}\ifx \:temp\:tempa \else \HLet#2|=#1\fi
10069 >>>
10070
10071 The search starts at \`'\ac:pc{\accent:cnt}'.
10072 The accent table is stored in \`'\csname\accent:cnt :ac\endcsname'.
10073 The table is searched by \''\acpc:', which puts the result in \''\end:accent'.
10074
10075 \<hook accent table\><<<
10076 \noexpand\pend:defI
10077 \noexpand\:accnts{\noexpand\ifnum ########1=\accent:cnt
10078 \noexpand\expandafter \noexpand\acpc:
10079 \expandafter\noexpand\csname\accent:cnt :ac\endcsname
10080 \noexpand\expandafter \noexpand\end:accent \noexpand\fi}%
10081 >>>
10082
10083 The pend above is just:
10084 \`'\pend:defI\:accnts{\ifnum ########1=\accent:cnt
10085 \expandafter\acpc: \csname\accent:cnt :ac\endcsname
10086 \expandafter\end:accent\fi}'
10087
10088
10089
10090 \<get accent config\><<<
10091 \def\:temp{#3}\ifx \:temp\empty \else
10092 \expandafter\def\csname \:tempa :ac\endcsname{#3}
10093 \fi
10094 \long\def\:temp##1##2{#4#5}\ifx \:temp\:gobbleII \else
10095 \expandafter\def\csname C:\:tempa\endcsname##1{#4}%
10096 \expandafter\def\csname MT:\:tempa\endcsname##1##2{#5}%
10097 \fi
10098 >>>
10099
10100
10101
10102 \''\acp:c' might go to the aux file of latex, where \`':' has standard
10103 cat code. Hence, the protection on \''\csname' and not the command
10104 itself (as was the case at the beginning).
10105
10106
10107 \<old accents\><<<
10108 \def\ac:pc{\Protect\csname acp:c\endcsname}
10109 \def\acp:c#1#2{{\def\acn:no{#1}\def\:temp{#2}\ifx \:temp\empty
10110 |<accent on empty arg|>%
10111 \else |<tabacckludge|>%
10112 \def\ac:pc{\ac:nt{#2}}\a:cpc{#1}\fi }}
10113 \def\ac:nt{\csname \ifmmode m\else t\fi :\acn:no\endcsname}
10114 >>>
10115
10116 \<accent on empty arg\><<<
10117 \ac:nt{}%
10118 >>>
10119
10120 \<old accents\><<<
10121 \def\Ac:nt{\edef\:temp{\ifx \EndPicture\:UnDef
10122 \def\noexpand\ac:pc{\noexpand\Protect \noexpand\acp:c}%
10123 \expandafter\noexpand \csname MT:\acn:no\endcsname
10124 \fi
10125 \expandafter\noexpand
10126 \csname\ifmmode m\else t\fi :\acn:no\endcsname}\:temp
10127 }
10128 >>>
10129
10130 The second line above is for nested accents in nonpictorial
10131 environments (e.g., \''\hat{\hat{x}}'). Otherwise, we are
10132 getting an infinite loop because by now \''\ac:pc' has been
10133 modified to equal \''\Ac:nt'.
10134
10135
10136 \`' \def\acp:c#1#2{{\def\:temp{#2}\def\ac:pc{\accent#1 #2}\a:cpc{#1}}}'
10137
10138 We can't have braces around \`'#2' in \`'\accent#1 #2' because they
10139 get TeX \ifHtml[\HPage{confused}\Verbatim
10140 \Draw \Text(--Ra\'ul--) \EndDraw
10141 \EndVerbatim\EndHPage{}]\fi{} on the exact location of the mark.
10142
10143
10144 \<old accents\><<<
10145 \def\a:cpc#1{%
10146 \ifx \EndPicture\:UnDef
10147 \def\AC:PC{|<default accent|>%
10148 }%
10149 \:accnts{#1}\empty
10150 \else \ac:pc \fi }
10151 >>>
10152
10153
10154 The \''\empty' is for the skiping over the leftover of the fonts, once
10155 a font is found. It is used in \''\end:accent'.
10156
10157 \<tools for accents\><<<
10158 \def\end:accent#1\empty{}
10159 \def\:accnts#1{}
10160 >>>
10161
10162
10163
10164
10165
10166
10167
10168 The :tabacckludge is undefined, so it doesn't make sense to redefine the
10169 original command with this non existent command.
10170
10171 \<tabacckludge\><<<
10172 %\let\@tabacckludge|=\:tabacckludge
10173 >>>
10174
10175 \SubSection{Getting the Html Replacement}
10176
10177
10178 \<old accents\><<<
10179 \def\acpc:#1#2{%
10180 \def\:tempa{#1}\ifx \:tempa\empty
10181 |<char/pic accent|>%
10182 \else \ifx \:tempa\:temp \let\AC:PC|=\empty
10183 |<accent for table entry|>\fi
10184 \expandafter\acpc:
10185 \fi}
10186 >>>
10187
10188 /:temp below is the parameter of the accent, and it can be empty
10189 (e.g. \''\^{}'). If the parameter is empty, the accent is just a
10190 character, given in the last parameter of \''\acpc:'. The recursive
10191 macro \''\acpc:' eats two parameters at a time, and it terminates
10192 when the first in the pair of parameters is empty.
10193
10194 \<char/pic accent\><<<
10195 \ifx \:temp\empty
10196 \def\:tempa{#2}\ifx \:tempa\empty \AC:PC
10197 \else |<accent for ?|>\fi
10198 \else \AC:PC \fi
10199 >>>
10200
10201
10202 \<accent for ?\><<<
10203 \csname \ifmmode m\else t\fi :\acn:no\endcsname{#2}%
10204 >>>
10205
10206
10207 \<accent for table entry\><<<
10208 \csname C:\acn:no\endcsname{#2}%
10209 >>>
10210
10211
10212 The else \`'\csname \ifmmode m\else t\fi :\acn:no\endcsname{}' is for
10213 the case that the parameter is empty, in which case the accent needs
10214 to be converted into a stand alone character (e.g., \`'\={}').
10215
10216
10217 Default is needed for symbols not found in initiation tables.
10218
10219
10220 \<default accent\><<<
10221 {\let\AC:PC|=\ACP:C \let\ac:nt|=\Ac:nt \ac:pc}%
10222 >>>
10223
10224
10225
10226
10227
10228 The \`'\let\AC:PC=\ACP:C' above is for recursive cases like in
10229 \`'$A\hat{B\hat{x}}$'.
10230
10231
10232 \<config nonspecified accent\><<<
10233 \def\:temp##1##2{#5#6}\ifx \:temp\:gobbleII \else
10234 \expandafter\def\csname C:#3\endcsname##1{#5}%
10235 \expandafter\def\csname MT:#3\endcsname##1##2{#6}%
10236 \fi
10237 >>>
10238
10239
10240
10241
10242
10243
10244
10245
10246 \Section{End-of-Line Ch Characters}
10247
10248 \<html utilities\><<<
10249 \def\Hnewline{\:newlnch}
10250 >>>
10251
10252 Without the following, we get in toc things like \`'^^J'
10253 that don't go together with catcode 13 for \`'^'.
10254
10255 \<no Hnewline\><<<
10256 \let\:newlnch|=\space
10257 >>>
10258
10259
10260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10261 \Section{Symbols}
10262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10263
10264 Check that all the symbols belong to TeX and LaTeX
10265
10266
10267 \<shared config\><<<
10268 \def\HChar#1{{\leavevmode |%\ifmmode\else\expandafter\immediate\fi|%
10269 \ht:special{t4ht@#1}\ifnum #1>-1 \a:HChar\fi}}
10270 \NewConfigure{HChar}{1}
10271 \Configure{HChar}{x}
10272 >>>
10273
10274
10275
10276 There is a boundary case of \''\HChar{0}' we didn't
10277 handle above. Do we want to take care of it?
10278
10279
10280 \`'\HChar{i}' inserts the character code i, with its font info, if
10281 i is positive. If i is negative, the font info is not included. The
10282 first case is obtained with a special that inserts its content
10283 directly, and the second by a special sending its content as override
10284 on top of the next character.
10285
10286 The \''\Configure' tells from where the font info comes. With the
10287 presence of regular and pictorial symbols, we should be careful
10288 not to get here into a mess.
10289
10290 Without checking for the math mode the immediate becomes problematic in math mode (why?).
10291
10292 \Verbatim
10293 \documentclass{article}
10294 \begin{document}
10295 $\_$ vs \_
10296 \end{document}
10297 \EndVerbatim
10298
10299
10300 Same problem for tables (why?)
10301
10302 \Verbatim
10303 \documentclass{article}
10304 \begin{document}
10305 \begin{tabular}{l} \_ \end{tabular}
10306 \end{document}
10307 \EndVerbatim
10308
10309
10310
10311 %%%%%%%%%%%%%%%%%%%%%%%%%
10312 \SubSection{Symbols}
10313 %%%%%%%%%%%%%%%%%%%%%%%%%%
10314
10315 % After |<dvi-based hooks|>
10316
10317 % |<html math and non-math symbols|> |%after <math>|%
10318
10319 % \<html math and non-math symbols\><<<
10320 % \ifHtml
10321 % \let\:copyright|=\copyright
10322 % \def\::copyright{\gt:ch\:copyright{copy}}
10323 % \def\copyright{\Protect\::copyright}
10324 % \def\gt:ch#1#2{\ifx \EndPicture\:Undef \HCode{&#2;}\else #1\fi }
10325 % \fi
10326 % >>>
10327 %
10328
10329
10330 \<shared config\><<<
10331 \NewConfigure{@Picture}[1]{\def\a:@Picture{#1}}
10332 \let\a:@Picture|=\:gobble
10333 >>>
10334
10335
10336
10337
10338
10339 \Chapter{Dvi-Based Hooks}
10340
10341 \<dvi-based hooks\><<<
10342 |<tracing dvi|>
10343 |<sent to dvi|>
10344 >>>
10345
10346
10347
10348 \Section{Tracing Dvi}
10349
10350 \<tracing dvi\><<<
10351 \def\HTrace#1{\csname #1:T\endcsname}
10352 \def\EndHTrace#1{\csname #1:t\endcsname}
10353 >>>
10354
10355 \<tracing dvi\><<<
10356 \def\RULE:T{\ht:special{t4ht@\%R}} \def\RULE:t{\ht:special{t4ht@\%r}}
10357 >>>
10358
10359 \<shared config\><<<
10360 \NewConfigure{RULE}[5]{\ht:special{t4ht@\%\%R#1#2#1#3}
10361 \ht:special{t4ht@\%\%r#1#4#1#5}}
10362 >>>
10363
10364 \<tracing dvi\><<<
10365 \def\GROUP:T{\ht:special{t4ht@\%P}} \def\GROUP:t{\ht:special{t4ht@\%p}}
10366 >>>
10367
10368
10369 \<shared config\><<<
10370 \NewConfigure{GROUP}[5]{\ht:special{t4ht@\%\%P#1#2#1#3}
10371 \ht:special{t4ht@\%\%p#1#4#1#5}}
10372 >>>
10373
10374
10375 \<tracing dvi\><<<
10376 \def\CHAR:T{\ht:special{t4ht@\%C}} \def\CHAR:t{\ht:special{t4ht@\%c}}
10377 >>>
10378
10379 \<shared config\><<<
10380 \NewConfigure{CHAR}[5]{\ht:special{t4ht@\%\%C#1#2#1#3}
10381 \ht:special{t4ht@\%\%c#1#4#1#5}}
10382 >>>
10383
10384 \<tracing dvi\><<<
10385 \def\HSPACE:T{\ht:special{t4ht@\%H}} \def\HSPACE:t{\ht:special{t4ht@\%h}}
10386 >>>
10387
10388 \<shared config\><<<
10389 \NewConfigure{HSPACE}[3]{\ht:special{t4ht@\%\%H#1#2#1#3}}
10390 >>>
10391
10392
10393 \<tracing dvi\><<<
10394 \def\VSPACE:T{\ht:special{t4ht@\%V}} \def\VSPACE:t{\ht:special{t4ht@\%v}}
10395 >>>
10396
10397 \<shared config\><<<
10398 \NewConfigure{VSPACE}[3]{\ht:special{t4ht@\%\%V#1#2#1#3}}
10399 >>>
10400
10401
10402
10403 tex4ht.c has implicit \`'\Configure{VSPACE}{.}{}{}', etc. for the
10404 above.
10405
10406
10407 Comamnd line `-p' requests tracings of specials. \`'\special{t4ht@/}'
10408 for flip-floping requests of such tracings.
10409
10410 The switch `-c' in the command line asks for context dump into the log
10411 when dvi errors/ warning are provided.
10412
10413 \Section{Sent to Dvi}
10414
10415 All the control flow commads should be located within the
10416 \`'\Send' environment. The \`'\send:special' takes care
10417 of killing casses not obeying this requirement.
10418
10419 \<sent to dvi\><<<
10420 \def\Send#1{\Configure{Send:#1}}
10421 \def\DviSend{\let\send:special|=\ht:special
10422 \ht:special{t4ht\string~}\EndPauseBACK\ht:special{t4ht\string~}%
10423 \ht:special{t4ht\string~}}
10424 \def\EndDviSend{\send:special{t4ht\string~}%
10425 \send:special{t4ht\string~}\PauseBACK\send:special{t4ht\string~}%
10426 \let\send:special|=\:gobble}
10427 \def\PauseBACK{\send:special{t4ht\string~<(}}
10428 \def\EndPauseBACK{\send:special{t4ht\string~<)}}
10429 \def\HideBACK{\send:special{t4ht\string~<[}}
10430 \def\EndHideBACK{\send:special{t4ht\string~<]}}
10431 \def\MiniBACK{\send:special{t4ht\string~<-}}
10432 \def\EndMiniBACK{\send:special{t4ht\string~<+}}
10433 >>>
10434
10435 \<shared config\><<<
10436 \let\send:special=\:gobble
10437 \NewConfigure{Send:GROUP}[2]{\send:special{t4ht\string~<#1#2}}
10438 \NewConfigure{Send:EndGROUP}[2]{\send:special{t4ht\string~>#1#2}}
10439 \NewConfigure{Send:BACK}[1]{\send:special{t4ht\string~<*#1}}
10440 >>>
10441
10442
10443
10444 What \`'\MiniBACK...\EndMiniBACK' do here.
10445
10446 \`'{\special{t4ht=}}' ----forcing a group
10447 i.e. use \`'{\special{t4ht=}}^x' instead of \`'{}^x'.
10448
10449
10450 \Section{Observations}
10451
10452 \List{*}
10453 \item \`'\HChar{...}' sends forward a character to the next printable
10454 char (can be refined to specific characters). That is, it uses the
10455 character of the command, with the decoration of the character that
10456 follows.
10457 \item \`'\special{t4ht@+...}' sends forward a string to the next printable
10458 chr
10459
10460
10461
10462 \item
10463 \Verbatim
10464 \special{t4ht@+. ...string...} configure insertions at eoln
10465 \special{t4ht@+(} ignore spaces
10466 \special{t4ht@+)} end ignore spaces
10467 \special{t4ht@+[} ignore chs and spaces
10468 \special{t4ht@+]} end ignore chs and spaces (but not the content of some
10469 of the specials)
10470 \special{t4ht@+!} get last ignored space (none, if from previous lines).
10471 \EndVerbatim
10472
10473
10474 \EndList
10475
10476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10477 \Chapter{Loose Ends}
10478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10479
10480 %%%%%%%%%%%%%%%%%%
10481 \Section{Hyphenation}
10482 %%%%%%%%%%%%%%%%%%
10483
10484 \<core tex\><<<
10485 \def\hyphenation#1{}
10486 >>>
10487
10488
10489
10490
10491
10492
10493
10494
10495 %%%%%%%%%%%%%
10496 \Section{String Encode}
10497 %%%%%%%%%%%%%
10498
10499 \<html config util\><<<
10500 \expandafter\def\csname c:string-encoder:\endcsname#1{%
10501 \expandafter\def\csname c:#1:\endcsname{%
10502 \csname #1:String\endcsname
10503 \expandafter\let\csname #1:String\endcsname=\empty
10504 \expandafter\let\expandafter\Char:dic
10505 \csname #1Char:dic\endcsname
10506 \cnf:transString}
10507 \expandafter\def\csname #1\endcsname##1##2|<par del|>{%
10508 \if !##1!\expandafter\gob:par
10509 \else
10510 \expandafter\ifx \csname \string##1:#1EnCoDe\endcsname\relax
10511 \string ##1\else
10512 \csname \string##1:#1EnCoDe\endcsname
10513 \fi
10514 \if !##2!\expandafter\expandafter\expandafter\gob:par
10515 \else
10516 \expandafter\expandafter\expandafter
10517 \expandafter\expandafter\expandafter
10518 \csname #1\endcsname
10519 \fi
10520 \fi
10521 ##2|<par del|>%
10522 }
10523 \expandafter\def\csname #1Char:dic\endcsname##1##2{%
10524 \def\:temp{##1}\ifx \:temp\empty \egroup
10525 \else \egroup
10526 \expandafter\append:def\csname #1:String\endcsname
10527 {\expandafter\let
10528 \csname \string##1:#1EnCoDe\endcsname=\:UnDef}%
10529 \expandafter\def\csname \string##1:#1EnCoDe\endcsname{##2}%
10530 \expandafter \cnf:transString
10531 \fi
10532 }
10533 }
10534 \def\cnf:transString{\bgroup
10535 \catcode`\%=12
10536 \catcode`\~=12
10537 \catcode`\$=12
10538 \catcode`\&=12
10539 \catcode`\#=12
10540 \catcode`\^=12
10541 \catcode`\_=12
10542 \catcode`\?=12 \Char:dic }
10543 \def\gob:par#1|<par del|>{}
10544 >>>
10545
10546
10547 Offers applications similar to the following one.
10548
10549 \Verbatim
10550 \Configure{string-encoder}{urlEncoder}
10551
10552 \Configure{urlEncoder}
10553 {!}{%21}
10554 {"}{%22}
10555 {#}{%23}
10556 {$}{%24}
10557 {%}{%25}
10558 {&}{%26}
10559 {'}{%27}
10560 {(}{%28}
10561 {)}{%29}
10562 {+}{%2B}
10563 {,}{%2C}
10564 {<}{%3C}
10565 {>}{%3E}
10566 { }{+}
10567 {}{}
10568
10569
10570
10571
10572 \catcode`\%=11
10573 \catcode`\~=11
10574 \catcode`\$=11
10575 \catcode`\&=11
10576 \catcode`\#=11
10577 \catcode`\^=11
10578 \catcode`\_=11
10579 \catcode`\ =12
10580
10581
10582 \urlEncoder ! " # $ % & ' ( ) + , < > |<par del|>
10583
10584 \Configure{urlEncoder}{}{}
10585
10586 \urlEncoder ! " # $ % & ' ( ) + , < > |<par del|>
10587 \EndVerbatim
10588
10589
10590
10591 %%%%%%%%%%%%%
10592 \Section{Moveright}
10593 %%%%%%%%%%%%%
10594
10595 \<shared config\><<<
10596 \def\:temp{\a:moveright \o:moveright:}
10597 \HLet\moveright|=\:temp
10598 \NewConfigure{moveright}{1}
10599 >>>
10600
10601 The \''\leavevmode' is to force paragraph break, but we might end
10602 here with extra one because of the internal content of the
10603 parameter. An \''\IgnoreIndent' after \''\par' may solve the problem
10604 of extra paragraph breaks, but it might also have adverse effect of
10605 loosing paragraph breaks.
10606
10607
10608 \Section{Debugging Mode}
10609
10610
10611 \<debug\><<<
10612 \:CheckOption{debug}
10613 \if:Option |<html debug|>
10614 \else |<no debug|> \fi
10615 >>>
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632 \Chapter{e tex/latex}
10633
10634
10635 \Link[http://www.vms.rhbnc.ac.uk/e-TeX/v1/etex\string
10636 _ref.html]{}{}e-TeX\EndLink
10637
10638 \<e tex\><<<
10639 \def\:temp{\o:beginL:\a:Lregion}
10640 \HLet\beginL=\:temp
10641 \def\:temp{\b:Lregion\o:endL:}
10642 \HLet\endL=\:temp
10643 \NewConfigure{Lregion}{2}
10644 \def\:temp{\o:beginR:\a:Rregion}
10645 \HLet\beginR=\:temp
10646 \def\:temp{\b:Rregion\o:endR:}
10647 \HLet\endR=\:temp
10648 \NewConfigure{Rregion}{2}
10649 >>>
10650
10651
10652
10653
10654
10655
10656 \Chapter{Utilities}
10657
10658
10659
10660 \Section{Vertical Break Points}
10661
10662 La\TeX{} already has a \''\newpage'. Do we want the following to
10663 be \''\clear:page'?
10664
10665 \<general utilities\><<<
10666 \ifx \newpage\:UnDef
10667 \def\newpage{\vfil\penalty-10000 }
10668 \fi
10669 >>>
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679 \Section{Counters}
10680
10681 With packages like pictex around, counters become scarce resources.
10682 Hence, their use is minimized here in favor of macros. The tradeoff
10683 in time is minor because counters are scarcely needed in TeX4ht.
10684
10685
10686 NOTE: /g:advance in wripro...?????????????????????
10687
10688
10689 \<general utilities\><<<
10690 \ifx\tmp:toks\:UnDeF \csname newtoks\endcsname\tmp:toks\fi
10691 \ifx\tmp:cnt\:UnDeF \csname newcount\endcsname\tmp:cnt\fi
10692 \def\Advance:{\ip:op\advance\:Advance}
10693 \def\Multiply:{\ip:op\multiply\:Advance}
10694 \def\Divide:{\ip:op\divide\:Advance}
10695 \def\gHAdvance{\ip:op\advance\g:Advance}
10696 \def\gHMultiply{\ip:op\multiply\g:Advance}
10697 \def\gHDivide{\ip:op\divide\g:Advance}
10698 >>>
10699
10700
10701 psfig already has /Multiply and /Divide
10702
10703 When defined, \''\HAdvance' is the same as \''\Advance:'.
10704
10705 \<general utilities\><<<
10706 \def\DefOp#1#2{
10707 \ifx #1\:UnDef
10708 \expandafter \ifx \csname #2:\endcsname\relax
10709 \:warning{\string\DefOp...\string{#2\string}?}%
10710 \else \expand:after{\let#1|=}\csname #2:\endcsname
10711 \fi
10712 \else \:warning{\string\DefOp\string#1\string{#2\string}
10713 can't redefine \string#1}%
10714 \fi
10715 }
10716 \DefOp\HAdvance{Advance}
10717 \DefOp\HMultiply{Multiply}
10718 \DefOp\HDivide{Divide}
10719 >>>
10720
10721
10722
10723 \<general utilities\><<<
10724 \def\ip:op#1#2{\let\mth:op|=#1\let\adv:c|=#2\adv:}
10725
10726 \def\adv:#1{\def\:var{#1}\futurelet\:temp\Advanc:}
10727 \def\Advanc:{\ifx [\:temp \expandafter\Advanc:e
10728 \else \expand:after{\expandafter\adv:c\:var}\fi}
10729 \def\Advanc:e[#1]{\expandafter\adv:c\csname
10730 \expandafter\string\:var[#1]\endcsname}
10731
10732 \def\g:Advance#1{\bgroup \def\:temp{#1}%
10733 \tmp:cnt|=#1\afterassignment\:gplus \mth:op\tmp:cnt}
10734 \def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup}
10735 \def\:Advance#1{\bgroup \def\:temp{#1}%
10736 \tmp:cnt|=#1\afterassignment\:aplus \mth:op\tmp:cnt}
10737 \def\:aplus{\xdef\:temp{\def\expandafter\noexpand\:temp{\the\tmp:cnt}}%
10738 \egroup \:temp}
10739 >>>
10740
10741 \<general utilities\><<<
10742 \def\HAssign{\:ssg\edef}
10743 \def\gHAssign{\:ssg\xdef}
10744
10745 \def\:ssg#1#2{\let\d:fn|=#1\def\:var{#2}\futurelet\:temp\:Assgn}
10746 \def\:Assgn{%
10747 \ifx [\:temp
10748 \expandafter\d:fn\:var[##1]{%
10749 \noexpand\csname \expandafter
10750 \string\:var[##1]\noexpand\endcsname}%
10751 \expandafter\assg:m
10752 \else \afterassignment\assg:v \expandafter \tmp:cnt \fi }
10753
10754 \def\assg:v{\expandafter\d:fn\:var{\the\tmp:cnt}}
10755 \def\assg:m[#1]{%
10756 \def\:temp{\expandafter\d:fn
10757 \csname \expandafter\string\:var[#1]\endcsname{\the\tmp:cnt}}%
10758 \afterassignment\:temp \tmp:cnt}
10759 >>>
10760
10761
10762
10763 \Section{Pushdowns}
10764
10765 \SubSection{Expanded Lists}
10766
10767 \<utilities\><<<
10768 \def\PushStack#1#2{%
10769 \ifx #1\:UnDef \global\let#1|=\empty\fi
10770 {\let\Picture|=\relax \xdef#1{{#2}{#1}}}}
10771 \def\PopStack#1#2{%
10772 \ifx #1\empty \:warning{empty \string\PopStack\string#1\string#2?}%
10773 \global\let#2|=\empty
10774 \else \def\:temp{\:recall#1#2}\expandafter\:temp#1\fi}
10775 \def\:recall#1#2#3#4{\gdef#1{#4}\gdef#2{#3}}
10776 >>>
10777
10778 \SubSection{Control Sequences}
10779
10780 \<utilities\><<<
10781 \def\PushMacro#1{%
10782 \expandafter\ifx \csname c:\string#1\endcsname\relax
10783 \expandafter\gHAssign \csname c:\string#1\endcsname |= 0
10784 \fi
10785 \HAssign\:temp |= \csname c:\string#1\endcsname
10786 \let\:tempa|=#1%
10787 \ifx \:tempa\:UnDef \let\:tempa|=\like:unDef\fi
10788 \global\expandafter\let\csname \:temp\string#1\endcsname |= \:tempa
10789 \expandafter\gHAdvance \csname c:\string#1\endcsname |by 1 }
10790 >>>
10791
10792 \<utilities\><<<
10793 \def\PopMacro#1{%
10794 \expandafter\gHAdvance \csname c:\string#1\endcsname |by -1
10795 \HAssign\:temp |= \csname c:\string#1\endcsname\relax
10796 \ifnum \:temp < 0
10797 \expandafter\gHAssign \csname c:\string#1\endcsname |= 0
10798 \:warning{ignored \string\PopCs\string#1 on empty stack}%
10799 \else
10800 \expand:after{\let#1|=}\csname \:temp\string#1\endcsname
10801 \ifx #1\like:unDef \let#1|=\:UnDef\fi
10802 \fi
10803 }
10804 \def\like:unDef{\:UnDef\:CS}
10805 >>>
10806
10807
10808 \<utilities\><<<
10809 \def\PushConfigure#1{\def\cf:name{#1}\expandafter
10810 \expandafter\expandafter\Push:Configure\expandafter
10811 \meaning\csname c:#1:\endcsname|<par del|>}
10812 \def\PopConfigure#1{\def\cf:name{#1}\expandafter
10813 \expandafter\expandafter\Pop:Configure\expandafter
10814 \meaning\csname c:#1:\endcsname|<par del|>}
10815 \def\do:undef#1->#2|<par del|>{%
10816 \if :#2:\:warning{\string\PushConfigure{\cf:name}?}\fi
10817 }
10818 \catcode`\@=6
10819 \catcode`\#=12
10820 \def\Push:Configure@1|<par del|>{%
10821 \do:undef@1->|<par del|>%
10822 \do:para@1#1|<par del|>\push:config
10823 \do:parb@1#2|<par del|>\push:config
10824 \do:parc@1#3|<par del|>\push:config
10825 \do:pard@1#4|<par del|>\push:config
10826 \do:pare@1#5|<par del|>\push:config
10827 \do:parf@1#6|<par del|>\push:config
10828 \do:parg@1#7|<par del|>\push:config
10829 \do:parh@1#8|<par del|>\push:config
10830 \do:pari@1#9|<par del|>\push:config
10831 }
10832 \def\Pop:Configure@1|<par del|>{%
10833 \do:pari@1#9|<par del|>\pop:config
10834 \do:parh@1#8|<par del|>\pop:config
10835 \do:parg@1#7|<par del|>\pop:config
10836 \do:parf@1#6|<par del|>\pop:config
10837 \do:pare@1#5|<par del|>\pop:config
10838 \do:pard@1#4|<par del|>\pop:config
10839 \do:parc@1#3|<par del|>\pop:config
10840 \do:parb@1#2|<par del|>\pop:config
10841 \do:para@1#1|<par del|>\pop:config
10842 }
10843 \def\do:para@1#1@2|<par del|>@3{@3{a}{@2}}
10844 \def\do:parb@1#2@2|<par del|>@3{@3{b}{@2}}
10845 \def\do:parc@1#3@2|<par del|>@3{@3{c}{@2}}
10846 \def\do:pard@1#4@2|<par del|>@3{@3{d}{@2}}
10847 \def\do:pare@1#5@2|<par del|>@3{@3{e}{@2}}
10848 \def\do:parf@1#6@2|<par del|>@3{@3{f}{@2}}
10849 \def\do:parg@1#7@2|<par del|>@3{@3{g}{@2}}
10850 \def\do:parh@1#8@2|<par del|>@3{@3{h}{@2}}
10851 \def\do:pari@1#9@2|<par del|>@3{@3{i}{@2}}
10852 \catcode`\@=11
10853 \catcode`\#=6
10854 \def\push:config#1#2{%
10855 \if :#2:\else
10856 \expandafter\expandafter\expandafter\ifx \expandafter
10857 \csname \csname#1New:Conf\endcsname\cf:name\endcsname\relax
10858 \:warning{\string\PushConfigure{\cf:name} Failed}%
10859 \else
10860 \expandafter\expandafter\expandafter\PushMacro \expandafter
10861 \csname \csname#1New:Conf\endcsname\cf:name\endcsname
10862 \fi
10863 \fi }
10864 \def\pop:config#1#2{%
10865 \if :#2:\else
10866 \expandafter\expandafter\expandafter\ifx \expandafter
10867 \csname \csname#1New:Conf\endcsname\cf:name\endcsname\relax \else
10868 \expandafter\expandafter\expandafter\PopMacro \expandafter
10869 \csname \csname#1New:Conf\endcsname\cf:name\endcsname
10870 \fi
10871 \fi }
10872 >>>
10873
10874
10875 \Section{Catergory Codes}
10876
10877 We need category code 12, and not 11, because the latter
10878 choise would cause control sequences of unbounded length within
10879 the option \`'\Verbatim-'.
10880
10881 \<general utilities\><<<
10882 \def\no:catcodes#1#2#3{%
10883 \tmp:cnt|=#1
10884 \def\no::catcodes{%
10885 \catcode\tmp:cnt|=#3
10886 \ifnum\tmp:cnt<#2
10887 \advance\tmp:cnt |by 1 \expandafter\no::catcodes
10888 \fi }%
10889 \no::catcodes }
10890 >>>
10891
10892
10893 \Section{/pend:def and /append:def}
10894
10895 The \''\long' below is to allow \''\par' in the second argument.
10896
10897 \<early utilities\><<<
10898 \long\def\append:def#1#2{%
10899 \long\def\:temp{\long\def#1}%
10900 \expandafter\expandafter\expandafter\:temp\expandafter{#1#2}}
10901 \long\def\pend:def#1#2{%
10902 \long\def\:temp{#2}%
10903 \long\def\:tempa{\long\def#1}%
10904 \expandafter\expandafter\expandafter\expandafter
10905 \expandafter\expandafter\expandafter\:tempa
10906 \expandafter\expandafter\expandafter{\expandafter\:temp #1}}
10907 \long\def\pend:defI#1#2{%
10908 \long\def\:tempa{\long\def#1####1}%
10909 \ex:pend{#2}{\expandafter\:temp #1{##1}}}
10910 \long\def\ex:pend#1{\long\def\:temp{#1}%
10911 \expandafter\expandafter\expandafter\expandafter
10912 \expandafter\expandafter\expandafter\:tempa
10913 \expandafter\expandafter\expandafter}
10914 >>>
10915
10916 \<early utilities\><<<
10917 \long\def\append:defI#1#2{%
10918 \long\def\:temp{\long\def#1####1}%
10919 \expandafter\expandafter\expandafter\:temp\expandafter{#1{##1}#2}}
10920 \long\def\pend:defII#1#2{%
10921 \long\def\:tempa{\long\def#1####1####2}%
10922 \ex:pend{#2}{\expandafter\:temp #1{##1}{##2}}}
10923 \long\def\append:defII#1#2{%
10924 \long\def\:temp{\long\def#1####1####2}%
10925 \expandafter\expandafter\expandafter\:temp\expandafter{#1{##1}{##2}#2}}
10926 \long\def\pend:defIII#1#2{%
10927 \long\def\:tempa{\long\def#1####1####2####3}%
10928 \ex:pend{#2}{\expandafter\:temp #1{##1}{##2}{##3}}}
10929 \long\def\append:defIII#1#2{%
10930 \long\def\:temp{\long\def#1####1####2####3}%
10931 \expandafter\expandafter\expandafter
10932 \:temp\expandafter{#1{##1}{##2}{##3}#2}}
10933 >>>
10934
10935 \SubSection{/Odef}
10936
10937 \<general utilities\><<<
10938 \HAssign\def:cnt=0
10939 \def\Odef#1{\gHAdvance\def:cnt |by 1
10940 \edef#1{\noexpand\with:op
10941 \expandafter\noexpand\csname \def:cnt \string#1\endcsname }%
10942 \expandafter\gdef\csname\def:cnt\string#1\endcsname}
10943 \def\with:op#1{\let\n:xt|=#1\futurelet\:temp\wth:opt}
10944 \def\wth:opt{\ifx [\:temp
10945 \expandafter\n:xt\else \expand:after{\n:xt[]}\fi}
10946 >>>
10947
10948 The
10949 \`' \expandafter\gdef\csname\def:cnt\string#1\endcsname}'
10950 allo \`'\global\let#1=#1'.
10951
10952
10953
10954
10955
10956 \Section{/Needs}
10957
10958 \<general utilities\><<<
10959 \def\Log:Needs#1{{\escapechar=`\\\immediate\write-1{\:Neds{#1}}}}
10960 >>>
10961
10962 \<html config util\><<<
10963 \def\c:Needs:{\def\:Needs##1}
10964 \expandafter\def\csname c:Needs-:\endcsname{\def\:Neds##1}
10965 >>>
10966
10967
10968
10969
10970
10971 Put the following in a group so that the temporary variables
10972 will not interfere with other usages.
10973
10974 \<html utilities\><<<
10975 \def\Needs{\bgroup\catcode`\"=12 \cat:Needs}
10976 \def\cat:Needs#1{\def\:temp{-}\def\:tempa{#1}\ifx \:temp\:tempa
10977 \aftergroup\Log:Needs \else \ht:special{t4ht+@\:Needs{#1}}\fi
10978 \egroup}
10979 >>>
10980
10981
10982
10983
10984
10985 \Section{/HCommand and /LinkCommand}
10986
10987
10988
10989
10990
10991
10992 The following is introduced at the end of the style file, to
10993 allow for \''\Contribute{name}{...}' commands that check
10994 for the legality of \`'name'. Otherwise, it
10995 is identical to the above.
10996
10997
10998
10999
11000 \`'\LinkCommand\Frame{FRAME,SRC,ID}
11001 \Frame{a}{A}...\EndFrame
11002 \LinkCommand\FRAME{FRAME,SRC,ID,attr}
11003 \LinkCommand\FRAME{FRAME,SRC,ID,attr,/,sharp}
11004 \FRAME{a}{A}
11005 \FRAME[b 1]{c}{d}'
11006
11007
11008
11009
11010 \<html utilities\><<<
11011 \def\LinkCommand#1#2{\L:Com#1#2,,,,,,|<par del|>{#1}}
11012 \let\:Link|=\Link
11013 \def\L:Com#1#2,#3,#4,#5,#6,#7,#8|<par del|>#9{\def\:tempe{#7}%
11014 \def\:tempa{#2}\def\:tempb{#3}\def\:tempc{#4}\def\:tempd{#6}%
11015 \expandafter\edef\csname
11016 End\expandafter\:gobble\string #9\endcsname{%
11017 \ifx\:tempd\empty \noexpand\HCode
11018 {\Hbrakets</\ifx\:tempa\empty \tag:A\else#2\fi>}\fi }%
11019 \edef\:temp{%
11020 \noexpand\Odef\noexpand#1[####1]####2####3{{%
11021 \def\noexpand\tag:A{\ifx\:tempa\empty\tag:A\else#2\fi}%
11022 \def\noexpand\HREF:{ \ifx\:tempb\empty\HREF:\else#3=\fi}%
11023 \def\noexpand\NAME:{ \ifx\:tempc\empty\NAME:\else#4=\fi}%
11024 \def\noexpand\empty:lnk{\ifx\:tempd\empty\else#6\fi}%
11025 \def\noexpand\:sharp{\ifx\:tempe\empty\:sharp\else#7\fi}%
11026 \noexpand\M:link[####1 #5]{####2}{####3}}}}\:temp
11027 |<add - opt to command|>%
11028 }
11029 >>>
11030
11031
11032 \<add - opt to command\><<<
11033 \expandafter\let\csname \string#1 :\endcsname|=#1
11034 \def#1{\bgroup\LD:Link{#1}\futurelet#1\M:link}
11035 >>>
11036
11037 \<html utilities\><<<
11038 \def\LD:Link#1{%
11039 \def\M:link{\ifx -#1\egroup \def\M:link{\:Link-}\expandafter\gob:lnk
11040 \else \egroup \let\M:link|=\:Link \fi
11041 \csname \string#1 :\endcsname }}
11042 \def\gob:lnk#1-{#1}
11043 >>>
11044
11045 \<html Configure's\><<<
11046 \NewConfigure{Link}[4]{%
11047 \def\empty:lnk{#4}\ifx\empty:lnk\empty\else \def\:sharp{#4}\fi
11048 \let\empty:lnk|=\empty \def\tag:A{#1}%
11049 \def\HREF:{#2}\def\NAME:{#3}}
11050 \Configure{Link}{}{}{}{}
11051 \let\NOHREF:|=\:gobble
11052 >>>
11053
11054
11055
11056 The \`'\let\:Link|=\Link' is to allow for the redefinition of
11057 \`'\Link' and hadling -. An \`'\if !#4!\else' will not work
11058 for the case that \''\empty' is given to \''#4'.
11059
11060
11061 % \`+\Attribute\onSelect{onSelect="loc='#1'"}
11062 % \HCommand\Option{OPTION,\onSelect}+
11063 %
11064 % \<html utilities\><<<
11065 % \def\Attribute#1{%
11066 % \def#1{\expandafter\noexpand\csname\string#1\endcsname}%
11067 % \expandafter\def\csname\string#1\endcsname="##1"}
11068 % >>>
11069
11070
11071
11072
11073 \Section{Loose Ends}
11074
11075
11076
11077 \<general utilities\><<<
11078 \def\g:delete#1{%
11079 \expandafter\expandafter\expandafter\global
11080 \expandafter\let\csname #1\endcsname|=\:UnDef
11081 }
11082 \def\xdef:cs#1{\expandafter\xdef \csname #1\endcsname}%
11083 \def\:csname{\expandafter\noexpand\csname}
11084 >>>
11085
11086
11087 \<general utilities\><<<
11088 \long\def\:gobble#1{}
11089 \long\def\:gobbleII#1#2{}
11090 \long\def\:gobbleIII#1#2#3{}
11091 \long\def\:gobbleIV#1#2#3#4{}
11092 \long\def\:gobbleV#1#2#3#4#5{}
11093 \long\def\:gobbleVI#1#2#3#4#5#6{}
11094 \long\def\:gobbleVIII#1#2#3#4#5#6#7#8{}
11095 >>>
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107 \ifHtml[\HPage{more}\Verbatim
11108 change CutAt{a,b} to CutAt{a,/b} and add exercises here.
11109 \EndVerbatim\EndHPage{}]\fi
11110
11111
11112 \ifHtml[\HPage{more}\Verbatim
11113
11114 In TeX4ht, \''\begin{...}' and \''\end{...}' are redefined
11115 to \''\SaveEverypar\begin{...}' and \''\end{...}\RecallEverypar'
11116 so it is pointless to directly deal with paragraph breaks
11117 and saving. Since the saving and recalling are global
11118 operations (in a pushdown fashion), the following
11119 redefine the saved environment to eliminate
11120 paragraph breaks after the environment.
11121
11122
11123 WE HAVE here a problem if someone goes directly, e.g., for
11124 \''\quotation...\endquotation' instead of
11125 \''\begin{quotation}...\end{quotation}'. On the other hand,
11126 LaTeX doesn't mention the first case as an option.
11127 \EndVerbatim\EndHPage{}]\fi
11128
11129
11130
11131 \<html utilities\><<<
11132 \ifx\tmp:dim\:UnDeF \csname newdimen\endcsname\tmp:dim\fi
11133 >>>
11134
11135
11136
11137
11138 \SubSection{Protection}
11139
11140 Fonts in sectioning titles can be a problem, when delivered to tocs. Hence,
11141 we need to protect them from early expansions.
11142
11143 Without the space, we can have in toc file expanded control
11144 sequences (e.g., \`'\protect\tt x' becomming \''\ttx').
11145
11146 The following is for preveting expansions in edef environments while
11147 preserving the meaning within standard environments. We need it, in
11148 particular, for writing into toc and for (i.e., HPage?) CutAt when
11149 titles of sections are referenced.
11150
11151 \<html utilities\><<<
11152 \def\pr:tc{\relax}
11153 \let\prOteCt|=\relax
11154 \def\Protect{%
11155 \let\prOteCt|=\pr:tc
11156 \ifx \prOteCt\pr:tc \let\prOteCt|=\relax
11157 \else \noexpand\Protect\expandafter\noexpand\fi
11158 }
11159 >>>
11160
11161 LaTeX has \`'\def\@unexpandable@protect{\noexpand\protect\noexpand}' to be included in immediate defines.
11162
11163 This is a variant of \`'\protected@edef' from LaTeX. We cannot use it directly here, so I've made a copy.
11164
11165 \<html utilities\><<<
11166 \def\:unexpand:protect{\noexpand\protect\noexpand}
11167 \def\:restore:protect{\let\protect\orig:protect}
11168 \def\protected:edef{%
11169 \let\:orig:protect\protect%
11170 \let\protect\:unexpand:protect%
11171 \afterassignment\:restore:protect%
11172 \edef%
11173 }
11174
11175 >>>
11176
11177 \Section{Tags}
11178
11179 \SubSection{Html}
11180
11181
11182 The following create \`'<A HREF="aav.\:html#Q1-5-1"
11183 NAME="Q2-5-1">.........</A>' in the table of contents and
11184 \`'<A HREF="a.\:html#Q2-5-1" NAME="Q1-5-1">..........</A>' in the
11185 title. The address \`'Qi-j-m' tells that we deal with tag of type
11186 \`'Qi', in file \`'j', for title \`'m' in the file.
11187
11188
11189
11190 \<toc tag\><<<
11191 Q>>>
11192
11193
11194 The prefix \`'\<toc tag\>' is required for distinguishing the tocs tags
11195 from other tags to allow for selective loading of cross references
11196 when communicating toc info.
11197
11198
11199
11200
11201
11202 \<csname: file name -> file id\><<<
11203 FN >>>
11204
11205
11206
11207
11208 \SubSection{Standard}
11209
11210
11211 \FreeCode\<tag of Tag\> % to avoid duplication
11212
11213 \<tag of Tag\><<<
11214 cw:>>>
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224 \<File tag\><<<
11225 (L >>>
11226
11227
11228
11229
11230 \<next HPage tag\><<<
11231 |<auto tag|>N >>>
11232
11233
11234
11235 \<bib tag\><<<
11236 |<auto tag|>B >>>
11237
11238
11239
11240 \SubSection{Internal}
11241
11242 \<tag MarkCurFile\><<<
11243 cf: >>>
11244
11245
11246
11247
11248
11249
11250 \Chapter{wripro.tex: HTML Stuff Shared by TeX4ht and AlProTex}
11251
11252
11253
11254 TeX4ht writes its tags into \`+.ref+ files until ProTex takes over
11255 and gets the tags into \`+.xref+ files.
11256
11257
11258
11259
11260 \<check that TeX4ht is not loaded after protex\><<<
11261 \def\:warning#1{\writesixteen{l.\the\inputlineno\space
11262 --- TeX4ht warning --- #1 ---}}
11263 \ifx \:ShowCode\:UnDeF \else
11264 \:warning{|<TeX4ht name|>.sty loaded after ProTeX?}
11265 \fi
11266 >>>
11267
11268
11269
11270 \`'\NewHaddr' provides an address that encodes a location
11271 together with its file name.
11272
11273 Is the followint true? We can have for hadresses
11274 \`'\Link{Haddr}{} \Link{}{Haddr}' without worrying about
11275 extracting the file names as long as we use HAddress we get from
11276 \`'\NewHaddr'!!! That is, in \`'\Link'the [] option is needed
11277 just for external files compiled separately. WELL, it seems to be true
11278 for any tags because they are resolved indirectly through thr REF
11279 file!!!! Great , how could I have forgotten about this pearl?
11280
11281
11282 AlProTex used something like the following.
11283 Create saving at direct programming of HREF and HTAG in \`'<A>' coomands, because we don't need now Ref/Tag intermediates.
11284
11285 \<html utilities\><<<
11286 \def\NewHaddr#1{\html:addr \let#1|=\last:haddr}
11287 \def\GetHref#1{\expandafter\get:href#1-}
11288 \def\GetHname#1{\expandafter\get:htag#1-}
11289 \ifx \make:addr\:UnDeF
11290 \def\make:addr#1{|<tail for file name|>#1} \fi
11291 >>>
11292
11293 \`'make:addr' may already be defined from AlProTex. It had\''\space' after \`'#1' that has been removed (see AlProTex).
11294
11295
11296 \<html utilities\><<<
11297 \def\FileNumber{\file:id}
11298 \def\c:XrefFile:#1{\def\aXrefFile{#1}}
11299 >>>
11300
11301
11302 \openin15= wripro.tex
11303 \ifeof15 \closein15
11304 \writesixteen{*********************************}
11305 \writesixteen{* - error - missing wripro.tex *}
11306 \writesixteen{*********************************}
11307 \else \closein15 \input wripro.tex \fi
11308
11309 \<warnings for missing /Link\><<<
11310 \ifx \:::HRefTag\:UnDef\else
11311 \pend:defII\:::HRefTag{%
11312 \if \relax##1\relax\else
11313 \expandafter\ifx\csname cw:)Q\aXrefFile ##1\endcsname\relax
11314 \:warning{\string\Link{##1}?}\csname a:?Link\endcsname
11315 \fi\fi }
11316 \fi
11317 >>>
11318
11319 \<cross references\><<<
11320 \NewConfigure{?Link}{1}
11321 >>>
11322
11323
11324 \Chapter{Background Material}
11325 \Link[http://www.diku.dk/students/turtle/trick.html]{}{}Tricks for TeX
11326 and LaTeX\EndLink{} (Collected by Peter M\o{}ller Neergaard)
11327
11328
11329
11330 %------------------------------------------------------
11331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11332
11333 \<TeX4ht name\><<<
11334 tex4ht>>>
11335
11336
11337
11338
11339 %-------------------------------------------------------
11340 \openin15= wripro.tex
11341 \ifeof15 \closein15
11342 \writesixteen{***********************************}
11343 \writesixteen{* -- error -- missing wripro.tex -*}
11344 \writesixteen{* Making a broken tex4ht.sty file.*}
11345 \writesixteen{* Don't use this tex4ht.sty file! *}
11346 \writesixteen{***********************************}
11347 \else \closein15 \fi
11348 %-------------------------------------------------------
11349
11350 \OutputCode\<tex4ht\>
11351
11352
11353 \bye