here is a perl script which can build one TeX file. All \input and \include files are read and inserted into the main file. Use it
./buildFile.pl < main.tex > main_all.tex
the perl program buildFile.pl:
#!/usr/bin/env perl
### change the
sub p_inc {
$DateiName = shift;
if ( open (my $datei, "$DateiName.tex") ) {
print "%%%---------- open: ", $DateiName, "\n";
while (<$datei>) {
if ((/^\s*\\include{\s+(\S+)/i) or (/^\s*\\input{\s+(\S+)/i)) {
my $include = $1;
chomp($include);chop($include);
print "%%%%%%%%% jump to ", $include, "\n";
p_inc($include);
} else { print unless /^\s*(#|$)/; }
}
print "%%%---------- close: ", $DateiName, "\n";
close $datei;
} else { print "%%%<===== file soesn't exist\n"; }
}
#
@zeilen = (<>);
for $zeile (@zeilen) {
next if $zeile =~ /^\s*(%)/;
if (($zeile =~ /^\s*\\include{\s*(\S+)/i) or ($zeile =~ /^\s*\\input{\s*(\S+)/i)) {
my $include = $1;
chomp($include);
chop($include);
print "%%%%%%%%%%% jump to ", $include, "\n";
p_inc($include);
} else { print $zeile; }
}
.texfile. The issue is the following. I have different files in sub-directories in a recursive manner and hence I cannot upload these individual files since the directory structure in the input command is on the local folder on my computer. I could of-course put these manually but I thought if there would be a way out similar to the .bbl file for the bibliography. – user17762 Jul 5 '12 at 5:09