Chapter 14
Decorated Symbols

   14.1 Htf Classes: Requesting BackEnd Fonts through /specials
      Pausing
      Configurations
   14.2 New Accents
      Screening
   14.3 Old Accents
      Accents through ‘accents’ Configurations
      Foundation for Accents
      Getting the Html Replacement
   14.4 End-of-Line Ch Characters
   14.5 Symbols
      Symbols

14.1 Htf Classes: Requesting BackEnd Fonts through /specials

<..font config util..>
 \NewConfigure{htf}[9]{{%
   \tmp:cnt=#1 \ifnum \tmp:cnt>255  \:warning{Code larger than
               255 in \string\Configure{htf}}\else
   \ht:special{t4ht;|\ifnum \tmp:cnt<10 00\else
     \ifnum \tmp:cnt<100 0\fi\fi
     \the\tmp:cnt#2#3#2#4#2#5#2#6#2#7#2#8#2#9#2\the\tmp:cnt}%
   \fi}}
 -_-_-

A \%x requests character code in hexadecimal representation.

\Configure{htf} is essentially a configuration on fonts, where even cases, for instance, the \special{t4ht;|004...} extra independent information for characters. Odd cases like \special{t4ht;|003...}, on the other hand, are addition to the IMG and not an independent info !!!

Pausing

<..font config util..>+
 \def\NoFonts{\ht:special{t4ht;8}}
 \def\EndNoFonts{\ht:special{t4ht;9}}
 -_-_-

Nesting is allowed.

Configurations

Code for calls made from htf fonts. Should start with three digits defining a number smaller than 256. Odd numbers apply to gifs, and even to text. The odd are intended for insertion into IMG marks, the odd are not used yet.

The character part is prented for codes that are not given in cases of characters and image-characters, respectively. Code 000 is created to groups of non image characters, and the codes 002, 004, 006, add extras to individual characters. The od codes deal only with specific characters, not groups.

The corresponding formatting instructions in the css file are determined in the ‘Font’ option within the perl script.

