From 6187f85ece626889919507c988ce0c517a3a75e8 Mon Sep 17 00:00:00 2001 From: Johannes Poehlmann Date: Sun, 9 Jan 2022 13:32:43 +0100 Subject: [PATCH 1/3] make it run with recent perl --- DEPENDENCIES | 6 ++++++ scigen.pm | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 DEPENDENCIES diff --git a/DEPENDENCIES b/DEPENDENCIES new file mode 100644 index 0000000..ba8bb2a --- /dev/null +++ b/DEPENDENCIES @@ -0,0 +1,6 @@ + required: +gnuplot +latex +graphviz + optional: +gv diff --git a/scigen.pm b/scigen.pm index 83073c1..2486cf9 100644 --- a/scigen.pm +++ b/scigen.pm @@ -176,29 +176,29 @@ sub pretty_print { $line =~ s/(\s+)([\.\,\?\;\:])/$2/g; $line =~ s/(\b)(a)\s+([aeiou])/$1$2n $3/gi; - if( $line =~ /\\section(\*?){(.*)}/ ) { + if( $line =~ /\\section(\*?)\{(.*)\}/ ) { $newline = "\\section${1}{" . Autoformat::autoformat( $2, { case => 'highlight', squeeze => 0 } ); chomp $newline; chomp $newline; $newline .= "}"; - } elsif( $line =~ /(\\subsection){(.*)}/ or - $line =~ /(\\slideheading){(.*)}/ ) { + } elsif( $line =~ /(\\subsection)\{(.*)\}/ or + $line =~ /(\\slideheading)\{(.*)\}/ ) { $newline = $1 . "{" . Autoformat::autoformat( $2, { case => 'highlight', squeeze => 0 } ); chomp $newline; chomp $newline; $newline .= "}"; - } elsif( $line =~ /\\title{(.*)}/ ) { + } elsif( $line =~ /\\title\{(.*)\}/ ) { $newline = "\\title{" . Autoformat::autoformat( $1, { case => 'highlight', squeeze => 0 } ); chomp $newline; chomp $newline; $newline .= "}"; - } elsif( $line =~ /(.*) = {(.*)}\,/ ) { + } elsif( $line =~ /(.*) = \{(.*)\}\,/ ) { my $label = $1; my $curr = $2; # place brackets around any words containing capital letters From 8dce5ca194bfd047512944fb698b7779dd196bf5 Mon Sep 17 00:00:00 2001 From: Johannes Poehlmann Date: Sun, 9 Jan 2022 13:33:44 +0100 Subject: [PATCH 2/3] move comment to silence warning about comment in string --- Autoformat.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Autoformat.pm b/Autoformat.pm index 7fe33c0..62dd939 100644 --- a/Autoformat.pm +++ b/Autoformat.pm @@ -521,8 +521,8 @@ sub entitle { s/ ( [:;] \s+ ) ($alword) /$1 . recase($2,'title')/ex; } -my $abbrev = join '|', qw{ # modified by JS: add al. and Jr. +my $abbrev = join '|', qw{ etc[.] pp[.] ph[.]?d[.] U[.]S[.] al. Jr. }; From 1155bd5b353e5a05c99476a24ba39449a93a00f9 Mon Sep 17 00:00:00 2001 From: Johannes Poehlmann Date: Sun, 9 Jan 2022 13:39:54 +0100 Subject: [PATCH 3/3] produce pdf and show it --- make-latex.pl | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/make-latex.pl b/make-latex.pl index 22bea3b..f820265 100755 --- a/make-latex.pl +++ b/make-latex.pl @@ -36,27 +36,28 @@ my $seed; my $remote = 0; my $title; +my $pdfview; sub usage { select(STDERR); print < An author of the paper (can be specified + --author An author of the paper (can be specified multiple times) --seed Seed the prng with this --file Save the postscript in this file --tar Tar all the files up - --savedir Save the files in a directory; do not latex + --savedir Save the files in a directory; do not latex or dvips. Must specify full path --remote Use a daemon to resolve symbols --talk Make a talk, instead of a paper --title Set the title (useful for talks) --sysname <name> Set the system name - + --pdfview <name> name of PDF viewer EOUsage exit(1); @@ -66,8 +67,8 @@ sub usage { # Get the user-defined parameters. # First parse options my %options; -&GetOptions( \%options, "help|?", "author=s@", "seed=s", "tar=s", "file=s", - "savedir=s", "remote", "talk", "title=s", "sysname=s" ) +&GetOptions( \%options, "help|?", "author=s@", "seed=s", "tar=s", "file=s", + "savedir=s", "remote", "talk", "title=s", "sysname=s" , "pdfview=s") or &usage; if( $options{"help"} ) { @@ -87,6 +88,10 @@ sub usage { } else { $seed = int rand 0xffffffff; } +if( defined $options{"pdfview"} ) { + $pdfview = $options{"pdfview"}; +} + srand($seed); my $name_dat = {}; @@ -249,7 +254,14 @@ sub usage { system( "ps2pdf $ps_file $pdf_file; acroread $pdf_file" ) and die( "Couldn't ps2pdf/acroread $ps_file" ); } else { - system( "gv $ps_file" ) and die( "Couldn't gv $ps_file" ); + if ( defined $options{pdfview} ){ + system( "ps2pdf $ps_file $pdf_file;" ) + and die( "Couldn't ps2pdf $ps_file" ); + system( "$options{pdfview} $pdf_file" ) + and die( "Couldn't $options{pdfview} $pdf_file" ); + } else { + system( "gv $ps_file" ) and die( "Couldn't gv $ps_file" ); + } } }