Skip to content

Instantly share code, notes, and snippets.

@devd
Created November 15, 2012 20:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devd/4081033 to your computer and use it in GitHub Desktop.
Save devd/4081033 to your computer and use it in GitHub Desktop.
LaTeX Multiple Files to One File
use strict;
use warnings;
getcontent($ARGV[0]);
use strict;
use warnings;
sub getcontent{
my $filename = shift;
my $line;
open (my $fh,"<",$filename.".tex") or die "no file named $filename";
while(<$fh>){
chomp;
$line = $_;
unless($line =~ m/\\input\{(.*?)\}/ig){
print $line,"\n";
next;
}
next if $line =~ m/^%/;
getcontent($1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment