9.35 tex4ht

  9.35.1 Subdirectories for Images

<..configure html4 tex4ht..>+
 <.config tex4ht.>
 <.title for hypertext page.>
 <.tex4ht doctype.>
-_-_-

<..config tex4ht..>+
 \:CheckOption{NoFonts} \if:Option
    \NoFonts
 \else
    \Log:Note{to ignore CSS font decoration, use the ‘NoFonts’
        command line option}
 \fi
-_-_-

<..config tex4ht..>+
 \Configure{HVerbatim+}{\z@}{\:nbsp}
 \:CheckOption{jpg} \if:Option
    \Configure{Picture}{.jpg}
 \else
    \Log:Note{for jpg bitmaps of pictures, use the ‘jpg’
        command line option. <.ch bitmaps.>}
 \fi
 \:CheckOption{gif} \if:Option
    \Configure{Picture}{.gif}
 \else
    \Log:Note{for gif bitmaps of pictures, use the ‘gif’
        command line option. <.ch bitmaps.>}
 \fi
-_-_-

<..ch bitmaps..>
 (Character bitmaps are controled only by ‘g’ records of tex4ht.env and ‘-g’
 switches of tex4ht.c)
-_-_-

<..configure html4 tex4ht..>+
 <.tex4ht HTML.>
-_-_-

