############################################################################ # # # Extension to LaTeX2HTML to load further features from # # the EASYEQN package. # # # # date : 2002, March 18 # # release : 1.1 (beta) # # first release : 1999, Sept. 12 # # file : easyeqn.perl # # author : Enrico Bertolazzi # # email : enrico.bertolazzi@ing.unitn.it, # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2, or (at your option) # # any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # # # Copyright (C) 1999 # # # # Enrico Bertolazzi # # Dipartimento di Ingegneria Meccanica e Strutturale # # Universita` degli Studi di Trento # # Via Mesiano 77, I-38050 Trento, Italy # # # # ___ ____ ___ _ _ ___ ____ ___ _ _ # # / \ / / \ \ / / \ / / \ \ / # # /____/ /__ /____/ \/ /____/ /__ /____/ \/ # # / \ / / \ / / \ / / \ / # # /____/ /____ / \ / /____/ /____ / \ / # # # ############################################################################ package main; $display_env_rx = join('|', $display_env_rx, 'EQ','EQA'); %easyeqn_align = ( 'l' => " ALIGN=\"LEFT\" ", 'c' => " ALIGN=\"CENTER\" ", 'r' => " ALIGN=\"RIGHT\" " ) ; %easyeqn_valign = ( 't' => " VALIGN=\"TOP\" ", 'c' => " VALIGN=\"CENTER\" ", 'b' => " VALIGN=\"BOTTOM\" " ) ; $easyeqn_label_vpos = "c" ; $easyeqn_label_hpos = "r" ; $easyeqn_lc = "c" ; $easyeqn_allnumber = 0 ; sub do_easyeqn_leqno { $easyeqn_label_hpos = "l" ; } sub do_easyeqn_fleqn { $easyeqn_lc = "l" ; } sub do_easyeqn_math { } sub do_easyeqn_allnumber { $easyeqn_allnumber = 1 ; } sub do_easyeqn_warning { } sub do_cmd_refeq { local($_) = @_; join('',&process_ref($cross_ref_mark,$cross_ref_mark,'')) ; } sub do_cmd_eqlabeltop { local($_) = @_; $easyeqn_label_vpos = "t" ; join('',$_); } sub do_cmd_eqlabelbot { local($_) = @_; $easyeqn_label_vpos = "b" ; join('',$_); } sub do_cmd_eqlabelcenter { local($_) = @_; $easyeqn_label_vpos = "c" ; join('',$_); } sub do_cmd_equationcenter { local($_) = @_; $easyeqn_lc = "c" ; join('',$_); } sub do_cmd_equationleft { local($_) = @_; $easyeqn_lc = "l" ; join('',$_); } sub do_cmd_numberleft { local($_) = @_; $easyeqn_label_hpos = "l" ; join('',$_); } sub do_cmd_numberright { local($_) = @_; $easyeqn_label_hpos = "r" ; join('',$_); } sub do_env_EQ { local($_) = @_; $_ =~ s/\\eqlabel/\\label/g ; my $label = " " ; my $label_name = ""; $latex_body .= join('', "\n\\setcounter{equation}{", $global{'eqn_number'}, "}\n"); if ( $easy_allnumber ) { $global{'eqn_number'}++ ; } if ( /\\label\s*\[([^\]]+)\]\s*(<<\d+>>)(.+)\2/ || /\\label\s*(\([^\)]+\))\s*(<<\d+>>)(.+)\2/ ) { # \label[..]{..} # \label(..){...} $_ = $`. $' ; $label_name = $3 ; my $buffer = $1 ; $buffer =~ s/~/$global{'eqn_number'}/i ; $label = join('', &translate_commands($buffer) ) ; } elsif (/\\label\s*\[([^\]]+)\]/ || /\\label\s*(\([^\)]+\))/ ) { # \label[..] # \label(..) $_ = $`. $' ; my $buffer = $1 ; $buffer =~ s/~/$global{'eqn_number'}/i ; $label = join('', &translate_commands($buffer) ) ; } elsif ( /\\label\s*(<<\d+>>)(.+)\1/ ) { # \label{...} $_ = $`. $' ; $label_name = $2 ; $global{'eqn_number'}++ unless $easy_allnumber ; $label = join('',"(", &translate_commands('\theequation'), ")" ) ; } elsif (/\\yesnumber/ || $easyeqn_allnumber ) { $_ = $`. $' ; $global{'eqn_number'}++ unless $easy_allnumber ; $label = join('',"(", &translate_commands('\theequation'), ")" ) ; } $_ = &process_undefined_environment($env,$id,$_), my $label_left = " " ; my $label_right = " " ; if ( $easyeqn_label_hpos eq "l" ) { $label_left = $label ; } else { $label_right = $label ; } join('', "\n", "\n
", $label_left, " | ", "\n", $_, " | ", "\n", $label_right, " | ", "\n