[l2h] sub do_cmd_textsc() should leave punctuation outside of <small> blocks

Julius Smith jos at w3k.org
Mon Sep 29 14:48:13 CEST 2003


The following replacement for process_smallcaps seems to fix this problem.
In two places, \W is replaced by \s
Julius

sub process_smallcaps {
     local($text) = @_;
     local($next, $scstr, $scbef, $special, $char);
     # is this enough for \sc and \scshape ?
     $text = &translate_environments($text);

     # MRO: replaced $* with /m
     while ($text =~ /(\\[a-zA-Z]+|[&;]SPM\w+;|<[^>]+>)+/m ) {
         $scbef = $`; $special = $&; $text = $';
         # JOS: replaced \W with \s (to fix unequal parens bug):
         while ( $scbef =~ /(&#\d+;|[a-z$sclower])+[a-z\s\d$sclower]*/m) {
             $scstr .= $`; $scbef = $';
             $next = $&;
             $next =~ s/&#(\d+);/&lowercase_entity($1)/egm;
             eval "\$next =~ $scextra" if ($scextra);
             eval "\$next =~ tr/a-z$sclower/A-Z$scupper/";
             $scstr .= "<SMALL>" . $next ."<\/SMALL>";
         }
         $scstr .= $scbef . $special;
     }
     if ($text) {
         while ( $text =~ /(&#\d+;|[a-z$sclower])+[a-z\s\d$sclower]*/m) {
             $scstr .= $`; $text = $';
             $next = $&;
             $next =~ s/&#(\d+);/&lowercase_entity($1)/egm;
             eval "\$next =~ $scextra" if ($scextra);
             eval "\$next =~ tr/a-z$sclower/A-Z$scupper/";
             $scstr .= "<SMALL>" . $next ."<\/SMALL>";
         }
         $scstr .= $text;
     }
     $scstr;
}

At 06:06 PM 9/28/2003 -0700, Julius Smith wrote:
>In latex2html 2002-2-1 (1.70), the LaTeX \textsc{Transform (DFT)} 
>translates to
>
>  T<SMALL>RANSFORM (</SMALL>DFT)
>
>when it should be
>
>  T<SMALL>RANSFORM </SMALL>(DFT)
>
>In other words, the parentheses should not be different sizes.  One 
>solution might be to terminate the SMALL block on any non-word, 
>non-whitespace chars (in sub process_smallcaps, I presume).
>
>Julius
>
>_______________________________________________
>latex2html mailing list
>latex2html at tug.org
>http://tug.org/mailman/listinfo/latex2html

_____________________________
Julius O. Smith III <jos at ccrma.stanford.edu>
Assoc. Prof. of Music and (by courtesy) Electrical Engineering
CCRMA, Stanford University
http://www-ccrma.stanford.edu/~jos/



More information about the latex2html mailing list