From 27e1f7cfd29871ad900d23915153958605e970e1 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Thu, 20 Jul 2017 14:18:29 -0700 Subject: [PATCH] allow omission of width from image subroutine and preserve aspect ratio --- macros/PGbasicmacros.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index 7f2ce4847b..8edbcce3d9 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -2689,7 +2689,7 @@ sub image { my %in_options = @opt; my %known_options = ( width => 100, - height => 100, + height => '', tex_size => 800, extra_html_tags => '', ); @@ -2709,6 +2709,11 @@ sub image { my $width_ratio = $tex_size*(.001); my @image_list = (); + # if height was explicitly given, create string for height attribute to be used in HTML, LaTeX2HTML + # otherwise omit a height attribute and allow the browser to use aspect ratio preservation + my $height_attrib = ''; + $height_attrib = qq{height = "$height"} if ($height); + if (ref($image_ref) =~ /ARRAY/ ) { @image_list = @{$image_ref}; } else { @@ -2741,7 +2746,7 @@ sub image { } } elsif ($displayMode eq 'Latex2HTML') { my $wid = ($envir->{onTheFlyImageSize} || 0)+ 30; - $out = qq!\\begin{rawhtml}\n\n + $out = qq!\\begin{rawhtml}\n\n \\end{rawhtml}\n ! } elsif ($displayMode eq 'HTML_MathJax' || $displayMode eq 'HTML_dpng' @@ -2754,7 +2759,7 @@ sub image { my $wid = ($envir->{onTheFlyImageSize} || 0) +30; $out = qq! - + ! } else {