########################################################################### # # html2latex.tag # # This is a configuration file for html2text that implements # html2latex, which translates HTML to LaTeX. # # The format of this file is perl code. See the html2text file for # more details on its contents. # # If the environment variable HTML2LATEX is defined, it should point # to a cusomization file that extends or modifies these definitions. # ########################################################################### # # Update History: # # who when what # ----- -------- ------------------------------------------ # dpvc 10/95 Wrote it. # # # Load the variables that are local to the system we are running on. # &htmlRequire("html2latex-local"); # This variable allows us to use Blackboard Bold and Fraktur characters, # along with the symbols \ltimes and \rtimes. # It may be necessary to make this an optional package installed only # when such symbols are used. # $htmlIncludeAMSSYMB = "\\usepackage{amssymb}"; # # The initialization string for when there are images to be # processed. $htmlInitialStringPS= "\\documentstyle[12pt,epsf]{article} $htmlIncludeAMSSYMB \\begin{document} \\input $h2llocation/html2latex "; # # The initialization string for when there are no images # $htmlInitialStringNoPS = "\\documentstyle[12pt]{article} $htmlIncludeAMSSYMB \\begin{document} \\input $h2llocation/html2latex "; # # The termination string for the output file # $htmlFinalString = "\n\n\\end{document}\n"; # # Load the common TeX information # ###################################################################### ### The following used to be the file html2tex-common.tag ####### ###################################################################### ########################################################################### # # html2tex-common.tag # # The format of this file is perl code. See the html2latex file for # more details on its contents. # ########################################################################### # # Update History: # # who when what # ----- -------- ------------------------------------------ # dpvc 10/95 Wrote it. # schaefer 3/98 Added the file to html2latex.tag # # The default extension for output files. # $htmlExtension = ".tex"; # # How to output "<" and "&". # $htmlLtString = '{\htmlLt}'; $htmlAmpString = '\&'; # # Allow line breaks at "\" and "{", and put a "%" at the and of a # line when it breaks at one of these places. # $htmlBreakChars = '\\\{'; $htmlBreakNL = "%"; # # Some characters need to be treated specially. We output the TeX # codes for typesetting these. # $htmlChar{"\$"} = '\$'; ###LINE110 $htmlChar{"\#"} = '\#'; $htmlChar{"{"} = '\{'; $htmlChar{"}"} = '\}'; $htmlChar{"%"} = '\%'; $htmlChar{"_"} = '\_'; $htmlChar{">"} = '{\htmlGt}'; $htmlChar{"|"} = '{\htmlBar}'; $htmlChar{"~"} = '{\htmlTilde}'; $htmlChar{"^"} = '{\htmlHat}'; $htmlChar{"\\"} = '{\htmlBackslash}'; $htmlChar{'"'} = '&htmlQuote'; # # The entities need to be converted to TeX format. # Some do not have TeX equivalents, and are left blank. # $htmlEntity{"amp"} = '\&'; $htmlEntity{"lt"} = '{\htmlLt}'; $htmlEntity{"gt"} = '{\htmlGt}'; $htmlEntity{"nbsp"} = '~'; $htmlEntity{"iexcl"} = '{\char"3C}'; $htmlEntity{"cent"} = '{\cents}'; $htmlEntity{"pound"} = '{\it\$}'; $htmlEntity{"curren"} = ''; $htmlEntity{"yen"} = ''; $htmlEntity{"brvbar"} = '\htmlBar'; $htmlEntity{"brkbar"} = '\htmlBar'; $htmlEntity{"sect"} = '\S'; $htmlEntity{"uml"} = '{\char"7F}'; $htmlEntity{"copy"} = '{\copyright}'; $htmlEntity{"ordf"} = ''; $htmlEntity{"laquo"} = '$\ll$'; $htmlEntity{"not"} = '$-$'; $htmlEntity{"shy"} = '\-'; $htmlEntity{"reg"} = ''; $htmlEntity{"hibar"} = '{\char"16}'; $htmlEntity{"deg"} = '$^\circ$'; $htmlEntity{"plusmn"} = '$\pm$'; $htmlEntity{"sup2"} = '$^2$'; $htmlEntity{"sup3"} = '$^3$'; $htmlEntity{"acute"} = '{\char"13}'; $htmlEntity{"micro"} = '$\mu$'; $htmlEntity{"para"} = '\P'; $htmlEntity{"middot"} = '$\cdot$'; $htmlEntity{"cedil"} = '{\char"18}'; $htmlEntity{"sup1"} = '$^1$'; $htmlEntity{"ordm"} = ''; $htmlEntity{"raquo"} = '$\gg$'; $htmlEntity{"frac14"} = '$\htmlFrac 1/4$'; $htmlEntity{"frac12"} = '$\htmlFrac 1/2$'; $htmlEntity{"frac34"} = '$\htmlFrac 3/4$'; $htmlEntity{"iquest"} = '{\char"3E}'; $htmlEntity{"Agrave"} = '\`A'; $htmlEntity{"Aacute"} = "\\'A"; $htmlEntity{"Acirc"} = '\^A'; $htmlEntity{"Atilde"} = '\~A'; $htmlEntity{"Auml"} = '\"A'; $htmlEntity{"Aring"} = '{\AA}'; $htmlEntity{"AElig"} = '{\AE}'; $htmlEntity{"Ccedil"} = '\c C'; $htmlEntity{"Egrave"} = '\`E'; $htmlEntity{"Eacute"} = "\\'E"; $htmlEntity{"Ecirc"} = '\^E'; $htmlEntity{"Euml"} = '\"E'; $htmlEntity{"Igrave"} = '\`I'; $htmlEntity{"Iacute"} = "\\'I"; $htmlEntity{"Icurc"} = '\^I'; $htmlEntity{"Iuml"} = '\"I'; $htmlEntity{"ETH"} = ''; $htmlEntity{"Dstrok"} = ''; $htmlEntity{"Ntilde"} = '\~N'; $htmlEntity{"Ograve"} = '\`O'; $htmlEntity{"Oacute"} = "\\'O"; $htmlEntity{"Ocirc"} = '\^O'; $htmlEntity{"Otilde"} = '\~O'; $htmlEntity{"Ouml"} = '\"O'; $htmlEntity{"times"} = '$\times$'; $htmlEntity{"Oslash"} = '{\O}'; $htmlEntity{"Ugrave"} = '\`U'; $htmlEntity{"Uacute"} = "\\'U"; $htmlEntity{"Ucirc"} = '\^U'; $htmlEntity{"Uuml"} = '\"U'; $htmlEntity{"Yacute"} = "\\'Y"; $htmlEntity{"THORN"} = ''; $htmlEntity{"szlig"} = '{\ss}'; $htmlEntity{"agrave"} = '\`a'; $htmlEntity{"aacute"} = "\\'a"; $htmlEntity{"acirc"} = '\^a'; $htmlEntity{"atilde"} = '\~a'; $htmlEntity{"auml"} = '\"a'; $htmlEntity{"aring"} = '{\aa}'; $htmlEntity{"aelig"} = '{\ae}'; $htmlEntity{"ccedil"} = '{\c c}'; $htmlEntity{"egrave"} = '\`e'; $htmlEntity{"eacute"} = "\\'e"; $htmlEntity{"ecirc"} = '\^e'; $htmlEntity{"euml"} = '\"e'; $htmlEntity{"igrave"} = '{\`\i}'; $htmlEntity{"iacute"} = "{\\'\\i}"; $htmlEntity{"icirc"} = '{\^\i}'; $htmlEntity{"iuml"} = '{\"\i}'; $htmlEntity{"eth"} = ''; $htmlEntity{"ntilde"} = '\~n'; $htmlEntity{"ograve"} = '\`o'; $htmlEntity{"oacute"} = "\\'o"; $htmlEntity{"ocirc"} = '\^o'; $htmlEntity{"otilde"} = '\~o'; $htmlEntity{"ouml"} = '\"o'; $htmlEntity{"divide"} = '$\div$'; $htmlEntity{"oslash"} = '{\o}'; $htmlEntity{"ugrave"} = '\`u'; $htmlEntity{"uacute"} = "\\'u"; $htmlEntity{"ucirc"} = '\^u'; $htmlEntity{"uuml"} = '\"u'; $htmlEntity{"yacute"} = "\\'y"; $htmlEntity{"thorn"} = ''; $htmlEntity{"yuml"} = '\"y'; $htmlEntity{"quot"} = '&htmlQuote'; # # Define the different character styles # $htmlTag{"B"} = '{\bf '; $htmlTag{"/B"} = '}'; $htmlTag{"I"} = '{\it '; $htmlTag{"/I"} = '}'; $htmlTag{"U"} = '{\sl '; $htmlTag{"/U"} = '}'; $htmlTag{"TT"} = '{\tt '; $htmlTag{"/TT"} = '}'; $htmlTag{"EM"} = '{\it '; $htmlTag{"/EM"} = '}'; $htmlTag{"STRONG"} = '{\bf '; $htmlTag{"/STRONG"} = '}'; $htmlTag{"CODE"} = '{\tt '; $htmlTag{"/CODE"} = '}'; $htmlTag{"SAMP"} = '{\tt '; $htmlTag{"/SAMP"} = '}'; $htmlTag{"CITE"} = '{\tt '; $htmlTag{"/SITE"} = '}'; $htmlTag{"KBD"} = '{\tt '; $htmlTag{"/KBD"} = '}'; $htmlTag{"VAR"} = '{\it '; $htmlTag{"/VAR"} = '}'; $htmlTag{"DFN"} = '{\rm '; $htmlTag{"/DFN"} = '}'; $htmlTag{"ADDRESS"} = "\\htmlBR{\\it "; $htmlTag{"/ADDRESS"} = "}\\htmlBR"; # # Use special macros for
and
# $htmlTag{"BR"} = "\\htmlBR\n"; $htmlTag{"HR"} = "\\htmlHR\n"; # # Handle FORMs correctly # $htmlTag{"INPUT"} = '&htmlInput'; $htmlTag{"SELECT"} = '&htmlSelect'; $htmlTag{"/SELECT"} = '&htmlSelectEnd'; $htmlTag{"OPTION"} = '&htmlOption'; $htmlTag{"TEXTAREA"} = '&htmlTextarea'; $htmlTag{"/TEXTAREA"} = '&htmlTextareaEnd'; # # Handle quotes specially: put out the correct set depending on # whether this is an open or a close quote. # 11/21/97 schaefer -- We only do this if we are not in PRE mode. sub htmlQuote { if ($htmlPreMode) {&htmlPrint(q/"/)} else { if ($htmlQuoteOpen) {&htmlPrint(q/''/)} else {&htmlPrint(q/``/)} $htmlQuoteOpen = !$htmlQuoteOpen; } } # # Process comments specially: # If the command begins with "\TeX" then the rest of the comment is # inserted into the tex output verbatim (this provides a method of # embedding TeX commands in the HTML file but not having them mess up # the look when it is viewed on the web). # $htmlComment = "&htmlTeXcomment"; sub htmlTeXcomment { local ($comment) = @_; if ($comment =~ m/^\\TeX +/i) {&htmlPrint($')} } # This second comment handler adds the ability to turn off the html output # when it is convenient to replace it with the TeX commands. # Turn off with # Turn back on with # 10-31-97 J. Schaefer sub htmlTeXcommentWithSuspend { local ($comment) = @_; if ($comment =~ m/^\\TeX +/i) {&htmlPrint($')} if ($comment =~ m/^SUSPENDinTeX/i) {&htmlSuspendOutput} if ($comment =~ m/^RESUMEinTeX/i) {&htmlRestoreOutput} } # # &htmlNewLine - conditionally print a newline # # If there is some text one the current line # End the current line with a "%" # Make sure that leading spaces are retained # sub htmlNewLine { if ($htmlLinePar eq 0) { &htmlPrint($htmlBreakNL."\n"); $htmlLineSpace = -1; } } ###################################################################### # # Routines to handle FORMs # # # &htmlInputCHECK - process a check box # # Output \htmlInputCheckbox with the correct checked status. # sub htmlInputCHECKBOX { local ($check) = ""; $check = "checked" if (defined($tag{"CHECKED"})); &htmlPrint("\\htmlInputCheckbox{$check} "); } # # &htmlInputRADIO - process a radio button # # Output \htmlInputRadio with the correct checked status. # sub htmlInputRADIO { local ($check) = ""; $check = "checked" if (defined($tag{"CHECKED"})); &htmlPrint("\\htmlInputRadio{$check} "); } # # &htmlInputSUBMIT - process a submit button # # Output \htmlINputButton with the correct button name (translating # any entities within the button name). # sub htmlInputSUBMIT { &htmlPrint("\\htmlInputButton{"); &htmlOutputHTML(&htmlGetTag("VALUE","Submit")); &htmlPrint("}"); } # # &htmlInputRESET - process a reset button # # Output \htmlINputButton with the correct button name (translating # any entities within the button name). # sub htmlInputRESET { &htmlPrint("\\htmlInputButton{"); &htmlOutputHTML(&htmlGetTag("VALUE","Reset")); &htmlPrint("}"); } # # &htmlInputBUTTON - process a reset button # # Output \htmlInputButton with the correct button name (translating # any entities within the button name). # sub htmlInputBUTTON { &htmlPrint("\\htmlInputButton{"); &htmlOutputHTML(&htmlGetTag("VALUE","")); &htmlPrint("}"); } # # &htmlInputTEXT - process a single-line text entry field # # Get the size and default text. # If the size has both a row and column value (obsolete HTML) # Split the size into its parts # Start a multi-column input area # Send out the text in PRE-formatted mode # End the text area # Otherwise # Output \htmlInputText withthe correct size and text (translating # any entities in the default text). # sub htmlInputTEXT { local ($size) = &htmlGetTag("SIZE","30"); local ($value) = &htmlGetTag("VALUE",""); local ($rows,$cols); if ($size =~ m/,/) { ($cols,$rows) = split(", *",$size); &htmlNewLine; &htmlPrint("\\htmlTextarea{$cols}{$rows}%\n"); $htmlPreMode++; &htmlOutputHTML($value); $htmlPreMode--; &htmlPrint("\n\\htmlEnd\n"); } else { &htmlPrint("\\htmlInputText{$size}{"); &htmlOutputHTML($value); &htmlPrint("}"); } } # # &htmlInputIMAGE - process a selectable image # # If we're in Postscript mode # Make sure this is marked as an ISMAP item and do the PS image # Otherwise do a regular text image # sub htmlInputIMAGE { if ($htmlPS) { $tag{"ISMAP"} = ""; &htmlDoIMGps; } else {&htmlTextIMG} } # # &htmlTextarea - process a multi-line text area # # Parse the tags and get the ROWS and COLS items # Print a new line, if needed # Output the \htmlTextarea command with the correct size # Start PRE-formatted mode # sub htmlTextarea { local ($rows,$cols); &htmlParseTags; $rows = &htmlGetTag("ROWS",1); $cols = &htmlGetTag("COLS",30); &htmlNewLine; &htmlPrint("\\htmlTextarea{$cols}{$rows}%\n"); $htmlPreMode++; } # # End PRE-formatted mode # End the text area # sub htmlTextareaEnd { $htmlPreMode-- if ($htmlPreMode); &htmlPrint("\\htmlEnd\n"); } # # &htmlSelect - process a single- or multi-line menu selection # # Parse the tags and look for the SIZE item # Split it into rows and columns (or just columns if only one is suplied) # If this is a single line item # Suspend output until the selected