<..configure html4 tex4ht..>+
 \newif\ifHCond
 <.global HtmlPar.>
 \Css{p.noindent { text-indent: 0em }}
 \Css{td p.noindent { text-indent: 0em; margin-top:0em; }}
 \Css{p.nopar { text-indent: 0em; }}
 \Css{p.indent{ text-indent: 1.5em }}
 \NewConfigure{!P}[1]{\expandafter\concat:config\csname a:!P\endcsname{#1}}
 \expandafter\let\csname a:!P\endcsname=\relax
 \Configure{!P}{}
-_-_-

<..global HtmlPar..>
 \Configure{HtmlPar}
   {\EndP\HCode{<.show input line no.><p \csname a:!P\endcsname
          class="no\ifHCond par\else indent\fi" \a:LRdir>}}
   {\EndP\HCode{<.show input line no.><p \csname a:!P\endcsname
         class="\ifdim \parindent=\z@ no\fi indent" \a:LRdir>}}
   {\:xhtml{\Tg</p>}}
   {\:xhtml{\Tg</p>}}%
-_-_-

<..configure html4 tex4ht..>+
 \NewConfigure{!BODY}[1]{\expandafter\concat:config
   \csname a:!BODY\endcsname{#1}}
 \expandafter\let\csname a:!BODY\endcsname=\relax
 \Configure{!BODY}{}
-_-_-

<..configure html4 tex4ht..>+
 \NewConfigure{LRdir}[1]{\concat:config\a:LRdir{#1}}
 \let\a:LRdir=\relax
 \Configure{LRdir}{}
-_-_-

<..configure html4 tex4ht..>+
 \Configure{crosslinks+}
    {\IgnorePar\EndP\HCode{<.show input line no.>%
                           <div class="crosslinks"><p class="noindent">}}
    {\HCode{</p></div>}\par\ShowPar}
    {\IgnorePar\EndP\HCode{<.show input line no.>%
                           <div class="crosslinks"><p class="noindent">}}
    {\HCode{</p></div>}\par\ShowPar}
 \Css{@media print {div.crosslinks {visibility:hidden;}}}
 
 \Configure{halignTR}
    {\HCode{ style="vertical-align:baseline;"}}
 \Configure{halignTBL}
 % %   {t}{\HCode{ valign="top"}}
 % %   {b}{\HCode{ valign="baseline"}}
 % %   {c}{\HCode{ valign="middle"}}
     {}
 
 \Configure{halign}
    {\EndP
     \PushStack\Table:Stck\TableNo
     \gHAdvance\Next:TableNo by 1
     \global\let\TableNo=\Next:TableNo
     \halignTB{halign}}
    {\HCode{</table>}\PopStack\Table:Stck\TableNo}
    {\HCode{<tr \Hnewline}\halignTR\HCode{ id="TBL-\TableNo-\HRow-">}}
    {\HCode{</tr>}}
    {<.td save EndP.> \HCode{<td \ifnum \HMultispan>1 colspan="\HMultispan"\fi}%
    \halignTD \HCode{\Hnewline id="TBL-\TableNo-\HRow-\HCol">}\ShowPar\par}
    {\ifvmode \IgnorePar \fi \EndP\HCode{</td>}<.td recall EndP.>}
 \Configure{pic-halign}{}
 \Configure{halignTB<>}{halign}{\HCode{id="TBL-\TableNo" class="halign"\Hnewline }<>}
 \HAssign\Next:TableNo=0 \global\let\TableNo=\Next:TableNo
-_-_-

The following should be just under LaTeX.

<..configure html4 tex4ht..>+
 \Configure{halignTD} {}{}
    {<}{\HCode{ style="white-space:nowrap; text-align:left;"}}
    {-}{\HCode{ style="white-space:nowrap; text-align:center;"}}
    {>}{\HCode{ style="white-space:nowrap; text-align:right;"}}
    {^}{\HCode{ style="vertical-align:top; white-space:nowrap;"}}
    {=}{\HCode{ style="vertical-align:baseline; white-space:nowrap;"}}
    {|}{\HCode{ style="vertical-align:middle; white-space:nowrap;"}}
    {_}{\HCode{ style="vertical-align:bottom; white-space:nowrap;"}}
    {p}{\HCode{ style="white-space:wrap; text-align:left;"}\Protect\a:HColWidth}
    {m}{\HCode{ style="white-space:nowrap; text-align:left; vertical-align:middle;"}}
    {b}{\HCode{ style="white-space:nowrap; text-align:left; vertical-align:baseline;"}}
    {}
 \NewConfigure{HColWidth}{1}
 \Configure{HColWidth}{}
-_-_-

The following code allows width specifications of p-columns of tables through the command line option ‘p-width’.

The command line option activates a configuration similar to the following ones.

Try the above examples with the following source under different font sizes in the browser.

1 2 3 1 2 3

x

1 2 3 1 2 3

The configuration provided through the command line option ‘p-width’ takes to some degree into account the size of fonts in use within the HTML displays. Yet, not all browsers react properly to the size changes.

<..configure html4 latex..>+
 \:CheckOption{p-width} \if:Option
   <.10 em constant.>
   \Configure{HColWidth}
      {\tmp:dim=\HColWidth \divide\tmp:dim by \ten:Em\relax
       \tmp:dim=10\tmp:dim
       \Css{\#TBL-\TableNo-\HRow-\HCol
                    {width:\expandafter\x:Em \the\tmp:dim em;}}}
 \else
    \Log:Note{for width specifications of tabular p entries, use
        the ‘p-width’ command line option or a configuration similar
        to \string\Configure{HColWidth}{\string\HCode
        { style="width:\string\HColWidth"}}}
 \fi
-_-_-

<..configure html4 tex4ht..>+
 <.img src dir.>
 \Configure{IMG}
   {\ht:special{t4ht=<img\Hnewline src="<.a:imgdir.> }}
   {\ht:special{t4ht=" alt="}}
   {" }
   {\ht:special{t4ht=" }}
   {\ht:special{t4ht=\xml:empty>}}
 \Css{a img { border-top: 0; border-left: 0; border-right: 0; }}
-_-_-

A change from the - in the % patterns of c to, say @, requires a Font_hyphen: @ in the .lg file for a match in the css output of t4ht.

<..configure html4 tex4ht..>+
 \Configure{htf}{0}{+}{<span\Hnewline
    class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}
 <.img src dir.>
 \Configure{htf}{1}{+}{<img\Hnewline
    src="<.a:imgdir.> }{" alt="}{" class="}{\%s}{-\%d}{x-x-\%x}{" />}
 \Configure{htf}{3}{+}{<img\Hnewline
    src="<.a:imgdir.> }{" alt="}{" class="\%s-}{\%s}{-\%d}{x-x-\%x}%
    {" style="text-align:middle" />}
-_-_-

<..configure html4 tex4ht..>+
 \Configure{htf}{4}{+}{<span\Hnewline
    class="}{}{}{}{}{small-caps">}{</span>}
 \Configure{htf}{6}{+}{<u\Hnewline
    class="}{}{}{}{}{underline">}{</u>}
-_-_-

<..configure html4 tex4ht..>+
 \Configure{htf}{8}{+}
    {<sup class="htf">}{}{}{}{}{}{</sup>}
 \Configure{htf}{10}{+}
    {<span class="htf-cmbx">}{}{}{}{}{}{</span>}
 \Configure{htf}{12}{+}
    {<span\Hnewline class="htf-calligraphy">}{}{}{}{}{}{</span>}
 \Configure{htf}{14}{+}
    {<span\Hnewline class="htf-italic">}{}{}{}{}{}{</span>}
 \Configure{htf}{16}{+}
    {<span\Hnewline class="htf-bold">}{}{}{}{}{}{</span>}
 \Configure{htf}{18}{+}
    {<span\Hnewline class="htf-calligraphy-bold">}{}{}{}{}{}{</span>}
 \Configure{htf}{20}{+}
    {<span\Hnewline class="htf-flip-hor">}{}{}{}{}{}{</span>}
 \Configure{htf}{22}{+}
    {<sub class="htf">}{}{}{}{}{}{</sub>}
 \Configure{htf}{24}{+}{<span\Hnewline
    class="}{}{}{}{}{small-caps">}{</span>}
 \Configure{htf-css}{4}{.small-caps{font-variant: small-caps; }}
 \Configure{htf-css}{10}{.htf-cmbx {font-weight: bold; font-style:normal;}}
 \Configure{htf-css}{12}{.htf-calligraphy {font-family:cursive}}
 \Configure{htf-css}{14}{.htf-italic {font-style: italic;}}
 \Configure{htf-css}{16}{.htf-bold {font-weight: bold;}}
 \Configure{htf-css}{12}{.htf-calligraphy-bold {font-family:cursive ;
    font-weight: bold; }}
-_-_-

\Configure{htf}{0}{+}{<!--span  class="}{\%s}{-\%s}{--\%d}{}{"-->}{<!--/span-->} caused netscape to loose spaces between comments.

<..configure html4 tex4ht..>+
 \Configure{@Picture}{\:class}
 \def\:class#1{ class="#1"
        \expandafter\ifx\csname a:@#1\endcsname\relax\else
        \csname a:@#1\endcsname\fi}
-_-_-

<..contribute to picmath of 4.0t..>
 \NewConfigure{@buildrelover}{1}
 \Configure{@buildrelover}{align="middle"}
 \NewConfigure{@doteq}{1}
 \Configure{@doteq}{align="middle"}
 \NewConfigure{@underbrace}{1}
 \NewConfigure{@frac}{1}
 \Configure{@frac}{align="middle"}
 \NewConfigure{@left}{1}
 \Configure{@left}{align="middle"}
-_-_-

<..configure html4 tex4ht..>+
 \Css{center { margin-top:1em; margin-bottom:1em; }}
 \Css{td center { margin-top:0em; margin-bottom:0em; }}
-_-_-

<..configure html4 tex4ht..>+
 \NewConfigure{Canvas}[4]{\ht:special{t4ht"%
    *<span\Hnewline class="Canvas">%
    *X<span style="position:relative;\Hnewline
      width:\%.2f#4;"></span></span>%
    **<span\Hnewline style="position:absolute; left:\%.2f#4;
      top:\%.2f#4;"\Hnewline class="Canvas-xy"><span\Hnewline
      class="Canvas-char">%
    *</span></span>%
    *<span class="Canvas-HR"\Hnewline style="position:absolute;
      left:\%.2f#4;top:\%.2f#4;width:\%.2f#4;"
      ><hr\Hnewline style="height:\%.2f#4;"></span>%
    *#1*#2*#1*#2*#3}}
 \Configure{Canvas}{0.00000290646}{0.0}{0.5}{ex}
 \Css{.Canvas { position:relative; }}
-_-_-

9.35.1 Subdirectories for Images

<..a:imgdir..>
 \a:imgdir 
-_-_-

<..img src dir..>
 \ifx \a:imgdir\:UnDef
    \let\a:imgdir=\empty
    \catcode‘\:=12
       \expandafter
       \def\csname :temp\endcsname#1imgdir:#2,#3<.par del.>{%
          \if !#2!\else \expandafter
                           \def\csname a:imgdir\endcsname{#2}\fi}
       \expandafter\csname :temp\expandafter\endcsname
          \Preamble ,imgdir:,<.par del.>%
    \catcode‘\:=11
    \Log:Note{for addressing images in
        a subdirectory,  use the command line option ‘imgdir:.../’}
 \fi
-_-_-

A = instead of -> works well on Windows NT but unfortunately there’s a problem with Windows 98. This OS insists on seeing = as a delimiter and reports an error.

<..configure html4 tex4ht2..>
 \ifx \a:imgdir\empty\else
    \let\GIF:NAME=\gif:name
    \def\gif:name#1{%
      \let\:temp=\GIF:NAME
      \ifx \gif:nm\cond:imgs
         \def\:next{\edef\:tempa{#1}\expandafter\I:images \:tempa/....}%
      \else
         \def\:next{\GIF:NAME{#1}}%
       \fi \:next}
 
    \def\cond:imgs{\edef\gif:nm}
 
    \def\I:images#1/#2....{%
       \edef\:next{\noexpand\:temp{\:tempa}}%
       \if .#2.\else \edef\:next{\noexpand\no:images{\:tempa}}\fi
       \:next}
    \def\no:images#1{\let\a:imgdir=\empty \:temp{#1}}
 \fi
-_-_-

Test file:

\documentclass{article}  
\begin{document}  
\Picture{xx.png}  
\Picture{http://wwww.foo.goo/xx.png}  
 
With image: $\left( x_{n}\right) \alpha_m$.  
 
\end{document}