<..font config util..>+
 \NewConfigure{FontCss}[2]{\def\a:FontCss:{#1}\def\a:FontCssPlus:{#2}}
 -_-_-

<..font config util..>+
 \NewConfigure{htf-css}[2]{{%
    \def\:temp##1<.par del.>{\def\:tempa{##1}}%
    \afterassignment\:temp\tmp:cnt=0#1<.par del.>%
    \def\:temp{\Configure{Needs}}%
    \ifx  \:tempa\empty
        \expandafter\:temp\expandafter{\a:FontCss:}\Needs{("#1"): #2}%
    \else
        \expandafter\:temp\expandafter{\a:FontCssPlus:}\Needs{#1 #2}%
    \fi}}
 \NewConfigure{htf-attr}[2]{{%
    \Configure{Needs}{##1}%
    \Needs{Font\string_css\string_base: #1Font\string_css\string_mag: #2}}}
 -_-_-

\NewConfigure{htf-css}{number}{...} for a class; \NewConfigure{htf-css}{not-number}{...} for a htf font.

\Configure{htf}{even}{+}{open}{name}{size}{mag}{ord}{ch}{end}{gif-id}

\Configure{htf}{odd}{+}{open}{alt}{class}{size}{mag}{ord}{end}: mag and ord must be integer patterns.

\Configure{htf-css}{4}{.underline{text-decoration:underline; }} is alredy covered.

HOW \Configure{htf-css}{4}{.small-caps{font-variant: small-caps; }} differs from \Css{.small-caps{font-variant: small-caps; }}? The latter is alway introduced into the css file, wheras the earlier only conditionally when the font/class is in use.

We have

\Configure{htf} 
     {odd-for-img-chr} 
     {distinguished delimiter ch+id} 
     {prefix for file name, if the latter is desired} 
     {prefix for alt, if the latter is desired} 
     {c-template, if family name is desired} 
     {c-template, if font size is desired} 
     {c-template, if font mag is desired} 
     {c-template, if ch ord is desired} 
     {close of tag} 
\Configure{htf} 
     {even-for-reg-chr} 
     {distinguished delimiter ch+id} 
     {prefix} 
     {c-template, if family name is desired} 
     {c-template, if font size is desired} 
     {c-template, if font mag is desired} 
     {c-template, if ch ord is desired} 
     {postfix} 
     {closing tag} 

The id is to be used in Needs fo associating styles to the character decorations. Also, due to the id, we can assign to the same code of font different styles. [example]

Newer:

Css: TD.caption{white-space: nowrap; } 
Font("cmex","10","100") 
Font("cmmi","10","100") 
Font("cmmi","5","100") 
Font("cmmi","7","100") 
Font("cmr","10","100") 
Font("cmr","5","100") 
Font("cmr","7","100") 
Font("cmsy","10","100") 
Font("cmsy","7","100") 
Font("cmti","10","100") 
Font("cmtt","10","100") 
Font_Class(1,""): <IMG SRC=""ALT=""CLASS="%s%s-%d--%x"> 
Font_Class(3,"mva"): <IMG SRC=""ALT=""CLASS="%s-%d--%x"ALIGN="MIDDLE"> 
Font_Class(6,"ul"): <SPAN CLASS="underline"></SPAN> 
Font_Css("sc"): .small-caps{font-variant: small-caps; } 
Font_Css("ul"): .underline{text-decoration:underline; } 

The Font(...) indicates the fonts in use; it’s format is determined by the system variable LGFNT, and can be changed within the env file through a ‘f’ flagged field. The indicated fonts are used for deciding which entries in htf.sty should be introduced into the css file.

The Font_Class(...) indicates the classes in use within the fonts; it’s format is determined by the system variable LGCLS, and can be changed within the env file through a ‘c’ flagged field.

The Font_Css is a contribution from the TeX file, from \Configure{htf-css}{...} commands. It overides info found in htf.sty. Its format can be changed by \Configure{FontCss}{...##1...}, before the \Preamble command.

The Css is a contribution from the TeX file, from \Css{...} comamnds that preced the \CssFile command. Its format can be changed by \Configure{Css}{...##1...}, before the \Preamble command.

The \special{t4ht;,} prevents notification to the log file of the change requested by \Configure{htf}.

\Configure{htf-css}{cmmi}{font-style: italic;} produces Font_Css_Plus cmmi font-style: italic; and that appears also in htf.sty. The following are already in htf.sty.

14.2 New Accents

<..accents..>
 \:CheckOption{new-accents}     \if:Option
    <.new accents.>
 \else
    <.tools for accents.>
    <.old accents.>
 \fi
 -_-_-

Some accents of TeX are defined through commands of the form \accent <number> <char>, and some throught macros (e.g., \b, \c, and \d). Moreover,the \accent <number> <char> reduces to \char <number>, whenever <char> doesn’t immediately follows <number> (however, font changes, etc, are possible in between).

We can’t decide the content of accented charaters without looking at the htf fonts. The accented characters of the source (la)tex files may go through transformations due to \uppercase and \lowercase operations (e.g., \uppercase \’a).

<..new accents..>
 \def\:temp{\leavevmode\ifx \d:mathaccent\empty
     \else \ht:special{t4ht\string~>1\d:mathaccent}\fi
     \ht:special{t4ht*\string^m}\o:mathaccent:}
 \HLet\mathaccent=\:temp
 \def\:temp{\leavevmode\ht:special{t4ht*\string^t}\o:accent:}
 \HLet\accent=\:temp
 \NewConfigure{accent}[6]{\ht:special{t4ht*\string^t#1#2#1#3#1#4#1#5#1#6}}
 \NewConfigure{mathaccent}[6]{\ht:special{t4ht#1\string
   ^m#1#2#1#3#1#4#1#5#1}\edef\d:mathaccent{#6}}
 \let\d:mathaccent=\empty
 \NewConfigure{accented}[6]{\ht:special
      {t4ht*\string^a#1#2#1#3#1#4#1#5#1#6}}
 \NewConfigure{accenting}[3]{\ht:special{t4ht*\string^i#1#2#1#3#1#1}}
 -_-_-

Screening

The following feature is used as in

\Configure{HAccent}\hat{AEIOUaeiou{}}{\Picture+{}}{\EndPicture}

and it screens which characters are allowed to use the native definitions of the accents, and which one the commands tailored for the hooks.

<..new accents..>+
 \NewConfigure{HAccent}[1]{\pic:Accent#1}
 \def\pic:Accent#1#2#3#4{\edef\:tempb##1{{\expandafter\:gobble\string#1}}%
    \pend:defI\:tempb{\choose:accent{####1}#2\relax<.par del.>}%
    \append:defI\:tempb{{#3}{#4}}%
    \expandafter\let\csname \string#1:\endcsname=\:tempb
    \edef\:tempb{\noexpand\Protect\noexpand\acc:nm{\string#1}}%
    \HLet#1=\:tempb}
 \def\acc:nm#1{\csname \string#1:\endcsname}
 -_-_-

The following sub-utilities iteratively search the dictionary to check whether the parameter is known.

<..new accents..>+
 \def\choose:accent#1{\def\:accented{#1}\cs:accent}
 \def\realx:par{\relax}
 \def\cs:accent#1{\def\:tempa{#1}%
    \ifx \:tempa\realx:par \expandafter\pic:accent
    \else
        \ifx \:tempa\:accented
             \expandafter\expandafter\expandafter\nopic:accent
        \else \expandafter\expandafter\expandafter\cs:accent\fi
    \fi}
 \def\pic:accent#1<.par del.>#2#3#4{%
    #3\nopic:accent<.par del.>{#2}{}{}#4}
 \def\nopic:accent#1<.par del.>#2#3#4{\expandafter\expandafter
    \csname o:#2:\endcsname\expandafter{\:accented}}
 -_-_-

14.3 Old Accents

For entries not in the given font tables (not specified in the \Configure{accent}), problems can arise for cases such as csname \ifmmode m\else t\fi :\acn:no\endcsname{#2} and \hat{\char o} when they don’t go into pictures.

Accents through ‘accents’ Configurations

The \Configure{accent}\^\hat{{A-in}{A-out}{B-in}{B-out}...{}{last-out}} {do-found} {do-not-found} defines the text accent \^ and math accent \hat. In cases that the text or math accent has no counter math accent, we fake \null for the math part.

When \hat{foo} is encountered, a search is made for an ??-i that equals foo in the given accent table. If found, do-found is executed; otherwise, do-not-found is executed. The do-found can reference the ??-out through #1. The do-not-found can reference the old definition of \hat through #1 and the foo through #2.

Foundation for Accents

<..tools for accents..>
 \NewConfigure{accent}[5]{%
    \expandafter\ifx \csname x:\string#2\endcsname\relax
       \expandafter\edef
          \csname x:\string#2\endcsname{\accent:cnt}%
       <.save old accent comamnd.>%
       <.new accent command.>%
       \Advance:\accent:cnt by 1
    \fi
    \edef\:tempa{\csname x:\string#2\endcsname}%
    <.get accent config.>%
    }
 \def\accent:cnt{0}
 -_-_-

The \csname t:\accent:cnt\endcsname part is for the text mode, and the \csname m:\accent:cnt\endcsname part is for math mode.

<..save old accent comamnd..>
 \expandafter\let\csname t:\accent:cnt\endcsname=#1%
 \expandafter\let\csname m:\accent:cnt\endcsname=#2%
 -_-_-

<..new accent command..>
 \edef\:temp{\ifx \accent:def\:UnDef \noexpand\def \else
      \noexpand\accent:def \fi
    \noexpand\:temp{\noexpand\ac:pc{\accent:cnt}}%
    \noexpand\HLet\noexpand#1=\noexpand\:temp
    <.hook accent table.>}%
 \:temp
 \def\:temp{#1}\def\:tempa{#2}\ifx \:temp\:tempa \else \HLet#2=#1\fi
 -_-_-

The search starts at \ac:pc{\accent:cnt}. The accent table is stored in \csname\accent:cnt :ac\endcsname. The table is searched by \acpc:, which puts the result in \end:accent.

<..hook accent table..>
 \noexpand\pend:defI
   \noexpand\:accnts{\noexpand\ifnum ########1=\accent:cnt
   \noexpand\expandafter \noexpand\acpc:
   \expandafter\noexpand\csname\accent:cnt :ac\endcsname
   \noexpand\expandafter \noexpand\end:accent \noexpand\fi}%
 -_-_-

The pend above is just: \pend:defI\:accnts{\ifnum ########1=\accent:cnt \expandafter\acpc: \csname\accent:cnt :ac\endcsname \expandafter\end:accent\fi}

<..get accent config..>
 \def\:temp{#3}\ifx \:temp\empty \else
   \expandafter\def\csname \:tempa :ac\endcsname{#3}
 \fi
 \long\def\:temp##1##2{#4#5}\ifx \:temp\:gobbleII \else
   \expandafter\def\csname C:\:tempa\endcsname##1{#4}%
   \expandafter\def\csname MT:\:tempa\endcsname##1##2{#5}%
 \fi
 -_-_-

\acp:c might go to the aux file of latex, where : has standard cat code. Hence, the the protection on \csname and not the command itself (as was the case at the beginning).

<..old accents..>
 \def\ac:pc{\Protect\csname acp:c\endcsname}
 \def\acp:c#1#2{{\def\acn:no{#1}\def\:temp{#2}\ifx \:temp\empty
       <.accent on empty arg.>%
    \else <.tabacckludge.>%
       \def\ac:pc{\ac:nt{#2}}\a:cpc{#1}\fi }}
 \def\ac:nt{\csname \ifmmode m\else t\fi :\acn:no\endcsname}
 -_-_-

<..accent on empty arg..>
 \ac:nt{}%
 -_-_-

<..old accents..>+
 \def\Ac:nt{\edef\:temp{\ifx \EndPicture\:UnDef
       \def\noexpand\ac:pc{\noexpand\Protect \noexpand\acp:c}%
       \expandafter\noexpand \csname MT:\acn:no\endcsname
   \fi
   \expandafter\noexpand
   \csname\ifmmode m\else t\fi :\acn:no\endcsname}\:temp
 }
 -_-_-

The second line above is for nested accents in nonpictorial environments (e.g., \hat{\hat{x}}). Otherwise, we are getting an infinite loop because by now \ac:pc has been modified to equal \Ac:nt.

\def\acp:c#1#2{{\def\:temp{#2}\def\ac:pc{\accent#1 #2}\a:cpc{#1}}}

We can’t have braces around #2 in \accent#1 #2 because they get TeX [confused] on the exact location of the mark.

<..old accents..>+
 \def\a:cpc#1{%
   \ifx \EndPicture\:UnDef
      \def\AC:PC{<.default accent.>%
      }%
      \:accnts{#1}\empty
   \else   \ac:pc  \fi  }
 -_-_-

The \empty is for the skiping over the leftover of the fonts, once a font is found. It is used in \end:accent.

<..tools for accents..>+
 \def\end:accent#1\empty{}
 \def\:accnts#1{}
 -_-_-

Latex has \def\@tabacckludge#1{\csname #1\endcsname}.

<..tabacckludge..>
 \let\@tabacckludge=\:tabacckludge
 -_-_-

Getting the Html Replacement

<..old accents..>+
 \def\acpc:#1#2{%
    \def\:tempa{#1}\ifx \:tempa\empty
       <.char/pic accent.>%
    \else \ifx \:tempa\:temp  \let\AC:PC=\empty
              <.accent for table entry.>\fi
          \expandafter\acpc:
    \fi}
 -_-_-

/:temp below is the parameter of the accent, and it can be empty (e.g. \^{}). If the parameter is empty, the accent is just a character, given in the last parameter of \acpc:. The recursive macro \acpc: eats two parameters at a time, and it terminates when the first in the pair of parameters is empty.

<..char/pic accent..>
 \ifx \:temp\empty
    \def\:tempa{#2}\ifx \:tempa\empty  \AC:PC
    \else <.accent for ?.>\fi
 \else \AC:PC \fi
 -_-_-

<..accent for ?..>
 \csname \ifmmode m\else t\fi :\acn:no\endcsname{#2}%
 -_-_-

<..accent for table entry..>
 \csname C:\acn:no\endcsname{#2}%
 -_-_-

The else \csname \ifmmode m\else t\fi :\acn:no\endcsname{} is for the case that the parameter is empty, in which case the accent needs to be converted into a stand alone character (e.g., \={}).

Default is needed for symbols not found in initiation tables.

<..default accent..>
 {\let\AC:PC=\ACP:C  \let\ac:nt=\Ac:nt \ac:pc}%
 -_-_-

The \let\AC:PC=\ACP:C above is for recursive cases like in $A\hat{B\hat{x}}$.

<..config nonspecified accent..>
                    \def\:temp##1##2{#5#6}\ifx \:temp\:gobbleII \else
 \expandafter\def\csname C:#3\endcsname##1{#5}%
 \expandafter\def\csname MT:#3\endcsname##1##2{#6}%
                    \fi
 -_-_-

14.4 End-of-Line Ch Characters

<..html utilities..>+
 \def\Hnewline{\:newlnch}
 -_-_-

Without the following, we get in toc things like ^^J that don’t go together with catcode 13 for ^.

<..no Hnewline..>
 \let\:newlnch=\space
 -_-_-

14.5 Symbols

Check that all the symbols belong to TeX and LaTeX

<..shared config..>+
 \def\HChar#1{{\leavevmode \ifmmode\else\expandafter\immediate\fi
 \ht:special{t4ht@#1}\ifnum #1>-1 \a:HChar\fi}}
 \NewConfigure{HChar}{1}
 \Configure{HChar}{x}
 -_-_-

There is a boundary case of \HChar{0} we didn’t handle above. Do we want to take care of it?

\HChar{i} inserts the character code i, with its font info, if i is positive. If i is negative, the font info is not included. The first case is obtained with a special that inserts its content directly, and the second by a special sending its content as override on top of the next character.

The \Configure tells from where the font info comes. With the presence of regular and pictorial symbols, we should be careful not to get here into a mess.

Without checking for the math mode the immediate becomes problematic in math mode (why?).

\documentclass{article} 
\begin{document} 
$\_$ vs \_ 
\end{document} 

Same problem for tables (why?)

\documentclass{article} 
\begin{document} 
\begin{tabular}{l} \_ \end{tabular} 
\end{document} 

Symbols

<..shared config..>+
 \NewConfigure{@Picture}[1]{\def\a:@Picture{#1}}
 \let\a:@Picture=\:gobble
 -_-_-