Permalink
Browse files

dvipng support and russian language support

closes issue #36

The --use_dvipng option produces better alignment of images within lines
(see tests/eq_line_spacing.tex).  It also eliminates the ugly crop
marks that appear with 12pt documents.  However, it does not work for
me with figures.  It also does not respect the MATH_SCALE_FACTOR option.
  • Loading branch information...
Dan Gildea
Dan Gildea committed Mar 23, 2017
1 parent 04a03be commit 00ef54aba2f81e0a6565db811b7e63d2f005398a
@@ -113,6 +113,8 @@
# the top.
#
#
# - Picture generation via dvipng
# - KOI8-R, CP1251 and UTF-8 support for Russian
# - default to white background for rendering images.
# if $LATEX_COLOR set, pass as transparency color to pstoimg.
# https://bugs.debian.org/188024
@@ -8,6 +8,11 @@ alternatives for Win32 and OS/2 users.
Step by step cookbook
=====================

Perl version 5.8 and below uses old style multiline regex matching.
Perl version 5.10 and above uses new style multiline regex matching.
Perl version 5.18 is buggy and prevents LaTeX2HTML from working correctly.
Perl version 5.22 seems to be OK.

A. UNIX
-------

@@ -1010,6 +1010,19 @@ package main;
}
}

# --------------------------------------------------------------------------
# dvipng
# --------------------------------------------------------------------------

$newcfg{'DVIPNG'} = '';

if($opt{'IMAGES'}) {
my $dvipng = &find_prog(&get_name('DVIPNG',1));
if($dvipng) {
$newcfg{'DVIPNG'} = $dvipng;
}
}

# HTML validator
# checks the validity of the generated HTML
# The support is very rudimentary here.
@@ -1282,6 +1295,10 @@ package main;
$vers = $2;
($major_vers) = $vers =~ /^(\d+)/;
}
if ($vers =~ /(\d+\.\d+)(?:\.\d+)+/) {
$vers = $1;
($major_vers) = $vers =~ /^(\d+)/;
}
if ($major_vers =~ /^199/) {
# try left crop
&checking('if pnmcrop can crop from one direction');
@@ -63,6 +63,8 @@ ac_help="$ac_help
--with-gs=PATH path/name of the GhostScript executable"
ac_help="$ac_help
--with-dvips=PATH path/name of the dvips executable"
ac_help="$ac_help
--with-dvipng=PATH path/name of the dvipng executable"
ac_help="$ac_help
--with-latex=PATH path/name of the LaTeX executable"
ac_help="$ac_help
@@ -832,6 +834,14 @@ else
with_dvips=${DVIPS:-}
fi

# Check whether --with-dvipng or --without-dvipng was given.
if test "${with_dvipng+set}" = set; then
withval="$with_dvipng"
:
else
with_dvipng=${DVIPNG:-}
fi

# Check whether --with-latex or --without-latex was given.
if test "${with_latex+set}" = set; then
withval="$with_latex"
@@ -1187,6 +1197,7 @@ $PERL $srcdir/config/config.pl \
TEXLIVE=$enable_texlive \
GS=$with_gs \
DVIPS=$with_dvips \
DVIPNG=$with_dvipng \
LATEX=$with_latex \
PNMCROP=$with_latex \
TEX=$with_tex \
@@ -1,4 +1,4 @@
#!/usr/local/bin/perl
#!/usr/bin/perl

################################################################################
# Copyright 1998-1999 by Jens Lippmann (lippmann@rbg.informatik.th-darmstadt.de)
@@ -35,12 +35,11 @@ sub main {
$_ = delete $string{'STRING'}; # Blow it away and return the result
close IN;

$*=1; #multiline matching on
&rip("no $FILES macro found in $source")
unless /^[ \t]*$FILES[ \t]*=((.*\\\n)*.*)/;
unless /^[ \t]*$FILES[ \t]*=((.*\\\n)*.*)/m;
$files = $1;
$files =~ s/\#.*\n?//g;
@files = split(/[ \t]*\\\n[ \t]*|[ \t]+/,$files);
$files =~ s/\#.*\n?//gm;
@files = split(/[ \t]*\\\n[ \t]*|[ \t]+/m,$files);
shift(@files) unless $files[0];

&rip("no files found in $FILES macro")
@@ -49,22 +48,22 @@ sub main {

# get template (one allowed currently)
&rip("no template found in $source")
unless /^[ \t]*$BEGIN.*\n([\s\S]*)\n[ \t]*$END/;
unless /^[ \t]*$BEGIN.*\n([\s\S]*)\n[ \t]*$END/m;
$template = $1;
# take out comments
$template =~ s/^[ \t]*#.*\n//g;
$template =~ s/^[ \t]*#.*\n//gm;

# reduce contents to static part and output it
s/^[ \t]*$DONOTEDIT[\s\S]*/$DONOTEDIT\n/o;
s/^[ \t]*$DONOTEDIT[\s\S]*/$DONOTEDIT\n/om;
print OUT;
foreach $file (@files) {
next unless $file;
if ($file =~ /[\s\\\#]/) {
if ($file =~ /[\s\\\#]/m) {
print "rejecting file <$file>";
}
else {
$_ = $template;
s/\b$pattern\b/$file/g;
s/\b$pattern\b/$file/gm;
print OUT $_,"\n\n";
}
}
@@ -695,9 +695,7 @@ sub make_latex{
$preamble = "\\documentclass\{article\}%\n\\usepackage{html,color}%\n\\makeatletter"
unless ($preamble);
if (($LATEX_DUMP)&&(!($preamble =~ /\\usepackage\{ldump\}/))) {
$*=1;
$preamble =~ s/(\\document(class|style)[^\n]*\n)/$1\\usepackage\{ldump\}\n/;
$*=0;
$preamble =~ s/(\\document(class|style)[^\n]*\n)/$1\\usepackage\{ldump\}\n/m;
}
$LOAD_LATEX_COLOR = "\\usepackage[dvips]{color}" unless $LOAD_LATEX_COLOR;
$LATEX_COLOR = "\\pagecolor[gray]{.85}" unless $LATEX_COLOR;
@@ -22,6 +22,7 @@ $PERL = '@PERL@';
#
$LATEX = '@LATEX@'; # LaTeX
$DVIPS = '@DVIPS@'; # dvips
$DVIPNG = '@DVIPNG@'; # dvipng


# give these too, to use the -ldump feature
@@ -722,6 +723,7 @@ $DVIPS_MODE = '@METAMODE@';
# the metafont mode (e.g. `toshiba').
#
$METAFONT_DPI = @METADPI@;
$DVIPNG_DPI = 120; # for best appearance


# Controls which markup shows up between page and its foot.
@@ -795,7 +797,7 @@ $FIGURE_SCALE_FACTOR = 1.6;
# This allows for better quality when the HTML page is printed.
# {figure} environments are *not* affected by this factor.
#
#$EXTRA_IMAGE_SCALE = 2;
#$EXTRA_IMAGE_SCALE = 2; # set to 1 if $DVIPNG_DPI = 600


# If this is set to 0 then any inlined images generated from "figure"
@@ -833,6 +835,7 @@ $PNMFLIP = '@PNMFLIP@';
$PNMPAD = '@PNMPAD@';
$PNMROTATE = '@PNMROTATE@';
$PNMSCALE = '@PNMSCALE@';
$PNMCROP = '@PNMCROP@';

$GIFTOPNM = '@GIFTOPNM@';
$JPEGTOPNM = '@JPEGTOPNM@';
Oops, something went wrong.

0 comments on commit 00ef54a

Please sign in to comment.