--- loncom/interface/entities.pm 2008/04/28 10:33:35 1.9 +++ loncom/interface/entities.pm 2008/04/29 10:15:58 1.10 @@ -711,6 +711,10 @@ my %entities = ( 8733 => '\ensuremath{\propto}', 'infin' => '\ensuremath{\infty}', 8734 => '\ensuremath{\infty}', +# +# The items below require the isoent latex package which I can't find at least for FC5. +# Temporarily commented out. +# # 'ang90' => '\ensuremath{\sqangle}', # 8735 => '\ensuremath{\sqangle}', 'ang' => '\ensuremath{\angle}', @@ -921,6 +925,16 @@ my %entities = ( ); +# There are some named entities that don't have a good +# latex equivalent, these are converted to utf-8 via this table +# of entity name -> unicode number. + +my %utf_table = ( + 'THORN' => 222, + 'thorn' => 254, + 'eth' => 240 +); + # # Convert a numerical entity (that does not exist in our hash) # to its UTF-8 equivalent representation. @@ -935,8 +949,8 @@ my %entities = ( # sub entity_to_utf8 { my ($unicode) = @_; - - return pack("U", $unicode); + my $result = pack("U", $unicode); + return $result; } @@ -969,9 +983,16 @@ sub entity_to_latex { return $latex; } # If the text is purely numeric we can do the UTF-8 conversion: - - if ($entity =~ /^\d$/) { + # Otherwise there are a few textual entities that don't have good latex + # which can be converted to unicode: + # + if ($entity =~ /^\d+$/) { return &entity_to_utf8($entity); + } else { + my $result = $utf_table{"$entity"}; + if (defined $result) { + return &entity_to_utf8($result); + } } # Can't do the conversion`< ...