"Fossies" - the Fresh Open Source Software Archive

Member "latex2html-2021.2/versions/html4_01.pl" (1 Jul 2021, 59479 Bytes) of package /linux/www/latex2html-2021.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "html4_01.pl" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2021_vs_2021.2.

    1 # -*- perl -*-
    2 #
    3 ### File: html4.01.pl
    4 ### Language definitions for HTML 4.01
    5 
    6 
    7 $DOCTYPE = "-//W3C//DTD HTML 4.01";
    8 $DTD_URL = "http://www.w3.org/TR/html4/strict.dtd";
    9 
   10 $USING_STYLES = 1;
   11 $math_class = ' ALIGN="CENTER" CLASS="mathdisplay"';
   12 $eqno_class = ' CLASS="eqno"';
   13 
   14 # Note that htmlx.x.pl prior modules are *NOT*already loaded.
   15 
   16 $declarations{'tiny'} = '<SMALL CLASS="TINY"></SMALL>';
   17 $declarations{'Tiny'} = '<SMALL CLASS="XTINY"></SMALL>';
   18 $declarations{'scriptsize'} = '<SMALL CLASS="SCRIPTSIZE"></SMALL>';
   19 $declarations{'small'} = '<SMALL CLASS="SMALL"></SMALL>';
   20 $declarations{'Small'} = '<SMALL CLASS="FOOTNOTESIZE"></SMALL>';
   21 $declarations{'SMALL'} = '<SMALL CLASS="SCRIPTSIZE"></SMALL>';
   22 $declarations{'footnotesize'} = '<SMALL CLASS="FOOTNOTESIZE"></SMALL>';
   23 $declarations{'large'} = '<BIG CLASS="LARGE"></BIG>';
   24 $declarations{'Large'} = '<BIG CLASS="XLARGE"></BIG>';
   25 $declarations{'LARGE'} = '<BIG CLASS="XXLARGE"></BIG>';
   26 $declarations{'huge'} = '<BIG CLASS="HUGE"></BIG>';
   27 $declarations{'Huge'} = '<BIG CLASS="XHUGE"></BIG>';
   28 
   29 $declarations{'sl'} = '<I CLASS="slanted"></I>';
   30 $declarations{'slshape'} = '<I CLASS="slanted"></I>';
   31 $declarations{'sf'} = '<I CLASS="sans"></I>';
   32 $declarations{'sffamily'} = '<I CLASS="sans"></I>';
   33 $declarations{'scshape'} = '<I CLASS="smcaps"></I>';
   34 
   35 ### Allow for alignment to work
   36 
   37 sub do_env_center { &declared_env('center', @_) }
   38 sub do_env_centering { &declared_env('center', @_) }
   39 sub do_env_flushright { &declared_env('flushright', @_) }
   40 sub do_env_flushleft { &declared_env('flushleft', @_) }
   41 sub do_env_raggedright { &declared_env('flushleft', @_) }
   42 sub do_env_raggedleft { &declared_env('flushright', @_) }
   43 
   44 # SGE: reimplemented via $declarations{$cmd} in &process_command
   45 #sub do_cmd_centering { 
   46 #    # MRO *opentags has no effect
   47 #    local($_)= @_; &declared_env('center', $_) }
   48 #sub do_cmd_raggedright {
   49 #    # MRO *opentags has no effect
   50 #    local($_) = @_; &declared_env('flushleft', $_) }
   51 #sub do_cmd_raggedleft {
   52 #    # MRO *opentags has no effect
   53 #    local($_) = @_; &declared_env('flushright', $_) }
   54 
   55 sub do_cmd_underline {
   56     &styled_text_chunk('U','','text','decoration','underline','',@_)}
   57 
   58 sub do_cmd_centerline { 
   59     &styled_text_block('DIV','ALIGN','CENTER','centerline',@_)}
   60 sub do_cmd_leftline { 
   61     &styled_text_block('DIV','ALIGN','LEFT','leftline',@_)}
   62 sub do_cmd_rightline { 
   63     &styled_text_block('DIV','ALIGN','RIGHT','rightline',@_)}
   64 
   65 
   66 # Color support
   67 #require("$LATEX2HTMLSTYLES/color.perl");
   68 
   69 
   70 ####
   71 ####  HTML 4.0 specific extensions
   72 ####  by Ross Moore <ross@mpce.mq.edu.au>, 7 Oct 1997.
   73 ####
   74 
   75 $num_type = "\^\\d+\$";
   76 $fontsize_type = "\^+?[1-7]\$";
   77 $percent_type = "\^\\d+(%|\\%|$percent_mark)?\$";
   78 $coord_type = "\^\\s*(\$|\\d+(\\s*,\\s*\\d+)+\\s*\$)";  # comma-separated list of numbers
   79 $pixel_type = "\^\\d+\$";
   80 $length_type = "\^\\d+\%?\$";
   81 $param_type = "\&\#[\\dA-Za-z]+\;";
   82 $mime_type = "^\\s*\\w+\/\\w+\\s*\$";
   83 $mime_type_list = "^\\s*(?:\\w+\/\\w+,\\s*)*\\w+\/\\w+\\s*\$";
   84 $name_type = "\^[A-Za-z][A-Za-z_\\d\\-\\.:]*\$";
   85 $string_type = $URL_type = $script_type = $ISOdate_type = $Internet_type =
   86     $CDATA_type = "\^.*\$";
   87 $id_list_type = "\^\\s*\$name_type(\\s+$name_type)*\\s*\$";
   88 
   89 $event_attribs_rx = "on((dbl)?click|mouse(up|down|over|move|out)|key(press|down|up))";
   90 
   91 $dir_type = ",ltr,rtl,";
   92 $halign_type = ",left,right,center,justify,";
   93 $calign_type = $halign_type."char,";
   94 $valign_type = ",top,middle,bottom,baseline,";
   95 $Ialign_type = $halign_type.$valign_type; $Ialign_type = s/center,justify|baseline,//g;
   96 $bullet_type = ",disc,square,circle,";
   97 $shape_type = ",rect,circle,poly,default,";
   98 $scroll_type = ",yes,no,auto,";
   99 #$fontsize_type = ",1,2,3,4,5,6,7,";
  100 $numstyle_type = "1,a,A,i,I,";
  101 $boolean_type = "0,1";
  102 $frame_type = ",void,above,below,hsides,lhs,rhs,vsides,box,border,";
  103 $rules_type = ",none,groups,rows,cols,all,";
  104 $scope_type = ",row,col,rowgroup,colgroup,";
  105 
  106 $color_names_list = "Black|Silver|Gray|White|Maroon|Red|Purple|Fuchsia|"
  107         . "Green|Lime|Olive|Yellow|Navy|Blue|Teal|Aqua";
  108 $color_type = "\^($color_names_list|\\\\?\#?\\w{6})\$";
  109 
  110 
  111 
  112 %closed_tags_list = (
  113       'A' , '' 
  114     , 'ABBR' , ''
  115     , 'ACRONYM' , ''
  116     , 'ADDRESS' , ''
  117     , 'APPLET' , '(CODE|OBJECT),HEIGHT,WIDTH'
  118     , 'B' , ''
  119     , 'BDO' , 'DIR'
  120     , 'BIG' , ''
  121     , 'BLOCKQUOTE' , ''
  122     , 'BODY' , ''
  123     , 'BUTTON' , ''
  124     , 'CAPTION' , ''
  125     , 'CENTER' , ''
  126     , 'CITE' , ''
  127     , 'CODE' , ''
  128     , 'COLGROUP' , ''
  129     , 'DD' , ''
  130     , 'DEL' , ''
  131     , 'DFN' , ''
  132     , 'DIR' , ''
  133     , 'DIV' , ''
  134     , 'DL' , ''
  135     , 'DT' , ''
  136     , 'EM' , ''
  137     , 'FIELDSET' , ''
  138     , 'FONT' , ''
  139     , 'FORM' , 'ACTION'
  140     , 'FRAMESET' , ''
  141     , 'H1','','H2','','H3','','H4','','H5','','H6',''
  142     , 'HEAD' , ''
  143     , 'HTML' , ''
  144     , 'I' , ''
  145     , 'IFRAME' , ''
  146     , 'INS' , ''
  147     , 'KBD' , ''
  148     , 'LABEL' , ''
  149     , 'LEGEND' , ''
  150     , 'LI' , ''
  151     , 'MAP' , ''
  152     , 'MENU' , ''
  153     , 'NOFRAMES' , ''
  154     , 'NOSCRIPT' , ''
  155     , 'OBJECT' , ''
  156     , 'OL' , ''
  157     , 'OPTGROUP' , 'LABEL'
  158     , 'OPTION' , ''
  159     , 'P' , ''
  160     , 'PRE' , ''
  161     , 'Q' , ''
  162     , 'S' , ''
  163     , 'SAMP' , ''
  164     , 'SCRIPT' , ''
  165     , 'SELECT' , 'NAME'
  166         , 'SMALL' , ''
  167         , 'SPAN' , ''
  168     , 'STRIKE' , ''
  169     , 'STRONG' , ''
  170     , 'STYLE' , 'TYPE'
  171     , 'SUB' , '', 'SUP' , ''
  172     , 'TABLE' , '', 'TD', '', 'TH', '', 'TR', ''
  173     , 'TBODY' , ''
  174     , 'TFOOT' , ''
  175     , 'THEAD' , ''
  176     , 'TEXTAREA' , 'ROWS,COLS'
  177     , 'TITLE' , ''
  178     , 'TT' , ''
  179     , 'U' , ''
  180     , 'UL' , ''
  181     , 'VAR' , ''
  182     );
  183 
  184 %unclosed_tags_list = (
  185       'AREA' , 'ALT' 
  186     , 'BASE' , 'HREF' 
  187     , 'BASEFONT' , 'SIZE' 
  188     , 'BR' , '' 
  189     , 'COL' , '' 
  190     , 'FRAME' , '' 
  191     , 'HR' , '' 
  192     , 'IMG' , 'SRC,ALT' 
  193     , 'INPUT' , '' 
  194     , 'ISINDEX' , '' 
  195     , 'LINK' , 'HREF' 
  196     , 'META' , 'CONTENT' 
  197     , 'PARAM' , 'NAME' 
  198     );
  199 
  200 
  201 $core_attribs = "ID,CLASS,STYLE,TITLE,";
  202 $i18n_attribs = "LANG,DIR,";
  203 $event_attribs = "ONCLICK,ONDBLCLICK,ONMOUSEUP,ONMOUSEDOWN,ONMOUSEOVER,ONMOUSEMOVE,ONMOUSEOUT,ONKEYPRESS,ONKEYDOWN,ONKEYUP,";
  204 $style_attribs = join('',",", $core_attribs, $i18n_attribs, $event_attribs);
  205 
  206 $__ID_rx = $__LANG_rx = $name_type_rx;
  207 $__DIR_rx_list = $dir_type;
  208 $__CLASS_rx = $__STYLE_rx = $__TITLE_rx = $cdata_type_rx;
  209 
  210 $__ONCLICK_rx = $__ONDBLCLICK_rx = 
  211     $__ONMOUSEUP_rx = $__ONMOUSEDOWN_rx = $__ONMOUSEOVER_rx = $__ONMOUSEMOVE_rx =
  212     $__ONMOUSEOUT_rx = $__ONKEYPRESS_rx = $__ONKEYDOWN_rx = $__ONKEYUP_rx = $script_type;
  213 
  214 
  215 
  216 $A_attribs = ",SHAPE,DIR,";
  217 $A__SHAPE = $shape_type;
  218 $A__DIR = $dir_type;
  219 $A_attribs_rx_list = join('',",HREF,HREFLANG,NAME,TYPE,REL,REV,CHARSET,TARGET,ACCESSKEY,COORDS,TABINDEX,ONFOCUS,ONBLUR",$style_attribs);
  220 $A__HREF_rx = $URL_type;
  221 $A__HREFLANG_rx = $name_type;
  222 $A__NAME_rx = $A__REL_rx = $A__REV_rx = $string_type; 
  223 $A__TYPE_rx = $mime_type;
  224 $A__CHARSET_rx = $A__TARGET_rx = $A__ACCESSKEY_rx = $CDATA_type;
  225 $A__COORDS_rx = $coord_type;
  226 $A__TABINDEX_rx = $num_type;
  227 $A__ONFOCUS_rx = $A__ONBLUR_rx = $script_type;
  228 
  229 $ABBR_attribs = ",DIR,";
  230 $ABBR__DIR = $dir_type;
  231 $ABBR_attribs_rx_list =  $style_attribs;
  232 
  233 $ACRONYM_attribs = ",DIR,";
  234 $ACRONYM__DIR = $dir_type;
  235 $ACRONYM_attribs_rx_list =  $style_attribs;
  236 
  237 $ADDRESS_attribs = ",DIR,";
  238 $ADDRESS__DIR = $dir_type;
  239 $ADDRESS_attribs_rx_list = $style_attribs;
  240 
  241 $APPLET_attribs = ",ALIGN,DIR,";
  242 $APPLET_attribs_rx_list = join('',",CODE,CODEBASE,OBJECT,ARCHIVE,NAME,ALT,HEIGHT,WIDTH,HSPACE,VSPACE",$style_attribs);
  243 $APPLET__CODEBASE = $URL_type;
  244 $APPLET__CODE = $APPLET__OBJECT = $CDATA_type;      # either is required
  245 $APPLET__NAME = $APPLET__ALT = $APPLET__ARCHIVE = $CDATA_type;
  246 $APPLET__HEIGHT = $APPLET__WIDTH = $pixel_type;     # required
  247 $APPLET__HSPACE = $APPLET__VSPACE = $pixel_type;
  248 
  249 $AREA_attribs = ",SHAPE,NOHREF,DIR,";
  250 $AREA__SHAPE = $shape_type;
  251 $AREA_attribs_rx_list = join('',",HREF,COORDS,ALT,TABINDEX,ACCESSKEY,TARGET",$style_attribs);
  252 $AREA__HREF_rx = $URL_type;
  253 $AREA__COORDS_rx = $coord_type;
  254 $AREA__TABINDEX_rx = $num_type;
  255 $AREA__ALT_rx = $AREA__ACCESSKEY_rx = $AREA__TARGET_rx = $string_type;
  256 
  257 
  258 $B_attribs = ",DIR,";
  259 $B__DIR = $dir_type;
  260 $B_attribs_rx_list = $style_attribs;
  261 
  262 $BASE_attribs_rx_list = ",HREF,TARGET,";
  263 $BASE__HREF_rx = $URL_type;           # required
  264 $BASE__TARGET_rx = $CDATA_type;
  265 
  266 $BASEFONT_attribs_rx_list = ",ID,SIZE,COLOR,FACE,";
  267 $BASEFONT__SIZE_rx = $fontsize_type;
  268 $BASEFONT__COLOR_rx = $color_type;
  269 $BASEFONT__FACE_rx = $CDATA_type;
  270 $BASEFONT__ID_rx = $name_type;
  271 
  272 $BDO_attribs = ",DIR,";
  273 $BDO__DIR = $dir_type;
  274 $BDO_attribs_rx_list = join('',",LANG,", $core_attribs);
  275 $BDO__LANG_rx = $name_type;
  276 
  277 $BIG_attribs = ",DIR,";
  278 $BIG__DIR = $dir_type;
  279 $BIG_attribs_rx_list = $style_attribs;
  280 
  281 $BLOCKQUOTE_attribs = ",DIR,";
  282 $BLOCKQUOTE__DIR = $dir_type;
  283 $BLOCKQUOTE_attribs_rx_list = join('',",CITE",$style_attribs);
  284 $BLOCKQUOTE__CITE_rx = $URL_type;
  285 
  286 $BODY_attribs = ",DIR,";
  287 $BODY__DIR = $dir_type;
  288 $BODY_attribs_rx_list = join('',",TEXT,BGCOLOR,LINK,VLINK,ALINK,BACKGROUND,ONLOAD,ONUNLOAD",$style_attribs);
  289 $BODY__BGCOLOR_rx = $BODY__LINK_rx = $BODY__VLINK_rx  = $BODY__ALINK_rx = 
  290     $BODY__TEXT_rx = $color_type;
  291 $BODY__BACKGROUND_rx = $string_type;
  292 $BODY__ONLOAD_rx = $BODY__ONUNLOAD_rx = $script_type;
  293 
  294 $BR_attribs = ",CLEAR,";
  295 $BR__CLEAR = ",left,all,right,none,";
  296 $BODY_attribs_rx_list = join('',",",$core_attribs);
  297 
  298 $BUTTON_attribs = ",TYPE,DISABLED,DIR,";
  299 $BUTTON__TYPE = ",button,submit,reset,";
  300 $BUTTON__DIR = $dir_type;
  301 $BUTTON_attribs_rx_list = join('',",NAME,VALUE,TABINDEX,ACCESSKEY,ONFOCUS,ONBLUR",$style_attribs);
  302 $BUTTON__NAME_rx = $name_type;
  303 $BUTTON__VALUE_rx = $BUTTON__ACCESSKEY_rx = $CDATA_type;
  304 $BUTTON__TABINDEX_rx = $num_type;
  305 $BUTTON__ONFOCUS_rx = $BUTTON__ONBLUR_rx = $script_type;
  306 
  307 
  308 $CAPTION_attribs = ",ALIGN,DIR,";
  309 $CAPTION__ALIGN = ",top,bottom,left,right,";
  310 $CAPTION_attribs_rx_list = $style_attribs;
  311 
  312 $CITE_attribs = ",DIR,";
  313 $CITE__DIR = $dir_type;
  314 $CITE_attribs_rx_list = $style_attribs;
  315 
  316 $CODE_attribs = ",DIR,";
  317 $CODE__DIR = $dir_type;
  318 $CODE_attribs_rx_list = $style_attribs;
  319 
  320 $COL_attribs = ",ALIGN,VALIGN,DIR,";
  321 $COL__ALIGN = $calign_type;
  322 $COL__VALIGN = $valign_type;
  323 $COL__DIR = $dir_type;
  324 $COL_attribs_rx_list = join('',",SPAN,WIDTH,CHAR,CHAROFF,$style_attribs);
  325 $COL__SPAN = $num_type;
  326 $COL__WIDTH = $length_type;
  327 $COL__CHAR = $COL__CHAROFF = $string_type;
  328 
  329 $COLGROUP_attribs = ",ALIGN,VALIGN,DIR,";
  330 $COLGROUP__ALIGN = $calign_type;
  331 $COLGROUP__VALIGN = $valign_type;
  332 $COLGROUP__DIR = $dir_type;
  333 $COLGROUP_attribs_rx_list = join('',",SPAN,WIDTH,CHAR,CHAROFF,$style_attribs);
  334 $COLGROUP__SPAN = $num_type;
  335 $COLGROUP__WIDTH = $length_type;
  336 $COLGROUP__CHAR = $COLGROUP__CHAROFF = $string_type;
  337 
  338 
  339 $DFN_attribs = ",DIR,";
  340 $DFN__DIR = $dir_type;
  341 $DFN_attribs_rx_list = $style_attribs;
  342 
  343 $DIR_attribs = $DL_attribs = $MENU_attribs = ",COMPACT,DIR,";
  344 $DIR__DIR = $MENU__DIR = $DL__DIR = $dir_type;
  345 $DIR_attribs_rx_list = $DL_attribs_rx_list = $MENU_attribs_rx_list = $style_attribs;
  346 
  347 $DD_attribs = $DT_attribs = ",DIR,";
  348 $DD__DIR = $DT__DIR = $dir_type;
  349 $DD_attribs_rx_list = $DT_attribs_rx_list = $style_attribs;
  350 
  351 $DEL_attribs = $INS_attribs = ",DIR,";
  352 $DEL__DIR = $INS__DIR = $dir_type;
  353 $DEL_attribs_rx_list = $INS_attribs_rx_list = join('',",CITE,DATETIME",$style_attribs);
  354 $DEL__CITE = $INS__CITE = $URL_type;
  355 $DEL__DATETIME = $INS__DATETIME = $ISOdate_type;
  356 
  357 $DIV_attribs = ",ALIGN,DIR,";
  358 $DIV__ALIGN = $halign_type;
  359 $DIV__DIR = $dir_type;
  360 $DIV_attribs_rx_list = $style_attribs;
  361 
  362 
  363 $EM_attribs = ",DIR,";
  364 $EM__DIR = $dir_type;
  365 $EM_attribs_rx_list = $style_attribs;
  366 
  367 
  368 $FIELDSET_attribs = ",DIR,";
  369 $FIELDSET__DIR = $dir_type;
  370 $FIELDSET_attribs_rx_list = $style_attribs;
  371 
  372 $FONT_attribs_rx_list = join('',",SIZE,COLOR,FACE,",$core_attribs);
  373 $FONT__SIZE_rx = $fontsize_type;
  374 $FONT__COLOR_rx = $color_type;
  375 $FONT__FACE_rx = $CDATA_type;
  376 
  377 $FORM_attribs = ",METHOD,ENCTYPE,DIR,";
  378 $FORM__METHOD = ",get,post,";
  379 $FORM__DIR = $dir_type;
  380 $FORM__ENCTYPE = ",text\/plain,application\/x\-www\-form\-urlencoded,multipart\/form\-data,";
  381 $FORM_attribs_rx_list = join('',",ACTION,TARGET,ACCEPT,ACCEPT-CHARSET,ONSUBMIT,ONRESET",$style_attribs);
  382 $FORM__ACTION_rx = $URL_type;               # required
  383 $FORM__TARGET_rx = ${FORM__ACCEPT-CHARSET_rx} = $CDATA_type;
  384 $FORM__ONSUBMIT_rx = $FORM__ONRESET_rx = $script_type;
  385 $FORM__ACCEPT_rx = $mime_type_list;
  386 
  387 $FRAME_attribs = ",FRAMEBORDER,NORESIZE,SCROLLING,";
  388 $FRAME__FRAMEBORDER = $boolean_type;
  389 $FRAME__SCROLLING = $scroll_type;
  390 $FRAME_attribs_rx_list = ",ID,TITLE,NAME,SOURCE,MARGINWIDTH,MARGINHEIGHT,";
  391 $FRAME__ID_rx = $name_type;
  392 $FRAME__NAME_rx = $FRAME__TITLE_rx = $CDATA_type;
  393 $FRAME__SOURCE_rx = $URL_type;
  394 $FRAME__MARGINWIDTH_rx = $FRAME__MARGINHEIGHT_rx = $pixel_type;
  395 
  396 $FRAMESET_attribs_rx_list = ",ID,TITLE,ROWS,COLS,ONLOAD,ONUNLOAD,";
  397 $FRAMESET__ID_rx = $name_type;
  398 $FRAMESET__TITLE_rx = $CDATA_type;
  399 $FRAME__ROWS_rx = $FRAME__COLS_rx = $pixel_type;
  400 $FRAME__ONLOAD_rx = $FRAME__ONUNLOAD_rx = $script_type;
  401 
  402 
  403 $H1_attribs = $H2_attribs = $H3_attribs = $H4_attribs = 
  404  $H5_attribs = $H6_attribs = ",ALIGN,DIR,";
  405 $H1__ALIGN = $H2__ALIGN = $H3__ALIGN = $H4__ALIGN = $H5__ALIGN = $H6__ALIGN = $halign_type;
  406 $H1_attribs_rx = $H2_attribs_rx = $H3_attribs_rx = $H4_attribs_rx = 
  407  $H5_attribs_rx = $H6_attribs_rx = $style_attribs;
  408 
  409 $HEAD_attribs = ",DIR,";
  410 $HEAD__DIR = $dir_type;
  411 $HEAD_attribs_rx = ",PROFILE,LANG,";
  412 $HEAD__PROFILE_rx = $URL_type;
  413 $HEAD__LANG_rx = $CDATA_type;
  414 
  415 $HR_attribs = ",ALIGN,NOSHADE,";
  416 $HR__ALIGN = $halign_type;
  417 $HR_attribs_rx_list = join('',",SIZE,WIDTH,",$core_attribs,$event_attribs);
  418 $HR__SIZE_rx = $pixel_type;
  419 $HR__WIDTH_rx = $length_type;
  420 
  421 $HTML_attribs = ",DIR,";
  422 $HTML_attribs_rx_list = ",VERSION,LANG,";
  423 $HTML__VERSION_rx = $string_type;
  424 $HTML__LANG_rx = $cdata_type;
  425 
  426 
  427 $I_attribs = ",DIR,";
  428 $I__DIR = $dir_type;
  429 $I_attribs_rx_list = $style_attribs;
  430 
  431 $IFRAME_attribs = ",FRAMEBORDER,ALIGN,SCROLLING,";
  432 $IFRAME__FRAMEBORDER = $boolean_type;
  433 $IFRAME__SCROLLING = $scroll_type;
  434 $IFRAME__ALIGN = $Ialign_type;
  435 $IFRAME_attribs_rx_list = ",ID,TITLE,NAME,SOURCE,HEIGHT,WIDTH,MARGINWIDTH,MARGINHEIGHT,";
  436 $IFRAME__ID_rx = $name_type;
  437 $IFRAME__NAME_rx = $FRAME__TITLE_rx = $CDATA_type;
  438 $IFRAME__SOURCE_rx = $URL_type;
  439 $IFRAME__WIDTH_rx = $FRAME__HEIGHT_rx = $length_type;
  440 $IFRAME__MARGINWIDTH_rx = $FRAME__MARGINHEIGHT_rx = $pixel_type;
  441 
  442 $IMG_attribs = ",ALIGN,ISMAP,DIR,";
  443 $IMG__ALIGN =  $Ialign_type;
  444 $IMG__DIR = $dir_type;
  445 $IMG_attribs_rx_list = join('',",NAME,WIDTH,HEIGHT,BORDER,HSPACE,VSPACE,SRC,USEMAP,ALT,LONGDESC",$style_attribs);
  446 $IMG__WIDTH_rx = $IMG__HEIGHT_rx = $IMG__BORDER_rx = $IMG__HSPACE_rx = $IMG__VSPACE_rx = $pixel_type;
  447 $IMG__SRC_rx = $URL_type;      # required
  448 $IMG__USEMAP_rx = $IMG__LONGDESC_rx = $URL_type;
  449 $IMG__ALT_rx = $string_type;
  450 $IMG__NAME_rx = $name_type;
  451 
  452 
  453 $INPUT_attribs = ",TYPE,ISMAP,CHECKED,DISABLED,READONLY,ALIGN,DIR,";
  454 $INPUT__TYPE = ",text,password,checkbox,radio,submit,reset,file,hidden,image,button";
  455 $INPUT__ALIGN = $Ialign_type;
  456 $INPUT__DIR = $dir_type;
  457 $INPUT_attribs_rx_list = join('',",SIZE,MAXLENGTH,NAME,VALUE,SRC,ALT,USEMAP,TABINDEX,ACCESSKEY,ACCEPT,"
  458     ,"ONFOCUS,ONBLUR,ONSELECT,ONCHANGE",$style_attribs);
  459 $INPUT__TABINDEX_rx = $INPUT__MAXLENGTH_rx = $num_type;
  460 $INPUT__SIZE_rx = $INPUT__ACCESSKEY_rx = $INPUT__NAME_rx = $INPUT__VALUE_rx = 
  461         $INPUT__ALT_rx = $CDATA_type;
  462 $INPUT__SRC_rx = $INPUT__USEMAP_rx = $URL_type;
  463 $INPUT__ONFOCUS_rx = $INPUT__ONBLUR_rx = $INPUT__ONSELECT_rx = $INPUT__ONCHANGE_rx = $script_type;
  464 $INPUT__ACCEPT_rx = $mime_type_list;
  465 
  466 $ISINDEX_attribs = ",DIR,";
  467 $ISINDEX__DIR = $dir_type;
  468 $ISINDEX_attribs_rx_list = join('',",PROMPT,LANG,",$core_attribs);
  469 $ISINDEX__PROMPT_rx = $string_type;
  470 $ISINDEX__LANG_rx = $CDATA_type;
  471 
  472 
  473 $KBD_attribs = ",DIR,";
  474 $KBD__DIR = $dir_type;
  475 $KBD_attribs_rx_list = $style_attribs;
  476 
  477 
  478 $LABEL_attribs = ",DISABLED,DIR,";
  479 $LABEL__DIR = $dir_type;
  480 $LABEL_attribs_rx_list = join('',",FOR,ACCESSKEY,ONFOCUS,ONBLUR",$style_attribs);
  481 $LABEL__FOR_rx = $LABEL__ACCESSKEY_rx = $CDATA_type;
  482 $LABEL__ONFOCUS_rx = $LABEL__ONBLUR_rx = $script_type;
  483 
  484 $LI_attribs = ",TYPE,";
  485 $LI__TYPE = $bullet_type . $numstyle_type; $LI_TYPE =~ s/,,/,/g;
  486 $LI_attribs_rx_list = ",VALUE,";
  487 $LI__VALUE_rx = $num_type;
  488 
  489 $LINK_attribs_rx_list = ",HREF,TITLE,REL,REV,";
  490 $LINK__HREF_rx = $URL_type;        # required
  491 $LINK__TITLE_rx = $LINK__REL_rx = $LINK__REV_rx = $string_type;
  492 
  493 $MAP_attribs_rx_list = ",NAME,";
  494 $MAP__NAME_rx = $string_type;
  495 
  496 $META_attribs_rx_list = ",CONTENT,NAME,HTTP\-EQUIV,";
  497 $META__CONTENT_rx = $string_type;   # required
  498 $META__NAME_rx = $string_type;
  499 ${META__HTTP-EQUIV_rx} = $string_type;
  500 
  501 $OL_attribs = ",COMPACT,TYPE,";
  502 $OL__TYPE = $numstyle_type;
  503 $OL_attribs_rx_list = ",START,";
  504 $OL__START_rx = $num_type;
  505 
  506 $OBJECT_attribs = ",DECLARE,";
  507 $OBJECT_attribs_rx_list = ",CLASSID,CODEBASE,DATA,TYPE,CODETYPE,ARCHIVE,STANDBY,HEIGHT,WIDTH,USEMAP,NAME,TABINDEX,";
  508 $OBJECT__CLASSID_rx = $OBJECT__CODEBASE_rx = $OBJECT__DATA_rx = $OBJECT__ARCHIVE_rx =
  509   $OBJECT__USEMAP_rx = $URL_type;
  510 $OBJECT__TYPE_rx = $OBJECT__CODETYPE_rx = $OBJECT__STANDBY_rx = $string_type;
  511 $OBJECT__NAME_rx = $CDATA_type;
  512 $OBJECT__WIDTH_rx = $OBJECT__HEIGHT_rx = $length_type;
  513 $OBJECT__TABINDEX_rx = $num_type;
  514 
  515 $OPTGROUP_attribs = ",DISABLED,";
  516 $OPTGROUP_attribs_rx_list = ",LABEL,";
  517 $OPTGROUP__LABEL_rx = $name_type;
  518 
  519 $OPTION_attribs = ",SELECTED,DISABLED,";
  520 $OPTION_attribs_rx_list = ",LABEL,VALUE,";
  521 $OPTION__LABEL_rx = $name_type;
  522 $OPTION__VALUE_rx = $CDATA_type;
  523 
  524 $PARAM_attribs_rx_list = ",NAME,VALUE,";
  525 $PARAM__NAME_rx = $string_type;   # required
  526 $PARAM__VALUE_rx = $string_type;
  527 
  528 $PRE_attribs_rx_list = ",WIDTH,";
  529 $PRE__WIDTH = $num_type;
  530 
  531 $P_attribs = ",ALIGN,";
  532 $P__ALIGN = $halign_type;
  533 
  534 
  535 $Q_attribs = ",DIR,";
  536 $Q__DIR = $dir_type;
  537 $Q_attribs_rx_list = join('',",CITE",$style_attribs);
  538 $Q__CITE_rx = $URL_type;
  539 
  540 
  541 $S_attribs = ",DIR,";
  542 $S__DIR = $dir_type;
  543 $S_attribs_rx_list = $style_attribs;
  544 
  545 $SAMP_attribs = ",DIR,";
  546 $SAMP__DIR = $dir_type;
  547 $SAMP_attribs_rx_list = $style_attribs;
  548 
  549 $SELECT_attribs = ",MULTIPLE,";
  550 $SELECT_attribs_rx_list = ",SIZE,NAME,";
  551 $SELECT__SIZE_rx = $num_type;
  552 $SELECT__NAME_rx = $string_type;
  553 
  554 $SMALL_attribs = ",DIR,";
  555 $SMALL__DIR = $dir_type;
  556 $SMALL_attribs_rx_list = $style_attribs;
  557 
  558 $SPAN_attribs = ",DIR,";
  559 $SPAN__DIR = $dir_type;
  560 $SPAN_attribs_rx_list = $style_attribs;
  561 
  562 $STRIKE_attribs = ",DIR,";
  563 $STRIKE__DIR = $dir_type;
  564 $STRIKE_attribs_rx_list = $style_attribs;
  565 
  566 $STRONG_attribs = ",DIR,";
  567 $STRONG__DIR = $dir_type;
  568 $STRONG_attribs_rx_list = $style_attribs;
  569 
  570 $STYLE_attribs = ",DIR,";
  571 $STYLE__DIR = $dir_type;
  572 $STYLE_attribs_rx_list = ",LANG,TYPE,MEDIA,TITLE,";
  573 $STYLE__TYPE_rx = $STYLE__MEDIA_rx = $STYLE__TITLE_rx = $STYLE__LANG_rx = $cdata_type;
  574 
  575 $SUB_attribs = $SUP_attribs = ",DIR,";
  576 $SUB__DIR = $SUP__DIR = $dir_type;
  577 $SUB_attribs_rx_list = $SUP_attribs_rx_list = $style_attribs;
  578 
  579 
  580 $TABLE_attribs = ",ALIGN,DIR,FRAME,RULES,";
  581 $TABLE__ALIGN = $halign_type;
  582 $TABLE__DIR = $dir_type;
  583 $TABLE__FRAME = $frame_type;
  584 $TABLE__RULES = $rules_type;
  585 $TABLE_attribs_rx_list = join('',",CELLPADDING,WIDTH,CELLSPACING,BORDER,BGCOLOR,SUMMARY,COLS",$style_attribs);
  586 $TABLE__WIDTH_rx = $percent_type;
  587 $TABLE__BORDER_rx = $TABLE__CELLSPACING_rx = $TABLE__CELLPADDING_rx = $TABLE__COLS_rx = $num_type;
  588 $TABLE__BGCOLOR_rx = $color_type;
  589 $TABLE__SUMMARY_rx = $cdata_type;
  590 
  591 $THEAD_attribs = $TFOOT_attribs = $TBODY_attribs = ",DIR,HALIGN,VALIGN,";
  592 $THEAD__DIR = $TFOOT__DIR = $TBODY__DIR = $dir_type;
  593 $THEAD__HALIGN = $TFOOT__HALIGN = $TBODY__HALIGN = $calign_type;
  594 $THEAD__VALIGN = $TFOOT__VALIGN = $TBODY__VALIGN = $valign_type;
  595 $THEAD_attribs_rx = $TFOOT_attribs_rx = $TBODY_attribs_rx = join('',",CHAR,CHAROFF",$style_attribs);
  596 $THEAD__CHAR_rx = $TFOOT__CHAR_rx = $TBODY__CHAR_rx = $cdata_type;
  597 $THEAD__CHAROFF_rx = $TFOOT__CHAROFF_rx = $TBODY__CHAROFF_rx = $num_type;
  598 
  599 
  600 $TD_attribs = $TH_attribs = ",ALIGN,VALIGN,NOWRAP,DIR,";
  601 $TR_attribs = ",ALIGN,VALIGN,DIR,";
  602 $TD__ALIGN = $TH__ALIGN = $TR__ALIGN = $calign_type;
  603 $TD__VALIGN = $TH__VALIGN = $TR__VALIGN = $valign_type;
  604 $TD__DIR = $TH__DIR = $TR__DIR = $dir_type;
  605 $TD_attribs_rx_list = $TH_attribs_rx_list = join('',
  606      ",COLSPAN,ROWSPAN,WIDTH,HEIGHT,CHAR,CHAROFF,BGCOLOR,ABBR,AXIS,HEADERS,SCOPE,"
  607     , $style_attribs);
  608 $TD__COLSPAN_rx = $TD__ROWSPAN_rx = $TD__WIDTH_rx = $TD__HEIGHT_rx = $TD__CHAROFF_rx = $num_type;
  609 $TH__COLSPAN_rx = $TH__ROWSPAN_rx = $TH__WIDTH_rx = $TH__HEIGHT_rx = $TH__CHAROFF_rx = $num_type;
  610 $TD__CHAR_rx = $TH__CHAR_rx = $cdata_type;
  611 $TD__BGCOLOR_rx = $TH__BGCOLOR_rx = $color_type;
  612 $TD__ABBR_rx = $TH__ABBR_rx  = $TD__AXIS_rx = $TH__AXIS_rx = $cdata_type;
  613 $TD__SCOPE_rx = $TH__SCOPE_rx = $scope_type;
  614 $TD__HEADERS_rx = $TH__HEADERS_rx = $id_list_type;
  615 
  616 
  617 $TEXTAREA_attribs = ",DISABLED,READONLY,DIR,";
  618 $TEXTAREA__DIR = $dir_type;
  619 $TEXTAREA_attribs_rx_list = ",COLS,ROWS,NAME,TABINDEX,";
  620 $TEXTAREA__COLS = $TEXTAREA__ROWS = $num_type;  # required
  621 $TEXTAREA__TABINDEX = $num_type;
  622 $TEXTAREA__NAME = $cdata_type;
  623 $TEXTAREA__ONFOCUS = $TEXTAREA__ONBLUR = $TEXTAREA__ONSELECT = $TEXTAREA__ONCHANGE = $script_type;
  624 
  625 $TT_attribs = ",DIR,";
  626 $TT__DIR = $dir_type;
  627 $TT_attribs_rx_list = $style_attribs;
  628 
  629 
  630 $U_attribs = ",DIR,";
  631 $U__DIR = $dir_type;
  632 $U_attribs_rx_list = $style_attribs;
  633 
  634 $UL_attribs = ",TYPE,COMPACT,DIR,";
  635 $UL__TYPE = $bullet_type;
  636 $UL__DIR = $dir_type;
  637 $UL_attribs_rx_list = $style_attribs;
  638 
  639 
  640 $VAR_attribs = ",DIR,";
  641 $VAR__DIR = $dir_type;
  642 $VAR_attribs_rx_list = $style_attribs;
  643 
  644 
  645 if ($FIGURE_CAPTION_ALIGN) {
  646     if (!($TABLE_CAPTION_ALIGN =~ /^(TOP|BOTTOM|LEFT|RIGHT)/i))
  647     { &table_caption_warning('FIGURE') };
  648 } else { $FIGURE_CAPTION_ALIGN = 'BOTTOM' }
  649 
  650 if (($TABLE_CAPTION_ALIGN)&&!($TABLE_CAPTION_ALIGN =~ /^(TOP|BOTTOM|LEFT|RIGHT)/i))
  651     { &table_caption_warning('TABLE') };
  652 
  653 sub table_caption_warning {
  654     local($which) = @_;
  655     &write_warnings("\n \$${which}_CAPTION_ALIGN should be 'TOP' or 'BOTTOM'");
  656 }
  657 
  658 
  659 ###   HTML3.2  tables,  based upon...
  660 ###
  661 ### File: html2.2.pl
  662 ### Language definitions for HTML 2.2 (Tables)
  663 ### Written by Marcus E. Hennecke <marcush@leland.stanford.edu>
  664 
  665 ### This file simplifies the earlier code, to be compatible with
  666 ### the simpler model used in  HTML 3.2 
  667 ### Two subroutines are redefined.
  668 ###   ----  Ross Moore <ross@mpce.mq.edu.au>,  21 Feb 1997
  669 
  670 # Translates LaTeX column specifications to HTML. Again, Netscape
  671 # needs some extra work with its width attributes in the <td> tags.
  672 
  673 $content_mark = "<cellcontents>";
  674 $wrap_parbox_rx = "(\\\\begin$O\\d+${C}tex2html_deferred$O\\d+$C)?"
  675     . "\\\\parbox(\\s*\\\[[^]]*])*\\s*$O(\\d+)$C([\\w\\W]*)$O\\3$C\\s*$O(\\d+)$C([\\w\\W]*)$O\\5$C"
  676     . "(\\end<<\\d+>>tex2html_deferred<<\\d+>>)?";
  677 
  678 sub translate_colspec {
  679     local($colspec,$celltag) = @_;
  680     local($cellopen) = "<$celltag ALIGN";
  681     local($cellclose) = "</$celltag>\n";
  682     local($len,$pts,@colspec,$char,$cols,$repeat,$celldata,$at_text,$after_text);
  683     local($frames, $rules, $prefix,$border)=('','','','');
  684 #    local($NOWRAP) = " NOWRAP";
  685     local($NOWRAP) = "";
  686 
  687     if ($colspec =~ /$dol_mark/) {
  688     local($math_colspec) = $`."\\mathon ";
  689     local($next_dol) = "off ";
  690     $colspec = $';
  691     while ($colspec =~ /$dol_mark/) {
  692         $colspec = $';
  693         $math_colspec .= $`."\\math".$next_dol;
  694         $next_dol = (($next_dol =~/off/)? "on " : "off ");
  695     }
  696     $colspec = $math_colspec . $colspec;
  697     }
  698 
  699     $colspec = &revert_to_raw_tex($colspec);
  700     $frames  = "l" if ( $colspec =~ s/^\|+// );
  701     $frames .= "r" if ( $colspec =~ s/\|+$// );
  702     $rules = "c" if ( $colspec =~ /\|/ );
  703     $border = " BORDER=\"1\"" if (($frames)||($rules));
  704     $colspec =~ s/\\[chv]line//g;
  705 
  706     $cols = 0; local($art_br) = '';
  707     while ( length($colspec) > 0 ) {
  708     $char = substr($colspec,0,1);
  709     $colspec = substr($colspec,1);
  710     if ( $char eq "c" ) {
  711         if ($at_text) { $at_text = $art_br.$at_text; $after_text = $art_br; }
  712         push(@colspec
  713             ,"$cellopen=\"CENTER\"$NOWRAP>$at_text$content_mark$after_text$cellclose");
  714         $at_text = $after_text = '';
  715         $cols++;
  716 
  717     } elsif ( $char =~ /^(l|X)$/ ) {
  718         if ($at_text) { $at_text = $art_br.$at_text; $after_text = $art_br; }
  719         push(@colspec
  720             ,"$cellopen=\"LEFT\"$NOWRAP>$at_text$content_mark$after_text$cellclose");
  721         $at_text = $after_text = '';
  722         $cols++;
  723 
  724     } elsif ( $char eq "r" ) {
  725         if ($at_text) { $at_text = $art_br.$at_text; $after_text = $art_br; }
  726         push(@colspec
  727             ,"$cellopen=\"RIGHT\"$NOWRAP>$at_text$content_mark$after_text$cellclose");
  728         $at_text = $after_text = '';
  729         $cols++;
  730 
  731     } elsif ( $char =~ /^(p|m|b|t)$/ ) {
  732         local($valign);
  733         $valign = (($char eq "b")? "BOTTOM" : (($char eq "m")? "MIDDLE" : "TOP"));
  734         $valign = " VALIGN=\"${valign}\"";
  735         $colspec =~ s/^\s*\{([^\}]*)\}\s*/$celldata=$1;''/e;
  736 
  737         local($pxs,$len) = &convert_length($celldata) if ($celldata);
  738         if ($pxs) {
  739         if ($pxs=~/\%/) { $pxs=~s/(\d+)\%/$1*5/e; }
  740         $pxs = "\"$pxs\"" if ($pxs=~/\%/);
  741         $celldata = " WIDTH=$pxs";
  742         }
  743         if ($at_text) { $at_text = $art_br.$at_text; $after_text = $art_br; }
  744         push(@colspec
  745         ,"$cellopen=\"LEFT\"${valign}$celldata>$at_text$content_mark$after_text$cellclose");
  746         $at_text = $after_text = '';
  747         $cols++;
  748 
  749     } elsif ( $char eq "|" ) {
  750         #RRM currently ignored; presence already detected for $rules
  751 
  752     } elsif ( $char =~ /(\@|\!)/ ) {
  753 # RRM: the following assumes text of the @-expression to be constant for each row.
  754 # Usually this will be true, but LaTeX allows otherwise
  755         $colspec =~ s/\s*\{([^\}]*)\}\s*/$celldata=$1;''/e; 
  756         if ($celldata =~ /\{/ ) {
  757         local($databit) = $celldata;
  758         local($numopens); $celldata =~ s/\{/$numopens++;"\{"/eg;
  759         while (($colspec)&& $numopens) {
  760             if ($colspec =~ s/^([^\}]*)\}//) {
  761             $databit=$1; $celldata.="\}".$databit;
  762             $databit =~ s/\{/$numopens++;"\{"/eg;
  763             --$numopens;
  764             } else { $databit = ''; }
  765         }
  766         do { local($_) = $celldata; &pre_process; $celldata = $_ };
  767         }
  768         $celldata .= ' ' if ($celldata =~ /\\\w+$/);
  769 
  770         $celldata =~ s/$wrap_parbox_rx/$6/gm;
  771 #       $at_text .= $celldata;
  772 #       if ( $#colspec > -1) {
  773 #           $colspec[$#colspec] .= join('', "<TD ALIGN=\"LEFT\">",$celldata,'</TD>');
  774 #       } else { $at_text .= join ('', $celldata , '</TD><TD>' ) }
  775         push (@colspec, join('', "<TD ALIGN=\"LEFT\">",$celldata,'</TD>'));
  776         $celldata = '';
  777 
  778     } elsif ( $char =~ /\>/ ) {
  779 # RRM: the following assumes text of the @-expression to be constant for each row.
  780 # Usually this will be true, but LaTeX allows otherwise
  781         $colspec =~ s/\s*\{([^\}]*)\}\s*/$celldata=$1;''/e; 
  782         if ($celldata =~ /\{/ ) {
  783         local($databit) = $celldata;
  784         local($numopens); $celldata =~ s/\{/$numopens++;"\{"/eg;
  785         while (($colspec)&& $numopens) {
  786             if ($colspec =~ s/^([^\}]*)\}//) {
  787             $databit=$1; $celldata.="\}".$databit;
  788             $databit =~ s/\{/$numopens++;"\{"/eg;
  789             --$numopens;
  790             } else { $databit = ''; }
  791         }
  792         do { local($_) = $celldata; &pre_process; $celldata = $_ };
  793         }
  794         $celldata .= ' ' if ($celldata =~ /\\\w+$/);
  795 
  796         $celldata =~ s/$wrap_parbox_rx/$6/gm;
  797         $at_text .= $celldata;
  798 
  799     } elsif ( $char =~ /;|\&/ ) {
  800         if ($colspec =~ s/^(SPM)?lt;//) {
  801         $colspec =~ s/\s*\{([^\}]*)\}\s*/$celldata=$1;''/e;
  802         $celldata .= ' ' if ($celldata =~ /\\\w+$/);
  803         $colspec[$#colspec] =~ s/(($art_br)?$cellclose)/$1$celldata$1/;
  804         } else {
  805         print "\n*** unknown entity in table-spec ***\n";
  806         }
  807 
  808     } elsif ( $char =~ /\</ ) {
  809         $colspec =~ s/^\s*\{([^\}]*)\}\s*/$celldata=$1;''/e;
  810         if ($celldata =~ /\{/ ) {
  811         local($databit) = $celldata;
  812         local($numopens); $celldata =~ s/\{/$numopens++;"\{"/eg;
  813         while (($colspec)&& $numopens) {
  814             if ($colspec =~ s/^([^\}]*)\}//) {
  815             $databit=$1; $celldata.="\}".$databit;
  816             $databit =~ s/\{/$numopens++;"\{"/eg;
  817             --$numopens;
  818             } else { $databit = ''; }
  819         }
  820         do { local($_) = $celldata; &pre_process; $celldata = $_ };
  821         }
  822         $celldata .= ' ' if ($celldata =~ /\\\w+$/);
  823 
  824         $celldata =~ s/$wrap_parbox_rx/$6/g;
  825         if ($#colspec > -1) {           
  826         $colspec[$#colspec] =~ s/($art_br)?$cellclose/$celldata$1$cellclose/;
  827         } else { $at_text .=  $celldata }
  828 
  829     } elsif ( $char =~ /\!/ ) {
  830         $colspec =~ s/^\s*\{([^\}]*)\}\s*/$celldata=$1;''/e;
  831         if ($celldata =~ /\{/ ) {
  832         local($databit) = $celldata;
  833         local($numopens); $celldata =~ s/\{/$numopens++;"\{"/eg;
  834         while (($colspec)&& $numopens) {
  835             if ($colspec =~ s/^([^\}]*)\}//) {
  836             $databit=$1; $celldata.="\}".$databit;
  837             $databit =~ s/\{/$numopens++;"\{"/eg;
  838             --$numopens;
  839             } else { $databit = ''; }
  840         }
  841         do { local($_) = $celldata; &pre_process; $celldata = $_ };
  842         }
  843         $celldata .= ' ' if ($celldata =~ /\\\w+$/);
  844 
  845         $celldata =~ s/$wrap_parbox_rx/$6/g;
  846         if ($#colspec > -1) {           
  847         $colspec[$#colspec] =~ s/($art_br)?$cellclose/$celldata$1$cellclose/;
  848         } else { $at_text .=  $celldata }
  849 
  850     } elsif ( $char eq "*" ) {
  851         $colspec =~ s/^\s*\{([^\}]*)\}\s*/$repeat=$1;''/e; 
  852         $colspec =~ s/^\s*\{([^\}]*)\}\s*/$celldata=$1;''/e; 
  853         if ($celldata =~ /\{/ ) {
  854         local($databit) = $celldata;
  855         local($numopens); $celldata =~ s/\{/$numopens++;"\{"/eg;
  856         while (($colspec)&& $numopens) {
  857             if ($colspec =~ s/^([^\}]*)\}//) {
  858             $databit=$1; $celldata.="\}".$databit;
  859             $databit =~ s/\{/$numopens++;"\{"/eg;
  860             --$numopens;
  861             } else { $databit = ''; }
  862         }
  863         }
  864 
  865         while ($repeat > 1) {
  866         $colspec = $celldata . $colspec;
  867 #       &make_unique_p($colspec) if ($colspec =~ /$OP/);
  868 #       &make_unique($colspec) if ($colspec =~ /$O/);
  869         $repeat--;
  870         };
  871         $colspec = $celldata . $colspec;
  872     };
  873     };
  874     $colspec[$#colspec] =~ s/($art_br)?$cellclose/$at_text$1$cellclose/
  875     if ($at_text);
  876 
  877     $colspec[0] = $prefix . $colspec[0];
  878     ('',$frames,$rules,$cols,@colspec);
  879 }
  880 
  881 # convert \\s inside \parbox commands to <BR>s;
  882 sub convert_parbox_newlines {
  883     local($ptext) = @_;
  884     $ptext =~ s/\\\\\s*/\\newline /og;
  885     $ptext;
  886 }
  887 
  888 sub do_cmd_mathon {
  889     local($_) = @_;
  890     s/\\mathoff\b//;
  891     local($thismath) = $`; $_=$';
  892     join ('', &do_env_math("$thismath")
  893             , &translate_commands($_));
  894 }
  895 
  896 sub process_quote {
  897     local($lquo, $text, $rquo) = @_;
  898     local($lang) = &get_current_language();
  899     join('','<Q', $lang , '>'
  900     , &translate_commands( &translate_environments ($text))
  901     , '</Q>' );
  902 }
  903 
  904 sub do_env_tabular { &process_tabular(0,@_[0]); }
  905 sub do_env_tabularx { &do_env_tabularstar(@_); }
  906 
  907 
  908 sub do_env_tabularstar {
  909     local($_) = @_;
  910     local($width,$pxs);
  911     $width = &missing_braces unless (
  912         (s/$next_pair_pr_rx/$width = $2;''/e)
  913         ||(s/$next_pair_rx/$width = $2;''/e));
  914     ($pxs,$width) = &convert_length($width);
  915     $pxs = (100 x $pxs)."$percent_mark" if (($pxs)&&($pxs <= 1 ));
  916     &process_tabular($pxs,$_);
  917 }
  918 
  919 sub do_cmd_tablehead {
  920    local($_) = @_;
  921    local($text);
  922    $text = &missing_braces unless (
  923         (s/$next_pair_pr_rx/$text = $2;''/e)
  924         ||(s/$next_pair_rx/$text = $2;''/e));
  925    $TABLE_TITLE_TEXT = $text;
  926    $_;
  927 }
  928 sub do_cmd_tabletail {
  929    local($_) = @_;
  930    local($text);
  931    $text = &missing_braces unless (
  932         (s/$next_pair_pr_rx/$text = $2;''/e)
  933         ||(s/$next_pair_rx/$text = $2;''/e));
  934    $TABLE_TAIL_TEXT = $text;
  935    $_;
  936 }
  937 
  938 
  939 sub process_tabular {
  940     local($tab_width,$_) = @_;
  941     local(@save_open_tags_tabular) = @saved_tags;
  942     local($open_tags_R) = [];
  943     local(@save_open_tags) = ();
  944 
  945     &get_next_optional_argument;
  946     local($colspec);
  947     $colspec = &missing_braces unless (
  948         (s/$next_pair_pr_rx/$colspec = $2;''/e)
  949         ||(s/$next_pair_rx/$colspec = $2;''/e));
  950     s/\\\\\s*\[([^]]+)\]/\\\\/g;  # TKM - get rid of [N.n pc] on end of rows...
  951     s/\\newline\s*\[([^]]+)\]/\\newline/g;
  952     s/\n\s*\n/\n/g; # Remove empty lines (otherwise will have paragraphs!)
  953     s/\\\\\s*\n\s*$par_rx\s*\n/\\\\\n/g; # don't start next row with a \par
  954     local($i,@colspec,$char,$cols,$cell,$htmlcolspec,$frames,$rules);
  955     local(@rows,@cols,$border,$frame);
  956     local($colspan,$cellcount);
  957 
  958     # set a flag to indicate whether there are any \multirow cells
  959     my $has_multirow = 1 if (/\\multirow/s);
  960 
  961     # convert \\s inside \parbox commands to \newline s;
  962     # catch nestings
  963 
  964     while (/\\parbox/) {
  965     local($parlength) = length($_);
  966     s/$wrap_parbox_rx/&convert_parbox_newlines($6)/egm;
  967 
  968     if ($parlength == length($_)) {
  969         print "\n*** \\parbox's remain in table!!\n";
  970         last; # avoid looping
  971     }
  972     }
  973 
  974     # save start and end tags for cells, inherited from outside
  975     $open_tags_R = [ @save_open_tags_tabular ];
  976     local($closures,$reopens) = &preserve_open_tags;
  977     $open_tags_R = [ @save_open_tags_tabular ];
  978 
  979     if ($color_env) {
  980     local($color_test) = join(',',@$open_tags_R);
  981     if ($color_test =~ /(color\{[^}]*\})/g ) {
  982         $color_env = $1;
  983     }
  984     }
  985 
  986     # catch outer captions, so they cannot get caught by sub-tabulars
  987     local($table_captions);
  988     if ($TABLE_CAPTIONS) { # captions for super-tabular environment
  989     $cap_env = 'table' unless $cap_env;
  990     $captions = $TABLE_CAPTIONS;
  991     $TABLE_CAPTIONS = '';
  992     }
  993     if ($cap_env && $captions) {
  994     $captions =~ s/\n+/\n/g;
  995     $table_captions = "\n<CAPTION>$captions</CAPTION>";
  996     $captions = '';
  997 #   $cap_anchors = '';
  998     }
  999 
 1000     # *must* process any nested table-like sub-environments,
 1001     # so might as well do *all* sub-environments
 1002     # using styles inherited from outside
 1003 
 1004     local($inside_tabular) = 1;
 1005     $_ = &translate_environments($_)
 1006     if (/$begin_env_rx|$begin_cmd_rx/);
 1007 
 1008     # kill all tags
 1009     @save_open_tags = ();
 1010     $open_tags_R = [];
 1011 
 1012     $_ =~ s/<\#rm\#>/\\rm /g;
 1013     # environments may be re-processed within a cell
 1014     $_ =~ s/$OP(\d+)$CP/$O$1$C/g;
 1015     undef $inside_tabular;
 1016     
 1017     $border = ""; $frame = "";
 1018     ($htmlcolspec,$frames,$rules,$cols,@colspec) =
 1019     &translate_colspec($colspec, 'TD');
 1020     local($ecell) = '</TD>';
 1021 
 1022     print "\nCOLSPEC: ", join('',@colspec),"\n" if ($VERBOSITY > 3);
 1023 
 1024     $frames .= "t" if ( s/^\s*\\hline// );
 1025     $frames .= "b" if ( s/\\hline\s*$// );
 1026     $rules  .= "r" if ( s/\\[hv]line//g );
 1027     #RRM:  retain any \cline to gobble its argument
 1028 
 1029     if ( $frames || $rules ) { $border = " BORDER=\"1\""; };
 1030 
 1031     # convert \\s inside \parbox commands to \newline s;
 1032     # catch nestings
 1033 
 1034     s/\\\\[ \t]*\[[^\]]*]/\\\\/g; # remove forced line-heights
 1035     @rows = split(/\\\\/);
 1036 
 1037     $#rows-- if ( $rows[$#rows] =~ /^\s*$/ );
 1038     if ($tab_width) {
 1039     if ($tab_width =~ /(\%|$percent_mark)/) { $tab_width = "\"$tab_width\"" }
 1040     elsif ($tab_width <= 1) {$tab_width = "\"".(100 x $tab_width)."\"" }
 1041     $tab_width = " WIDTH=$tab_width";
 1042     } else { $tab_width = '' }
 1043 
 1044 #    if ($TABLE_CAPTIONS) { # captions for super-tabular environment
 1045 #   $cap_env = 'table' unless $cap_env;
 1046 #   $captions = $TABLE_CAPTIONS;
 1047 #   $TABLE_CAPTIONS = '';
 1048 #    }
 1049 
 1050     local($lang) = &get_current_language();
 1051     local($return);
 1052 
 1053     if ($table_captions) {
 1054     $return = join('', (($cap_anchors)? "$cap_anchors\n" : '')
 1055         , "<TABLE$env_id$lang CELLPADDING=3"
 1056         , $border
 1057         , ($halign ? " ALIGN=\"$halign\"" : '')
 1058         , $tab_width, ">");
 1059     $return .= $table_captions;
 1060 #   $return .= "\n<CAPTION$lang>$captions</CAPTION>";
 1061 #   $captions = '';
 1062 #   $cap_anchors = '';
 1063     } else { 
 1064     $return = join('', "<TABLE$env_id$lang CELLPADDING=3"
 1065         , $border
 1066         , ($halign ? " ALIGN=\"$halign\"" : '')
 1067         , $tab_width, ">");
 1068     }
 1069     $env_id = '';
 1070 
 1071     local($firstrow) = 1;
 1072     local($lastrow) = '';
 1073     local($headcell) = 0;
 1074     local($table_tail_marker) = "<table_tail_mark>";
 1075     @rows = ($TABLE_TITLE_TEXT, @rows) if ($TABLE_TITLE_TEXT);
 1076     @rows = (@rows, $table_tail_marker . $TABLE_TAIL_TEXT)
 1077     if ($TABLE_TAIL_TEXT);
 1078 
 1079     local @row_spec = map {'0'} @colspec if ($has_multirow);
 1080     foreach (@rows) {
 1081     #ignore lone <P> caused by extra blank line in table; e.g. at end
 1082     next if (/^\s*(<[<#]\d+[#>]>)<P[^>]*>\1\s*$/s);
 1083     next if (/^\s*${closures}<P[^>]*>${reopens}\s*$/s);
 1084 
 1085     #ignore <P> at the start of a row
 1086     s/^\s*(${closures})\s*<P[^>]*>\n/$1/s;
 1087 
 1088     # discard long-table headers, footers and kill-rows;
 1089     s/^.*\\end(first|last)?(head|foot)//mg if $firstrow;
 1090     next if /\\kill/;
 1091     next if ((/^\s*$/)&&($firstrow));
 1092     #ignore widowed \hline and \cline commands; e.g. on last line
 1093     next if (
 1094   (/^\s*\\(hline|cline(<[<#]\d+[#>]>)(<[<#]\d+[#>]>)?\d+\3?\-(<[<#]\d+[#>]>)?\d+\4?\2)?\s*$/)
 1095         &&($border));
 1096     $lastrow = 1 if (s/^$table_tail_marker//);
 1097 
 1098     print "\nTABLE-ROW: $_\n" if ($VERBOSITY > 3);
 1099 
 1100     local($valign) = ' VALIGN=';
 1101     if ($NETSCAPE_HTML) { $valign .= '"BASELINE"' }
 1102     else { $valign = '' }
 1103     $return .= "\n<TR$valign>";
 1104     @cols = split(/$html_specials{'&'}/o);
 1105 
 1106     if ($has_multirow) {
 1107         # decrement the counters for multi-row cells 
 1108         my @trow_spec = map {$_>0? --$_ : 0 } @row_spec;
 1109         @row_spec = @trow_spec;
 1110     }
 1111 
 1112     for ( $i = 0; $i <= $#colspec; $i++ ) {
 1113         # skip this cell if it is covered by a \multirow
 1114         if ($has_multirow && @row_spec[$i] > 0) {
 1115             shift(@cols);
 1116             next;
 1117         }
 1118 
 1119         $colspec = $colspec[$i];
 1120         if (!($colspec =~ $content_mark)) {
 1121         # no data required in this column
 1122         $colspec = &translate_environments($colspec);
 1123         $colspec = &translate_commands($colspec)
 1124             if ($colspec =~ /\\/);
 1125         $return .= $colspec;
 1126         next;
 1127         }
 1128         $colspan = 0; $cell_done = '';
 1129         $cell = shift(@cols);
 1130         # Attempt to identify title cells
 1131         if (($firstrow || !$i)
 1132             && ($cell =~ /^\s*\\((text)?(bf|it|sf)|large)/i)) {
 1133         $headcell = 'TH';
 1134         } else { $headcell = '' }
 1135         $colspec =~ s/(<\/?T)D/$1H/g
 1136         if (($firstrow &&($TABLE_TITLE_TEXT))
 1137             ||($lastrow &&($TABLE_TAIL_TEXT)));
 1138 
 1139         print "\nTABLE-CELL: $cell\n" if ($VERBOSITY > 3);
 1140 
 1141         # remove any \parbox commands, leaving the contents
 1142         #RRM:  actually, there shouldn't be any left  :-) 
 1143         $cell =~ s/\\parbox[^<]*<<(\d*)>>([\w\W]*)<<\1>>/$1/g;
 1144 
 1145         local($num);
 1146         # May modify $colspec
 1147         if ($cell =~ /\s*\\(multicolumn|omit)/) {
 1148         $cell_done = 1 if ($1 =~ /omit/);
 1149         if(@save_open_tags_tabular) {
 1150             $open_tags_R = [ @save_open_tags_tabular ];
 1151             @save_open_tags = @save_open_tags_tabular;
 1152         }
 1153         $cell = &translate_environments($cell);
 1154         $cell = $reopens . &translate_commands($cell);
 1155         $cell .= &close_all_tags() if (@$open_tags_R);
 1156         } elsif ($colspec =~ /\\/g) {
 1157         local($tmp, $cmd, $endspec);
 1158         $colspec =~ /$content_mark/; $colspec = $`.$&;
 1159         $endspec = $'; $endspec =~ s/$ecell\s*//;
 1160         $colspec .= $endspec;
 1161         local($orig_spec) = $colspec;
 1162         local(@cmds) = (split(/\\/,$colspec));
 1163         $colspec = '';
 1164         while ($tmp = pop @cmds) {
 1165             $cmd = '';
 1166             $tmp =~ s/^([a-zA-Z]+)\s*/$cmd=$1;''/e;
 1167             if ($declarations{$cmd}||
 1168     ($cmd =~ /($sizechange_rx)|($image_switch_rx)|($env_switch_rx)/)) {
 1169             $id = ++$global{'max_id'};
 1170             $colspec = join('',"$O$id$C","\\$cmd"
 1171                 , (($tmp =~/^[a-zA-Z]/)? " ":'')
 1172                 , "$tmp", $colspec, "$O$id$C");
 1173             } else {
 1174             $colspec = join('',"\\$cmd"
 1175                 , (($tmp =~/^[a-zA-Z]/)? " ":''), "$tmp", $colspec);
 1176             }
 1177         }
 1178         $colspec =~ s/^\\//; #remove unwanted initial \
 1179         $colspec = join('',@cmds,$colspec);
 1180         if ($colspec =~ /\\/) {
 1181             $colspec =~ s/$content_mark/$cell/;
 1182         } else { 
 1183             $colspec =~ s/$content_mark${O}1$C/$cell${O}1$C/;
 1184         }
 1185         $colspec =~ s/\\mathon([.\n]*)\\mathoff/
 1186             local($tmp) = ++$global{'max_id'};
 1187     "\\begin$OP$tmp${CP}math$OP$tmp$CP$1\\end$OP$tmp${CP}math$OP$tmp$CP"
 1188             /eg;
 1189         undef $cmd; undef $tmp; undef $endspec; undef @cmds;
 1190 
 1191         local($tmp) = ++$global{'max_id'};
 1192         if(@save_open_tags_tabular) {
 1193             $open_tags_R = [ @save_open_tags_tabular ];
 1194             @save_open_tags = @save_open_tags_tabular;
 1195         }
 1196         $colspec = &translate_environments("$OP$tmp$CP$colspec$OP$tmp$CP");
 1197         $colspec = &translate_commands($colspec);
 1198         while ($colspec =~ s/<(\w+)>\s*<\/\1>//gm) {};
 1199         $colspec = ';SPMnbsp;' if ($colspec =~ /^\s*$/);
 1200         $colspec = join('', $reopens, $colspec
 1201                 , (@$open_tags_R ? &close_all_tags() : '')
 1202                 , $ecell, "\n" );
 1203         local($cell_done);
 1204         } else {
 1205         local($tmp) = ++$global{'max_id'};
 1206         if(@save_open_tags_tabular) {
 1207             $open_tags_R = [ @save_open_tags_tabular ];
 1208             @save_open_tags = @save_open_tags_tabular;
 1209         }
 1210         $cell = &translate_environments("$OP$tmp$CP$cell$OP$tmp$CP");
 1211         $cell = &translate_commands($cell) if ($cell =~ /\\/);
 1212         $cell = join('', $reopens, $cell
 1213             , (@$open_tags_R ? &close_all_tags() : '')
 1214             );
 1215         }
 1216         # remove remains of empty braces
 1217         $cell =~ s/(($O|$OP)\d+($C|$CP))//g;
 1218         # remove leading/trailing space
 1219         $cell =~ s/^\s*|\s*$//g;
 1220         $cell = ";SPMnbsp;" if ($cell eq '');
 1221 
 1222         if ( $colspan ) {
 1223         for ( $cellcount = 0; $colspan > 0; $colspan-- ) {
 1224 #           $colspec[$i++] =~ s/<TD/$cellcount++;"<$celltype"/ge;
 1225             $i++; $cellcount++;
 1226         }
 1227         $i--;
 1228         $colspec =~ s/>$content_mark/ COLSPAN=$cellcount$&/;
 1229         };
 1230 
 1231         $colspec =~ s/$content_mark/$cell/ unless ($cell_done);
 1232 
 1233         if ($headcell) {
 1234         $colspec =~ s/<TD/<$headcell/g;
 1235         $colspec =~ s/<\/TD/<\/$headcell/g;
 1236         }
 1237         $return .= $colspec;
 1238         undef $cell_done;
 1239     };
 1240     $return .= "</TR>";
 1241     $firstrow = 0;
 1242     };
 1243     $open_tags_R = [ @save_open_tags_tabular ];
 1244     $TABLE_TITLE_TEXT = '';
 1245     $TABLE_TAIL_TEXT = '';
 1246     $return =~ s/$OP\d+$CP//g;
 1247     $return =~ s/<(T[DH])( [^>]+)?>\s*($content_mark)?(<\/\1>)/<$1$2>;SPMnbsp;$4/g;
 1248     $return . "\n</TABLE>";
 1249 }
 1250 
 1251 ### Define the multicolumn command
 1252 # Modifies the $colspec and $colspan variables of the tabular subroutine
 1253 sub do_cmd_multicolumn {
 1254     local($_) = @_;
 1255     local($dmy1,$dmy2,$dmy3,$dmy4,$spancols,$malign,$text);
 1256     $spancols = &missing_braces unless (
 1257     (s/$next_pair_pr_rx/$spancols=$2;''/eo)
 1258         ||(s/$next_pair_rx/$spancols=$2;''/eo));
 1259     $colspan = 0+$spancols;
 1260     $colspec =~ /^<([A-Z]+)/;
 1261     local($celltag) = $1;
 1262     $malign = &missing_braces unless (
 1263     (s/$next_pair_pr_rx/$malign=$2;''/eo)
 1264     ||(s/$next_pair_rx/$malign=$2;''/eo));
 1265 
 1266     # catch cases where the \textwidth has been discarded
 1267     $malign =~s!^(\w)($OP\d+$CP)\s*(\d|\d*\.\d+)\2$!$1\{$3\\textwidth\}!;
 1268 
 1269     ($dmy1,$dmy2,$dmy3,$dmy4,$colspec) = &translate_colspec($malign, $celltag);
 1270     $text = &styled_text_chunk('SPAN','mcol','','','','', $_);
 1271     $text = &translate_commands($text) if ($text =~ /\\/);
 1272     $text;
 1273 }
 1274 
 1275 ## Mathematics environments
 1276 
 1277 sub process_math_env {
 1278     local($mode,$_) = @_;
 1279     local($labels, $comment);
 1280     ($_,$labels) = &extract_labels($_); # extract labels
 1281     $comment = &make_math_comment($_);
 1282     local($max_id) = ++$global{'max_id'};
 1283     if ($failed) { return($labels, $comment, $_) };
 1284     $_ = &simple_math_env($_);
 1285     if ($BOLD_MATH) {
 1286         ($labels, $comment, join('','<SPAN CLASS="BOLDMATH">', $_, '</SPAN>'))
 1287     } else { 
 1288         ($labels, $comment, join('','<SPAN CLASS="MATH">', $_ ,'</SPAN>')) 
 1289     }
 1290 }
 1291 
 1292 sub make_math_comment{
 1293     local($_) = @_;
 1294     local($scomm,$ecomm)=("\$","\$");
 1295     return() if ($inside_tabbing||(/$image_mark/));
 1296     do {
 1297         $scomm = "\\begin{$env}\n";
 1298     $ecomm = "\n\\end{$env}";
 1299     } unless ($env =~/tex2html/);
 1300     $_ = &revert_to_raw_tex;
 1301     s/^\s+//s; s/\s+$//sm;
 1302     $_ = $scomm . $_ . $ecomm;
 1303     return() if (length($_) < 16);
 1304     $global{'verbatim_counter'}++;
 1305     $verbatim{$global{'verbatim_counter'}} = $_;
 1306     &write_mydb('verbatim_counter', $global{'verbatim_counter'}, $_ );
 1307     join('', "\n", $verbatim_mark, '#math' , $global{'verbatim_counter'},'#')
 1308 } 
 1309 
 1310 sub do_env_math {
 1311     local($_) = @_;
 1312     local($math_mode, $failed, $labels, $comment, $img_params) = ("inline",'','');
 1313     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1314     local($attribs, $border);
 1315     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1316     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1317     local($saved) = $_;
 1318     $saved =~ s/^\s*(\$|\\\()?\s*/\$/;
 1319     $saved =~ s/\s*(\$|\\\))?\s*$/\$/;
 1320     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1321     $comment =~ s/^\n//; # remove the leading \n
 1322     if ($failed) {
 1323     $_ = join ('', $comment, $labels
 1324         , '<SPAN CLASS="MATH">'
 1325             , &process_undefined_environment("tex2html_wrap_inline", $id, $saved)
 1326         , '</SPAN>' );
 1327     } else { $_ = join('', $comment, $labels, $_ ) }
 1328     if ($border||($attributes)) {
 1329         &make_table( $border, $attribs, '', '', '', $_ )
 1330     } else { $_ }
 1331 }
 1332 
 1333 sub do_env_tex2html_wrap {
 1334     local($_) = @_;
 1335     local($math_mode, $failed, $labels, $comment,$img_params) = ("inline",'','');
 1336     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1337     local($attribs, $border);
 1338     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1339     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1340     local($saved) = $_;
 1341     s/^\\\(//;    s/\\\)$//;
 1342     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1343     $comment =~ s/^\n//; # remove the leading \n
 1344     if ($failed) {
 1345     $_ = join ('', $comment, $labels 
 1346              , &process_undefined_environment("tex2html_wrap", $id, $saved));
 1347     } else { $_ = $comment . $labels ." ".$_; }
 1348     if ($border||($attribs)) {
 1349         &make_table( $border, $attribs, '', '', '', $_ )
 1350     } else { $_ }
 1351 }
 1352 
 1353 sub do_env_tex2html_wrap_inline {
 1354     local($_) = @_;
 1355     local($math_mode, $failed, $labels, $comment) = ("inline",'','');
 1356     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1357     local($attribs, $border);
 1358     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1359     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1360     local($saved) = $_;
 1361     s/(^\s*(\$|\\\()\s*|\s*(\$|\\\))\s*$)//g; # remove the \$ signs or \(..\)
 1362 
 1363     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1364     $comment =~ s/^\n//; # remove the leading \n
 1365     if ($failed) {
 1366     if ($USING_STYLES) {
 1367         $env_id =~ s/\"$/ image\"/;
 1368         $env_id = ' CLASS="MATH"' if ($env_id =~ /^\s*$/);
 1369         $_ = join ('', $labels, $comment, "<SPAN$env_id>"
 1370         , &process_undefined_environment("tex2html_wrap_inline", $id, $saved)
 1371         , "</SPAN>");
 1372         $env_id = '';
 1373     } else {
 1374         $_ = join ('', $labels, $comment 
 1375         , &process_undefined_environment("tex2html_wrap_inline", $id, $saved));
 1376     }
 1377     } else { $_ = join('', $labels, $comment, $_); }
 1378     if ($border||($attribs)) { 
 1379     &make_table( $border, $attribs, '', '', '', $_ ) 
 1380     } else { $_ }
 1381 }
 1382 
 1383 # Allocate a fixed width for the equation-numbers:
 1384 #$seqno = "\n<TD WIDTH=1 ALIGN=\"CENTER\">\n";
 1385 
 1386 sub do_env_equation {
 1387     local($_) = @_;
 1388     local($math_mode, $failed, $labels, $comment) = ("equation",'','');
 1389     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1390     local($attribs, $border);
 1391     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1392     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1393     local($saved) = $_;
 1394     local($sbig,$ebig,$falign) = ('','','CENTER');
 1395     ($sbig,$ebig) = ('<BIG>','</BIG>')
 1396     if (($DISP_SCALE_FACTOR)&&($DISP_SCALE_FACTOR >= 1.2 ));
 1397     local($math_start,$math_end)= ($sbig,$ebig);
 1398 
 1399     local($eqno);
 1400     local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
 1401                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 1402                  , "\">\n");
 1403     do { # get the equation number
 1404     $global{'eqn_number'}++;
 1405     $eqno = &translate_commands('\theequation');
 1406     } unless ((s/(\\nonumber|\\notag)//gm)||(/\\tag/));
 1407     if (/\\tag(\*)?/){
 1408     # AmS-TEX line-number tags.
 1409     if (defined  &get_eqn_number ) {
 1410         ($eqno, $_) = &get_eqn_number(1,$_);
 1411     } else {
 1412         s/\\tag(\*)?//m;
 1413         local($nobrack,$before) = ($1,$`);
 1414         $_ = $';
 1415         s/next_pair_pr_rx//om;
 1416         if ($nobrack) { $eqno = $2; }
 1417         else { $eqno = join('',$EQNO_START, $2, $EQNO_END) };
 1418         $_ = $before;
 1419     }
 1420     } elsif ($eqno) {
 1421     $eqno = join('',$EQNO_START, $eqno, $EQNO_END)
 1422     } else { $eqno = '&nbsp;' } # spacer, when no numbering
 1423 
 1424     # include the equation-number, using a <TABLE>
 1425     local($halign) = " ALIGN=\"CENTER\"" unless $FLUSH_EQN;
 1426     local($lang) = &get_current_language();
 1427     if ($EQN_TAGS =~ /L/) {
 1428     # equation number on left
 1429     ($math_start,$math_end) =
 1430         ("\n<TABLE$env_id$lang WIDTH=\"100%\" ALIGN=\"CENTER\""
 1431         . (($border)? " BORDER=\"$border\"" : '')
 1432         . (($attribs)? " $attribs" : '')
 1433         . ">\n<TR VALIGN=\"MIDDLE\">". $seqno . $eqno
 1434         . "</TD>\n<TD$halign NOWRAP>$sbig"
 1435         , "$ebig</TD>\n</TR></TABLE>");
 1436     $border = $attribs = $env_id = '';
 1437     } else {
 1438     # equation number on right
 1439     ($math_start,$math_end) =
 1440         ("\n<TABLE$env_id$lang WIDTH=\"100%\" ALIGN=\"CENTER\""
 1441         . (($border)? " BORDER=\"$border\"" : '')
 1442         . (($attribs)? " $attribs" : '')
 1443         . ">\n<TR VALIGN=\"MIDDLE\"><TD></TD>"
 1444         . "<TD$halign NOWRAP>$sbig"
 1445         , $ebig .'</TD>'. $seqno . $eqno ."</TD></TR>\n</TABLE>");
 1446     $border = $attribs = $env_id = '';
 1447     }
 1448 
 1449     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1450     if ($failed) {
 1451     $_ = join ('', $comment, $labels, $math_start
 1452         , &process_undefined_environment('displaymath', $id, $saved)
 1453         , $math_end );
 1454     } else {
 1455     s/^[ \t]*\n?/\n/; s/\n?[ \t]*$/\n/;
 1456     $_ = join('', $comment, $labels, $math_start, $_, $math_end );
 1457     }
 1458     if ($border||($attribs)) { 
 1459     join('',"<BR>\n<DIV$math_class>\n"
 1460         , &make_table( $border, $attribs, '', '', '', $_ )
 1461         , "\n<BR CLEAR=\"ALL\">");
 1462     } elsif ($failed) {
 1463     $falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT') if ($eqno);
 1464     local($fclass) = $math_class;
 1465     $fclass =~ s/(ALIGN=\")[^"]*/$1$falign/;
 1466     join('',"<BR>\n<DIV$fclass>\n"
 1467         , $_ , "\n<BR CLEAR=\"ALL\"></DIV><P></P>")
 1468     } else { 
 1469     join('', "<BR><P></P>\n<DIV$math_class>\n"
 1470         , $_ ."\n</DIV><BR CLEAR=\"ALL\"><P></P>");
 1471     }
 1472 }
 1473 
 1474 sub do_env_displaymath {
 1475     local($_) = @_;
 1476     local($math_mode, $failed, $labels, $comment) = ("display",'','');
 1477     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1478     local($attribs, $border);
 1479     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1480     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1481     local($saved) = $_;
 1482     local($halign) = " ALIGN=\"CENTER\"" unless $FLUSH_EQN;
 1483     local($sbig,$ebig);
 1484     ($sbig,$ebig) = ('<BIG>','</BIG>')
 1485     if (($DISP_SCALE_FACTOR)&&($DISP_SCALE_FACTOR >= 1.2 ));
 1486     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1487     if ($failed) {
 1488     $_ = &process_undefined_environment("displaymath", $id, $saved);
 1489     s/^[ \t]*\n?/\n/; s/\n?[ \t]*$/\n/; 
 1490     $_ = (($comment.$labels)? "$comment$labels\n":''). $_;
 1491     } else {
 1492     s/^[ \t]*\n?/\n/; s/\n?[ \t]*$/\n/;
 1493     $_ = (($comment.$labels)? "$comment$labels\n":'').$sbig.$_.$ebig;
 1494     }
 1495     if ($border||($attribs)) {
 1496     join('',"<BR>\n<DIV$math_class>\n"
 1497             , &make_table( $border, $attribs, '', '', '', $_ )
 1498         , "</DIV>\n<BR CLEAR=\"ALL\">");
 1499     } else { 
 1500         join('',"<BR><P></P>\n<DIV$math_class>",$_
 1501             ,"</DIV><BR CLEAR=\"ALL\">\n<P></P>");
 1502     }
 1503 }
 1504 
 1505 
 1506 ### Multiline formulas
 1507 
 1508 sub do_env_eqnarray {
 1509     local($_) = @_;
 1510     local($math_mode, $failed, $labels, $comment, $doimage) = ("equation",'','');
 1511     local($attribs, $border);
 1512     if (s/$htmlborder_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1513     elsif (s/$htmlborder_pr_rx//o) { $attribs = $2; $border = (($4)? "$4" : 1) }
 1514     local($saved) = $_;
 1515     local($sbig,$ebig,$falign) = ('','','CENTER');
 1516     ($sbig,$ebig) = ('<BIG>','</BIG>')
 1517     if (($DISP_SCALE_FACTOR)&&($DISP_SCALE_FACTOR >= 1.2 ));
 1518     local($valign) = join('', ' VALIGN="', 
 1519     ($NETSCAPE_HTML)? "BASELINE" : "MIDDLE", '"');
 1520     $failed = 1; # simplifies the next call
 1521     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1522     $failed = 0 unless ($no_eqn_numbers);
 1523     if ((($failed)&&($NO_SIMPLE_MATH))
 1524     ||(/$htmlimage_rx|$htmlimage_pr_rx/)) {
 1525 #   ||((/$htmlimage_rx|$htmlimage_pr_rx/)&&($& =~/thumb/))) {
 1526     # image of whole environment, no equation-numbers
 1527     $failed = 1;
 1528     $falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT')
 1529         unless $no_eqn_numbers;
 1530     $_ = join ('', $comment
 1531         , &process_undefined_environment(
 1532         "eqnarray".(($no_eqn_numbers) ? "star" : '')
 1533         , $id, $saved));
 1534     local($fclass) = $math_class;
 1535     $fclass =~ s/(ALIGN=\")[^"]*/$1$falign/;
 1536     $_ = join('',"<P></P><DIV$fclass>"
 1537         , $_, "</DIV><BR CLEAR=\"ALL\"><P></P>\n");
 1538     } else {
 1539     $failed = 0;
 1540     s/$htmlimage_rx/$doimage = $&;''/eo ; # force an image
 1541     s/$htmlimage_pr_rx/$doimage .= $&;''/eo ; # force an image
 1542     local($sarray, $srow, $slcell, $elcell, $srcell, $ercell, $erow, $earray);
 1543     ($sarray, $elcell, $srcell, $erow, $earray, $sempty) = ( 
 1544         "\n<TABLE$env_id$lang CELLPADDING=\"0\" ALIGN=\"CENTER\""
 1545         , "</TD>\n<TD ALIGN=\"CENTER\" NOWRAP>"
 1546         , "</TD>\n<TD ALIGN=\"LEFT\" NOWRAP>"
 1547         , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
 1548     $env_id = '';
 1549     $sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
 1550     local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
 1551         , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 1552         , "\">\n");
 1553     if ($EQN_TAGS =~ /L/) { # number on left
 1554         ($srow, $slcell, $ercell) = (
 1555         "\n<TR$valign>" . $seqno
 1556         , "</TD>\n<TD NOWRAP ALIGN=", '');
 1557     } else { # equation number on right
 1558         ($srow, $slcell, $ercell) = ("\n<TR$valign>"
 1559         , "<TD NOWRAP ALIGN="
 1560         , '</TD>'. $seqno );
 1561     }
 1562 
 1563     $_ = &protect_array_envs($_);
 1564 
 1565     local(@rows,@cols,$eqno,$return,$thismath,$savemath);
 1566     s/\\\\[ \t]*\[[^\]]*]/\\\\/g; # remove forced line-heights
 1567     @rows = split(/\\\\/);
 1568     $#rows-- if ( $rows[$#rows] =~ /^\s*$/ );
 1569     $return = join(''
 1570         , (($border||($attribs))? '': "<BR>")
 1571         , (($doimage)? '' : "\n<DIV ALIGN=\"CENTER\">")
 1572         , (($labels)? $labels : "\n") , $comment, $sarray);
 1573     foreach (@rows) { # displaymath
 1574         $eqno = '';
 1575         do { 
 1576         $global{'eqn_number'}++ ;
 1577         $eqno = &simplify(&translate_commands('\theequation'));
 1578         } unless ((s/\\nonumber//)||($no_eqn_numbers));
 1579         if (/\\tag(\*)?/){
 1580         if (defined &get_eqn_number) {
 1581             # AmS-TEX line-number tags.
 1582             ($eqno, $_) = &get_eqn_number(1,$_);
 1583         } else {
 1584             s/\\tag(\*)?//;
 1585             local($nobrack,$before) = ($1,$`);
 1586             $_ = $';
 1587             s/next_pair_pr_rx//o;
 1588             if ($nobrack) { $eqno = $2 }
 1589             else { $eqno = join('',$EQNO_START,$2,$EQNO_END) }
 1590             $_ = $before;
 1591         }
 1592         } elsif ($eqno) {
 1593         $eqno = join('',$EQNO_START, $eqno, $EQNO_END)
 1594         } else { $eqno = '&nbsp;' } # spacer, when no numbering
 1595 
 1596         $return .= $srow;
 1597         $return .= $eqno if ($EQN_TAGS =~ /L/);
 1598         $return .= $slcell;
 1599 #       if (s/\\lefteqn$OP(\d+)$CP(.*)$OP\1$CP/ $2 /) {
 1600         if (s/\\lefteqn//) {
 1601         $return .= "\"LEFT\" COLSPAN=\"3\">";
 1602         s/(^\s*|$html_specials{'&'}|\s*$)//gm;
 1603         if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 1604             $_ = (($_)? &process_math_in_latex(
 1605                 "indisplay" , '', '', $doimage.$_ ):'');
 1606             $return .= join('', $_, $erow) if ($_);
 1607         } elsif ($_ ne '') {
 1608             $savemath = $_; $failed = 0;
 1609             $_ = &simple_math_env($_);
 1610             if ($failed) {
 1611             $_ = &process_math_in_latex(
 1612                 "indisplay",'','',$savemath);
 1613             $return .= join('', $_, $erow) if ($_);
 1614             } elsif ($_ ne '') {
 1615             $return .= join('', $sbig, $_, $ebig, $erow)
 1616             }
 1617         }
 1618         $return .= join('',";SPMnbsp;", $erow) if ($_ eq ''); 
 1619         next;
 1620         }
 1621 
 1622         # columns to be set using math-modes
 1623         @cols = split(/$html_specials{'&'}/o);
 1624 
 1625         # left column, set using \displaystyle
 1626         $thismath = shift(@cols); $failed = 0;
 1627         $thismath =~ s/(^\s*|\s*$)//gm;
 1628         if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 1629         $thismath = (($thismath ne '')? &process_math_in_latex(
 1630             "indisplay" , '', '', $doimage.$thismath ):'');
 1631         $return .= join('',"\"RIGHT\">",$thismath) if ($thismath ne '');
 1632         } elsif ($thismath ne '') { 
 1633         $savemath = $thismath;
 1634         $thismath = &simple_math_env($thismath);
 1635         if ($failed) {
 1636             $thismath = &process_math_in_latex(
 1637             "indisplay",'','',$savemath);
 1638             $return .= join('',"\"RIGHT\">",$thismath)
 1639         } elsif ($thismath ne '') {
 1640             $return .= join('',"\"RIGHT\">$sbig",$thismath,"$ebig")
 1641         }
 1642         }
 1643         $return .= "\"RIGHT\">\&nbsp;" if ($thismath eq '');
 1644 
 1645         # center column, set using \textstyle
 1646         $thismath = shift(@cols); $failed = 0;
 1647         $thismath =~ s/(^\s*|\s*$)//gm;
 1648         if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 1649         $thismath = (($thismath ne '')? &process_math_in_latex(
 1650             "indisplay" , 'text', '', $doimage.$thismath ):'');
 1651         $return .= join('', $elcell, $thismath) if ($thismath ne '');
 1652         } elsif ($thismath ne '') { 
 1653         $savemath = $thismath;
 1654         $thismath = &simple_math_env($thismath);
 1655         if ($failed) {
 1656             $thismath = &process_math_in_latex(
 1657             "indisplay",'text','',$savemath);
 1658             $return .= join('', $elcell, $thismath)
 1659         } elsif ($thismath ne '') {
 1660             $return .= join('', $elcell, $sbig , $thismath, $ebig)
 1661         }
 1662         }
 1663         $return .= join('', $sempty,"\&nbsp;") if ($thismath eq '');
 1664 
 1665         # right column, set using \displaystyle
 1666         $thismath = shift(@cols); $failed = 0;
 1667         $thismath =~ s/(^\s*|\s*$)//gm;
 1668         if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 1669         $thismath = (($thismath ne '')? &process_math_in_latex(
 1670             "indisplay" , '', '', $doimage.$thismath ):'');
 1671         $return .= join('', $srcell, $thismath, $ercell)
 1672             if ($thismath ne '');
 1673         } elsif ($thismath ne '') {
 1674         $savemath = $thismath;
 1675         $thismath = &simple_math_env($thismath);
 1676         if ($failed) {
 1677             $thismath = &process_math_in_latex(
 1678             "indisplay",'','',$savemath);
 1679             $return .= join('', $srcell, $thismath, $ercell)
 1680         } elsif ($thismath ne '') {
 1681             $return .= join('', $srcell, $sbig, $thismath, $ebig, $ercell)
 1682         }
 1683         }
 1684         $return .= join('', $sempty, "\&nbsp;", $ercell) if ($thismath eq '');
 1685 
 1686         $return .= $eqno unless ($EQN_TAGS =~ /L/);
 1687         $return .= $erow;
 1688     }
 1689     $_ = join('', $return , $earray, (($doimage)? '' : "</DIV>" ));
 1690     }
 1691     if ($border||($attribs)) { 
 1692     join('' #,"<BR>\n<DIV$math_class>"
 1693         , &make_table( $border, $attribs, '', '', '', $_ )
 1694         , "\n</DIV><P></P><BR CLEAR=\"ALL\">");
 1695     } else {
 1696     join('', $_ ,"<BR CLEAR=\"ALL\"><P></P>");
 1697     }
 1698 }
 1699 
 1700 sub do_env_eqnarraystar {
 1701     local($_) = @_;
 1702     local($math_mode, $failed, $labels, $comment) = ("equation",'','');
 1703     $failed = (/$htmlimage_rx|$htmlimage_pr_rx/); # force an image
 1704     local($attribs, $border);
 1705     local($saved) = $_;
 1706     local($sbig,$ebig);
 1707     ($sbig,$ebig) = ('<BIG>','</BIG>')
 1708     if (($DISP_SCALE_FACTOR)&&($DISP_SCALE_FACTOR >= 1.2 ));
 1709 
 1710     if (($NO_SIMPLE_MATH)||($failed)) {
 1711     local($no_eqn_numbers) = 1;
 1712     $_ = &do_env_eqnarray($_) unless ($failed);
 1713     if ($failed) {
 1714         if ($saved =~ s/$htmlborder_rx//o) {
 1715         $attribs = $2; $border = (($4)? "$4" : 1)
 1716         } elsif ($saved =~ s/$htmlborder_pr_rx//o) {
 1717         $attribs = $2; $border = (($4)? "$4" : 1)
 1718         }
 1719         $_ = join('', $labels
 1720         , &process_undefined_environment("eqnarray*", $id, $saved));
 1721     }
 1722     } else {
 1723     if (s/$htmlborder_rx//o) {
 1724         $attribs = $2; $border = (($4)? "$4" : 1)
 1725     } elsif (s/$htmlborder_pr_rx//o) {
 1726         $attribs = $2; $border = (($4)? "$4" : 1)
 1727     }
 1728     $saved = $_;
 1729     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
 1730     if ($failed) {
 1731         $_ = join('', $labels
 1732         , &process_undefined_environment("eqnarray*", $id, $saved));
 1733     }
 1734     }
 1735     if ($border||($attribs)) { 
 1736     join('' #,"<BR>\n<DIV$math_class>"
 1737         , &make_table( $border, $attribs, '', '', '', $_ )
 1738         , "\n</DIV><P></P><BR CLEAR=\"ALL\">");
 1739     } elsif ($failed) {
 1740     $_ =~ s/^[ \t]*\n?/\n/; 
 1741     $_ =~ s/\n?[ \t]*/\n/;
 1742     join('', "<BR><P></P>\n<DIV$math_class>"
 1743         , $_ ,"\n</DIV><P></P><BR CLEAR=\"ALL\">");
 1744     } elsif ($_ =~ s!(</TABLE></DIV>)\s*(<BR[^>]*><P></P>)?\s*$!$1!si) {
 1745     join('', $_ ,"<BR>\n");
 1746     } elsif ($_ =~ m!<P></P>\s*$!si) { # below-display space present 
 1747     $_
 1748     } else {
 1749     join('', $_ ,"<BR CLEAR=\"ALL\"><P></P>");
 1750     }
 1751 }
 1752 
 1753 
 1754 $raw_arg_cmds{tabular} = 1;
 1755 $raw_arg_cmds{tabularstar} = 1;
 1756 $raw_arg_cmds{longtable} = 1;
 1757 $raw_arg_cmds{longtablestar} = 1;
 1758 $raw_arg_cmds{supertabular} = 1;
 1759 $raw_arg_cmds{supertabularstar} = 1;
 1760 
 1761 
 1762 #RRM: this package is automatically supported for {tabular} extensions
 1763 #     so suppress the warning message:
 1764 $styles_loaded{'array'} = 1;
 1765 
 1766 
 1767 &ignore_commands( <<_IGNORED_CMDS_);
 1768 extracolsep # {}
 1769 PreserveBackslash # {}
 1770 _IGNORED_CMDS_
 1771 
 1772 
 1773 &process_commands_wrap_deferred (<<_RAW_ARG_DEFERRED_CMDS_);
 1774 tablehead # {}
 1775 tabletail # {}
 1776 centerline # {}
 1777 leftline # {}
 1778 rightline # {}
 1779 _RAW_ARG_DEFERRED_CMDS_
 1780 
 1781 1;
 1782