summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/latex-tipps-und-tricks/such.pl
blob: ceb271c4ee2707f8611023783c6be746ed7961ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# such.pl <lst-file> <dateiname>
# liefert liste aller INCLUDE/INPUT-texfiles und
# durchsucht diese ebenfalls nach
# - listinginput, includegraphics

$out = ">" . shift;
open(OUT,$out) || die "cannot open $out: $!";
while (<>)
{ if (eof) { print OUT "$ARGV\n"; }
  # \include{file}
  if (m/^\\include\{(\w+)\}/)
    { print "$1 included as TeX in $ARGV\n";
      unshift(ARGV, $1.".tex");
    }
  # \input file
  if (m/^\\input (\w+)/)
    { print "$1 included via \input in $ARGV\n";
      unshift(ARGV, $1.".tex");
    }
  # \listininput{n}{file}
  if (m/^\\listinginput\{\d+\}\{([\w\.]+)\}/)
    { print OUT "$1\n";
      print "$1 included in $ARGV\n";
    }
  # \includegraphics[opt]{file}
  if (m/^\\.*\\includegraphics(\[.+\])*\{([\w\.]+)\}/)
    { print "$2 included as graphics\n";
      print OUT "$2\n";
    }
  # \showpage{file}
  if (m/\\showpage\{([\w\.]+)\}/)
    { print "$1 included as graphics in showpage\n";
      print OUT "$1\n";
    }
  # \requirefile{file}
  if (m/^%\\requirefile\{([\w\.]+)\}/)
    { print OUT "$1\n";
      print "$1 included in $ARGV (aux file)\n";
    }
}
close(OUT);