Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let it run on recent perl and allow to create/view pdf #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Autoformat.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};

Expand Down
6 changes: 6 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
required:
gnuplot
latex
graphviz
optional:
gv
26 changes: 19 additions & 7 deletions make-latex.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,28 @@
my $seed;
my $remote = 0;
my $title;
my $pdfview;

sub usage {
select(STDERR);
print <<EOUsage;

$0 [options]
Options:

--help Display this help message
--author <quoted_name> An author of the paper (can be specified
--author <quoted_name> An author of the paper (can be specified
multiple times)
--seed <seed> Seed the prng with this
--file <file> Save the postscript in this file
--tar <file> Tar all the files up
--savedir <dir> Save the files in a directory; do not latex
--savedir <dir> 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 <title> Set the title (useful for talks)
--sysname <name> Set the system name

--pdfview <name> name of PDF viewer
EOUsage

exit(1);
Expand All @@ -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"} ) {
Expand All @@ -87,6 +88,10 @@ sub usage {
} else {
$seed = int rand 0xffffffff;
}
if( defined $options{"pdfview"} ) {
$pdfview = $options{"pdfview"};
}

srand($seed);

my $name_dat = {};
Expand Down Expand Up @@ -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" );
}
}

}
Expand Down
10 changes: 5 additions & 5 deletions scigen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down