summaryrefslogtreecommitdiff
path: root/support/texdepend
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/texdepend
Initial commit
Diffstat (limited to 'support/texdepend')
-rw-r--r--support/texdepend/Changes14
-rw-r--r--support/texdepend/INSTALL20
-rw-r--r--support/texdepend/MANIFEST7
-rw-r--r--support/texdepend/Makefile.PL19
-rw-r--r--support/texdepend/README56
-rw-r--r--support/texdepend/texdepend734
-rw-r--r--support/texdepend/texdepend.1385
7 files changed, 1235 insertions, 0 deletions
diff --git a/support/texdepend/Changes b/support/texdepend/Changes
new file mode 100644
index 0000000000..682f715ea9
--- /dev/null
+++ b/support/texdepend/Changes
@@ -0,0 +1,14 @@
+Revision history for Perl script texdepend.
+
+0.91 Fri Jun 25 14:29:00 1999
+ - updated version; created by sdist 0.3
+ - fixed stupid error in $graphics_pat
+
+0.92 13 Jul 1999 14:50:42
+ - Added .cls files to @packages; added -styles option to append
+ extensions of @styles files parsed in the .log. Fixed small
+ bug re -ignore option. [Thanks to Bernd Schandl
+ <bschand@math.clemson.edu> for suggestions.]
+
+
+
diff --git a/support/texdepend/INSTALL b/support/texdepend/INSTALL
new file mode 100644
index 0000000000..fe4a0368b1
--- /dev/null
+++ b/support/texdepend/INSTALL
@@ -0,0 +1,20 @@
+
+To install the script and man pages in the standard areas,
+give the sequence of commands
+
+ perl Makefile.PL
+ make
+ make install
+
+If you want to install the script in your own private space, use
+
+ perl Makefile.PL PREFIX=/my/private/perllib \
+ INSTALLMAN1DIR=/my/private/perllib/man/man1 \
+ INSTALLMAN3DIR=/my/private/perllib/man/man3
+ make
+ make install
+
+Or, just do
+
+ cp -p texdepend /usr/local/bin
+ cp -p texdepend /usr/local/man/man1
diff --git a/support/texdepend/MANIFEST b/support/texdepend/MANIFEST
new file mode 100644
index 0000000000..575ae119bf
--- /dev/null
+++ b/support/texdepend/MANIFEST
@@ -0,0 +1,7 @@
+texdepend
+texdepend.1
+Makefile.PL
+README
+INSTALL
+Changes
+MANIFEST
diff --git a/support/texdepend/Makefile.PL b/support/texdepend/Makefile.PL
new file mode 100644
index 0000000000..1f37ae8893
--- /dev/null
+++ b/support/texdepend/Makefile.PL
@@ -0,0 +1,19 @@
+use ExtUtils::MakeMaker;
+#
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+#
+# As well, if you wish to force a minimal perl version to run the
+# script, insert a line, for example,
+#
+# require 5.004;
+#
+# below.
+
+WriteMakefile(
+ 'NAME' => 'texdepend',
+ 'VERSION_FROM' => 'texdepend', # finds $VERSION
+ 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' },
+ 'EXE_FILES' => [ 'texdepend' ], # scripts to install
+);
+
diff --git a/support/texdepend/README b/support/texdepend/README
new file mode 100644
index 0000000000..5c931c6279
--- /dev/null
+++ b/support/texdepend/README
@@ -0,0 +1,56 @@
+NAME
+ texdepend - Find dependencies for a LaTeX file
+
+SYNOPSIS
+ texdepend [-help] [-expand] [-format *format-spec*] [-ignore *list*] [-
+ out *outfile*] [-print *flags*] [-styles *list*] [-verbose] *file*[.tex]
+
+DESCRIPTION
+ texdepend reads a .tex file, and (recursively) all \input{} and
+ \include{} files referenced therein, collecting the names of .tex, .sty,
+ .bib, .eps files as it goes. If the .log and .aux file for the same
+ file.tex file exist in the current directory, texdepend also reads
+ these, and parses names of included dependent files.
+
+ It creates the following lists. Only files which actually exist are
+ included.
+
+ @includes
+ from \input{} and \include{} commands in the .tex file and its
+ desendents.
+
+ @packages
+ the names of all style and class files from \usepackage{},
+ \documentclass{} and \documentstyle{} commands in the preamble of
+ the main .tex file.
+
+ @figs
+ the names of all graphics files from \includegraphics{} commands in
+ the .tex file.
+
+ @styles
+ the full path names of *all* style/tex/cfg files used directly or
+ indirectly, found in the .log file (except those config'd in @ignore
+ or specifed with the -ignore option).
+
+ @bibfiles
+ the full path names of .bib files found in the .aux file as
+ \bibdata{} files
+
+ @depends
+ the full path names of all files found in the .log and .aux files
+ (which includes everything in all lists except @figs).
+
+ By default, the program uses kpsewhich (if an executable exists) from
+ the teTeX/kpathsea distribution to locate tex/bst/sty files before
+ trying the various $TEXINPUTS, $BIBINPUTS, and $TEXFMTS paths, to
+ determine the full path names of input files. You may need to change the
+ $KPSEWHICH path in the configuration section of texdepend
+
+LICENSE
+ texdepend is distributed under the terms of the LaTeX Project Public
+ License (LPPL). This means that you may freely copy or distribute this
+ software, but if you modify it and distribute it (even locally) you must
+ change the name to avoid confusion. See: CTAN::
+ help/Catalog/Licenses.html.
+
diff --git a/support/texdepend/texdepend b/support/texdepend/texdepend
new file mode 100644
index 0000000000..366023e765
--- /dev/null
+++ b/support/texdepend/texdepend
@@ -0,0 +1,734 @@
+#! /usr/local/bin/perl
+
+$VERSION=0.92; # 13 Jul 1999 10:11:33
+use vars qw($VERSION);
+
+$Author='Michael Friendly (friendly@yorku.ca)'; # Copyright 1999
+$License = 'LPPL'; # released under the LPPL license
+
+########################################################################
+# texdepend: a Perl script for finding dependencies in a LaTeX file
+
+# Pretty documentation: run pod2man or pod2text on this script
+
+# Reads a .tex file, and all \input{} and \include{} files referenced therein,
+# and creates the following lists:
+# @includes -- from \input{} and \include{}
+# @packages -- from \usepackage{}, \documentclass, \documentstyle
+# @figs -- from \includegraphics{}
+
+# If the .log and .aux file for the same basename.tex file exist,
+# texdepend also reads these and parses names of included dependent
+# files:
+# @styles -- the full path names of *all* style files used directly
+# or indirectly (except those config'd in @ignore)
+# @bibfiles -- full path names from \bibdata{} in .aux file
+# @depends -- full path names of *all* dependencies from the .log and .aux
+
+# These files are found via kpsewhich (if an executable exists) or via
+# the various $TEXINPUTS, $BIBINPUTS, etc paths.
+
+# Output, to the terminal, or a file, is produced in the form of any one of:
+# make, perl (LatexMK), 1 (one per line)
+
+# Changes:
+# 0.92 Added .cls files to @packages; added -styles option to append
+# extensions of @styles files parsed in the .log. Fixed small
+# bug re -ignore option. [Thanks to Bernd Schandl
+# <bschand@math.clemson.edu> for suggestions.]
+
+# This program is released under the LPPL license, copyright: Michael Friendly
+# See: CTAN:: help/Catalog/Licenses.html
+
+# A lot of the code was stolen from TeXit by Norman Walsh. Thanks, Norm.
+
+###################### Start of configuration ######################
+
+$VERBOSE = 0; # Lots of messages...
+
+@ignore = qw(fd); # file types in .log file to be ignored
+@style_types = qw(sty); # file types in .log file considered as styles
+
+$def_expand= 0; # default expand to full path name
+$def_format= 'make'; # default output format
+$def_print = 'ipfbs'; # default lists to print
+
+# patterns for include-type statements, leaving filename in #1
+$include_pat = join('|',
+ ('\\input\b\{?(\S+)\}',
+ '\\include\s*\{(\S+)\}'
+ ));
+
+## find a more general way to parse graphics files. This pattern is not used.
+$graphics_pat = join('|',
+ ('\\includegraphics\b.*\{(\S+)\}',
+ '\\myincludegraphics\b.*\{(\S+)\}',
+ '\\epsfbox{([^}]+)}',
+ '\\epsfbox\[[^\]]*\]{([^}]+)}',
+ '\\epsfile.*file=(\S+)' #not right
+ ));
+
+# In this version, we only handle:
+$include_graphics = join('|',
+ qw(includegraphics myincludegraphics epsfbox epsffile));
+
+# How to search for files on the various TeX paths:
+
+# If teTeX is installed, use kpsetool to locate tex/bst/sty files before
+# trying the TEXINPUTS path, for efficiency.
+$KPSEWHICH = '/usr/local/teTeX/bin/kpsewhich'; # won't fail if not -x
+# Otherwise, uncomment the following statement
+#undef $KPSEWHICH;
+
+$TEXINPUTS = "TEXINPUTS"; # Name of TEXINPUTS environment variable
+$BIBINPUTS = "BIBINPUTS"; # Name of BIBINPUTS environment variable
+$TEXFMTS = "TEXFORMATS"; # Name of TEXFORMATS environment variable
+
+###################### End of configuration ######################
+
+######################### Initializations ########################
+%DEPENDSON = (); # unique dependencies from the .log/.aux
+%Parens = ();
+$ParenLevel = 0;
+@includes = (); # \inputs and \includes
+@packages = (); # list of \usepackage
+@figs = (); # \includegraphics
+@bibfiles = (); # \bibdata .bib files
+@styles = (); # files treated as @style_types
+
+# remove path from our name
+
+ $progname = $0;
+ $progname =~ s@(.*)/@@i;
+
+
+################## get and process command options ###############
+
+ use Getopt::Long;
+ $result = GetOptions ('expand', 'format=s', 'help', 'out=s', 'print=s',
+ 'ignore=s', 'styles=s', 'verbose');
+
+ &usage() if $opt_help; # and exit
+
+ $opt_expand = $opt_expand || $def_expand;
+ $opt_format = $opt_format || $def_format;
+ $opt_print = $opt_print || $def_print;
+
+ if ($opt_out) {
+ open(STDOUT, ">$opt_out") or die "$progname: -out $opt_out: can't create.\n";
+ } else {
+ select(STDOUT); $| = 1;
+ }
+
+ $VERBOSE=1 if $opt_verbose;
+
+$texfile = $ARGV[0] || &usage(); # usage doesn't return
+shift;
+
+@opt_ignore = grep(s/^\.//, @opt_ignore) if @opt_ignore;
+$ignore_pat = join('|', @ignore, split(' ',$opt_ignore));
+$style_pat = join('|', @style_types, split(' ',$opt_styles));
+
+########################################################################
+# Split the tex filename up into a path, name, and extension
+#
+($TEXFILEPATH,$TEXFILENAME,$TEXFILEEXT) = &splitfn($texfile,".tex");
+
+########################################################################
+# Locate the requested TeX file. It's either in the current (or
+# specified) directory or no path was specified and it's on the
+# TEXINPUTS path.
+#
+$qualifiedtexfile = &cleanup_texfilename($texfile);
+if (! -e $qualifiedtexfile) {
+ if ($texfile !~ /[\/\\]/) { # no path...
+ $qualifiedtexfile = &find_on_path("$ENV{$TEXINPUTS}",
+ "$texfile", 'tex');
+ $qualifiedtexfile = &find_on_path("$ENV{$TEXINPUTS}",
+ "$texfile" . ".tex", 'tex')
+ if $qualifiedtexfile eq "";
+
+ die "Cannot find \"$texfile\[.tex\]\" on $TEXINPUTS path.\n"
+ if $qualifiedtexfile eq "";
+
+ $texfile = $qualifiedtexfile;
+ } else {
+ die "Cannot find \"$texfile\[.tex\]\".\n";
+ }
+} else {
+ $texfile = $qualifiedtexfile;
+}
+$DEPENDSON{$texfile} = 1;
+
+# Main
+&get_direct_depend($texfile);
+&output_entries('includes', @includes) if $opt_print =~ /i/;
+&output_entries('packages', @packages) if $opt_print =~ /p/;
+&output_entries('figs', @figs) if $opt_print =~ /f/;
+
+&parse_logfile();
+&parse_auxfile();
+&output_entries('bib_files', @bibfiles) if $opt_print =~ /b/;
+&output_entries('styles', @styles) if $opt_print =~ /s/;
+
+&output_entries('depends', keys(%DEPENDSON)) if $opt_print =~ /d/;
+exit;
+
+########################################################################
+# Parse the TeX file looking for packages used. Build
+# the lists "@packages", "@includes" to hold the names.
+#
+sub get_direct_depend {
+ local($texfile) = @_;
+ local($in_preamble,$plist,$p);
+ local(*TEXFILE);
+
+ open (TEXFILE, $texfile) || die "Can't read $texfile.\n";
+
+ $in_preamble = 1; # are we in the preamble area?
+
+ while (<TEXFILE>) {
+ chop;
+ s/%.*//; # decomment
+ last if /\\endinput/; # are we done?
+
+ if (/\\begin\s*\{document\s*\}/) {
+ $in_preamble = 0;
+ }
+
+ if ($in_preamble) {
+ if (/^\\usepackage\s*[^{]*\{(.*)\}/) {
+ &parse_packages($1, '.sty');
+ }
+ elsif (/^\\documentstyle\s*[^{]*\{(.*)\}/) {
+ &parse_packages($1, '.sty');
+ }
+ elsif (/^\\documentclass\s*[^{]*\{(.*)\}/) {
+ &parse_packages($1, '.cls');
+ }
+ }
+
+ if (m#\\(input|include)\b\{?([/\w\d.]+)#) {
+ $p = $2;
+ $p .= '.tex' unless $p =~ /\.tex$/;
+ if ($opt_expand) {
+ $fullname = &find_on_path($ENV{"$TEXINPUTS"}, $p, 'tex');
+ if ($fullname ne "" && -r $fullname) {
+ $p = $fullname;
+ }
+ }
+ push (@includes, $p);
+ if (-r $p) {
+ print STDERR "Recursing into $p\n" if $VERBOSE;
+ &get_direct_depend($p);
+ }
+ }
+
+ elsif (m#($include_graphics).*\{([/\w\d.]+)\}#) {
+ $p = $2;
+ $p .= '.eps' unless $p =~ /\.\w+$/;
+ push (@figs, $p);
+ }
+ }
+
+ close (TEXFILE);
+}
+
+########################################################################
+sub parse_packages {
+ my ($plist, $ext) = @_;
+ my $p;
+
+ foreach $p (split (/,/, $plist)) {
+ $p .= $ext unless $p =~ /\./;
+ if ($opt_expand) {
+ $fullname = &find_on_path($ENV{"$TEXINPUTS"}, $p, 'tex');
+ if ($fullname ne "" && -r $fullname) {
+ $p = $fullname;
+ }
+ }
+ push (@packages, $p);
+ }
+}
+
+# Look through the log file for dependencies.
+#
+sub parse_logfile {
+ # only looks for new dependency files...
+ local ($paren, $rest, $tempfile, $curfile,$type);
+ local ($logfile) = &auxfile("log");
+
+ &init_parse_log_filenames();
+
+ if (-r $logfile) {
+ print STDERR "Reading $logfile ..." if $VERBOSE;
+ open (LOGFILE, $logfile);
+ while (<LOGFILE>) {
+ chop;
+
+ ($paren, $rest, $tempfile) = &parse_log_filenames($_);
+ while ($paren eq "(" || $paren eq ")") {
+ $curfile = $tempfile;
+ ($type = $curfile) =~ s/.*\.([\w\d]+)$/$1/;
+ unless ($type =~ /$ignore_pat/) {
+ print STDERR "Adding .sty dependency for `$curfile'.\n"
+ if !defined($DEPENDSON{$curfile}) && $VERBOSE;
+ push(@styles, $curfile)
+ if ((!defined($DEPENDSON{$curfile})) && $type =~ /$style_pat/);
+ $DEPENDSON{$curfile} = 1;
+ }
+ ($paren, $rest, $tempfile) = &parse_log_filenames($rest);
+ }
+ }
+ close (LOGFILE);
+ print STDERR "done\n" if $VERBOSE;
+ }
+}
+
+sub parse_auxfile {
+ local ($auxfile) = &auxfile("aux");
+ local ($paren, $rest, $curfile, $tempfile);
+ if (-r $auxfile) {
+ print STDERR "Reading $auxfile ..." if $VERBOSE;
+ open (AUXFILE, $auxfile);
+ while (<AUXFILE>) {
+ chop;
+
+ if (/\\bibstyle\{(.+)\}/) {
+ local ($name, $fullname);
+ $name = $1 . ".bst";
+ $fullname = &find_on_path($ENV{"$TEXINPUTS"}, $name, 'bst');
+ if ($fullname ne ""
+ && -r $fullname
+ && !defined($DEPENDSON{$fullname})) {
+ print STDERR "Adding .bst dependency for `$fullname'.\n"
+ if !defined($DEPENDSON{$fullname}) && $VERBOSE;
+ push (@styles, $fullname);
+ $DEPENDSON{$fullname} = 1;
+ }
+ }
+
+ if (/\\bibdata\{(.+)\}/) {
+ local (@filelist, $fullname, $name);
+
+ @filelist = split(/,/, $1);
+ while (($name = shift @filelist)) {
+ $name = $name . ".bib";
+ $fullname = &find_on_path($ENV{"$BIBINPUTS"}, $name, 'bib');
+ if ($fullname ne ""
+ && -r $fullname
+ && !defined($DEPENDSON{$fullname})) {
+ print STDERR "Adding .bib dependency for `$fullname'.\n"
+ if !defined($DEPENDSON{$fullname}) && $VERBOSE;
+ push (@bibfiles, $fullname);
+ $DEPENDSON{$fullname} = 1;
+ }
+ }
+ }
+ }
+ close (AUXFILE);
+ print STDERR "done\n" if $VERBOSE;
+ }
+}
+
+########################################################################
+# This routine aids in the parsing of log files be locating filenames
+# within the log. Filenames included in a document always appear as
+# '(filename...' in the log.
+#
+# NOTE: if unbalanced parenthesis occur in the log file (because someone
+# printed them in a \typeout command or some such), all bets are
+# off!
+#
+# FURTHER NOTE: this routine returns the top of the filename stack
+# whenever a close paren is seen, so you will get the
+# same files more than once...
+#
+# This routine uses the global variables %ParenLevel and %Parens which
+# it initializes appropriately...
+#
+# **********************************************************************
+# THIS ROUTINE IS NOT RE-ENTRANT! IT REQUIRES STATE SAVED ACROSS CALLS!
+# **********************************************************************
+#
+sub parse_log_filenames {
+ local ($rest) = @_;
+ local ($paren, $curfile);
+ local (@result) = ();
+
+ undef ($curfile);
+
+ while ($rest =~ /^[^()]*(\(|\))(.*)/) {
+ $paren = $1;
+ $rest = $2;
+
+ ($curfile = $rest) =~ s/\s*(\S+)/$1/; # leading whitesp
+ $curfile =~ s/^([^() ]+).*/$1/; # trailing ( and )
+
+ if ($paren eq "(") {
+ $ParenLevel++;
+ if (-r $curfile) {
+ $Parens{$ParenLevel} = $curfile;
+ } else {
+ $Parens{$ParenLevel} = '*';
+ }
+ } else {
+ $ParenLevel--;
+ $curfile = $Parens{$ParenLevel};
+ }
+
+ last if -r $curfile;
+
+ undef ($curfile);
+ }
+
+ if ($curfile) {
+ @result = ("$paren", "$rest", "$curfile");
+ }
+
+ @result;
+}
+
+
+sub init_parse_log_filenames {
+ %Parens = ();
+ $ParenLevel = 0;
+}
+
+########################################################################
+# Input: an extension, `ext'
+# Output: the filename $TEXFILEPATH . $TEXFILENAME . `.ext'
+# Note: auxilliary files are always placed in the current directory,
+# the path is ignored. This is a change from v1.27 to be more
+# compatible with TeX.
+#
+sub auxfile {
+ local($ext) = @_;
+ local($dot)='';
+
+ $dot = "." if $ext ne "" && $ext !~ /^\./;
+
+ $TEXFILENAME . $dot . $ext;
+}
+
+########################################################################
+# Cleanup the TeX filename. Add the extension ".tex" if it doesn't
+# already have an extension.
+#
+sub cleanup_texfilename {
+ local($texfile) = @_;
+ local($path,$base,$ext) = &splitfn($texfile,".tex");
+
+ $ext = "tex" if ($ext eq "");
+
+ $path . $base . "." . $ext;
+}
+
+########################################################################
+# This helpful little routine locates a file on a TeX path. The path can
+# be ":" or ";" delimited. If the file is found, it's fully qualified
+# name is returned, otherwise the null string is returned. If the
+# input path contains "/" or "\" then either it is returned (if the file
+# specified exists) or the empty string is returned, the path _is not_
+# searched.
+#
+sub find_on_path {
+ local($path, $file, $type) = @_;
+ local($dir, $filename);
+
+ $filename = "";
+
+ if ($KPSEWHICH && -x $KPSEWHICH) {
+ chop($filename = `$KPSEWHICH $type $file`);
+ #print "kpse: $filename\n";
+ $filename = "" if $filename =~ /not found/;
+ }
+
+ unless ($filename) {
+ if ($file =~ /\/|\\/) {
+ $filename = $file if -e $file;
+ } else {
+ foreach $dir (split(/;|:/,$path)) {
+ #print "looking for $file in $dir\n";
+ $dir =~ s/\\/\//g;
+ $filename = $dir . "/" . $file;
+ last if -e $filename;
+ $filename = "";
+ }
+ }
+ }
+ $filename;
+}
+
+########################################################################
+# Break a filename into it's path, basename, and extension components.
+# The path returned always ends with a slash. "./" is returned if the
+# file has no path. If the filename passed in does not exist, the
+# default extension passed in is tried (actually, is assumed to be
+# correct).
+#
+sub splitfn {
+ local ($filename, $defext) = @_;
+ local ($path, $basename, $ext) = ("", "", "");
+
+ $filename =~ tr/\\/\//; # translate \ into /
+
+ $filename = $filename . $defext if ! -r $filename;
+
+ if ($filename =~ /\//) {
+ ($path = $filename) =~ s/\/[^\/]*$//;
+ ($basename = $filename) =~ s/.*\///;
+ }
+ else {
+ $path = ".";
+ $basename = $filename;
+ }
+
+ if ($basename =~ /\./) {
+ ($ext = $basename) =~ s/.*\.//;
+ $basename =~ s/\.[^.]*$//;
+ }
+
+ ($path . "/",$basename,$ext);
+}
+
+########################################################################
+# Output a dependency type
+
+sub output_entries {
+ local ($type) = shift;
+ local (@entries) = @_;
+
+ return unless scalar @entries;
+ if ($opt_format =~ /make/i) {
+ print uc($type), ' = ', join(' ', @entries), "\n#\n";
+ }
+ elsif ($opt_format =~ /latexmk|perl/i) {
+ print '$',lc($type), " = '", join(' ', @entries), "';\n#\n";
+ }
+ elsif ($opt_format =~ /1/) {
+ print '# ', uc($type), " =\n", join("\n", @entries), "\n";
+ }
+
+}
+
+########################################################################
+#
+sub usage {
+
+ print <<"EOF";
+Find LaTex dependencies, Version: $VERSION, $Author
+Usage: $progname <options> texfile[.tex]
+ where <options> may be abbreviated to unique truncations, and are:
+ -help print this measly help
+ -expand expand package/include file to full path names
+ -format = make print dependencies in Makefile format
+ perl print in the form of perl assignments (LatexMk)
+ 1 print one per line (with # separators)
+ -ignore = list list of file types to be ignored in .log [default: fd]
+ -out = filename send output to filename
+ -print = Any one or more of i (includes) p (packages)
+ f (figs) b (bibfiles) s (styles) d (all dependencies)
+ -styles = list list of file types for @styles from .log [default: sty]
+ -verbose
+EOF
+
+ exit 1;
+}
+__END__
+
+=head1 NAME
+
+texdepend - Find dependencies for a LaTeX file
+
+=head1 SYNOPSIS
+
+B<texdepend>
+[B<-help>]
+[B<-expand>]
+[B<-format>S< >I<format-spec>]
+[B<-ignore>S< >I<list>]
+[B<-out>S< >I<outfile>]
+[B<-print>S< >I<flags>]
+[B<-styles>S< >I<list>]
+[B<-verbose>]
+I<file>[.tex]
+
+=head1 DESCRIPTION
+
+B<texdepend> reads a .tex file, and (recursively) all \input{} and
+\include{} files referenced therein, collecting the names of .tex,
+.sty, .bib, .eps files as it goes. If the .log and .aux file for
+the same F<file.tex> file exist in the current directory, texdepend
+also reads these, and parses names of included dependent files.
+
+It creates the following lists. Only files which actually exist are
+included.
+
+=over 4
+
+=item @includes
+
+from \input{} and \include{} commands in the .tex file and its desendents.
+
+=item @packages
+
+the names of all style and class files from \usepackage{},
+\documentclass{} and \documentstyle{}
+commands in the preamble of the main .tex file.
+
+=item @figs
+
+the names of all graphics files from \includegraphics{} commands in the .tex file.
+
+=item @styles
+
+the full path names of I<all> style/tex/cfg files used directly
+or indirectly, found in the .log file (except those config'd in @ignore
+or specifed with the B<-ignore> option).
+
+=item @bibfiles
+
+the full path names of .bib files found in the .aux file
+as \bibdata{} files
+
+=item @depends
+
+the full path names of all files found in the .log and .aux files
+(which includes everything in all lists except @figs).
+
+=back 4
+
+By default, the program uses kpsewhich (if an executable exists)
+from the teTeX/kpathsea distribution
+to locate tex/bst/sty files before trying the various $TEXINPUTS,
+$BIBINPUTS, and $TEXFMTS paths, to determine the full path names of input
+files. You may need to change the $KPSEWHICH path in the configuration
+section of B<texdepend>
+
+=head1 OPTIONS AND ARGUMENTS
+
+All options may be abbreviated to their unique truncations, so B<-h>, B<-he>,
+B<-hel> all print help.
+Options which take an argument may be followed by a blank or '='.
+
+=over 4
+
+=item B<-help>
+
+Print a brief help message and exit.
+
+=item B<-expand>
+
+Expand all file names found in the .tex file to their full path names.
+(File names listed in the .log file always appear as full path names.)
+
+=item B<-format>S< >[make | perl | 1]
+
+Determines the output format. B<-format=make> prints these lists in the form
+of Makefile lists. B<-format=perl> prints in the form of assignments to
+Perl string variables. In these two cases, each list is printed as a single
+line, with filenames separated by one blank space.
+B<-format=1> prints these with one filename per line, each preceeded by
+a line beginning with a '#'.
+
+=item B<-ignore>S< >I<list>
+
+Specifies a list (enclosed in ' ' if more than one)
+of one or more file extensions (without the leading '.')
+to be ignored as style files in the set of filenames found in the .log file.
+By default, 'fd' files are always ignored.
+
+=item B<-out>S< >I<filename>
+
+Send the output to a file
+
+=item B<-print>S< >[i|p|f|b|s|d]
+
+Any one or more of the characters i (includes) p (packages)
+f (figs) b (bibfiles) s (styles) d (all dependencies) to specify which
+lists are produced in the output.
+
+=item B<-styles>S< >I<list>
+
+Specifies a list (enclosed in ' ' if more than one)
+of one or more file extensions (without the leading '.')
+to be treated as style files in the set of filenames found in the .log file,
+in addition to 'sty' files.
+
+=item B<-verbose>
+
+Lots of messages, written to STDERR.
+
+=back 4
+
+=head1 EXAMPLES
+
+To produce lists suitable for a Makefile,
+
+ texdepend -out=myfile.mak myfile.tex
+
+Then in the Makefile, say
+
+ include myfile.mak
+
+A Makefile target ('make lists') which updates the lists could be written:
+
+ MAIN = myfile
+ include $(MAIN).mak
+ ALLFILES = $(MAIN).tex $(INCLUDES) $(BIB_FILES) $(STYLES) $(FIGS)
+
+ lists:
+ texdepend -out=$(MAIN).mak $(MAIN).tex
+
+
+A common requirement for submitting a journal article as LaTeX
+source is to include in a .zip or .tar.gz file copies of all packages
+which have been used in the document. One way to do this is to
+create symbolic links from each such package to a ./styles
+subdirectory.
+
+ texdepend -pr=p -fo=perl -out=packages.pin -expand myfile.tex
+ perl -e 'do "packages.pin"; @p = split( /\s+/, $packages );' \
+ -e 'foreach (@p) {symlink $_, "./styles";}'
+
+
+=head1 LIMITATIONS
+
+The program is tuned to LaTeX, not TeX.
+
+The handling of graphics files is rudimentary. No attempt is made to
+parse graphics files (for the @figs list)
+listed in the .log file because of the complex nesting
+of E<lt> E<gt> and "( )". (Some experiments using F<Text::Balanced.pm>
+were made, but made the program very inefficient.)
+In parsing the .tex file, only a limited number
+of graphics commands are recognized, including \includegraphics{},
+\epsfbox{}, and \epsffile{}. But, you should be using \includegraphics{}
+anyway!
+
+Doesn't handle multiple .aux files for a single .tex file, or other
+complexities I've never thought of.
+
+=head1 BUGS
+
+Output may break on systems which have a limitation on line length.
+
+=head1 SEE ALSO
+
+L<latexmk(1l)>
+texfind: CTAN support/texfind
+
+/usr/local/teTeX/bin/kpsewhich
+
+=head1 AUTHOR
+
+Michael Friendly <friendly@yorku.ca>
+
+=head1 LICENSE
+
+B<texdepend> is distributed under the terms of the LaTeX Project Public
+License (LPPL). This means that you may freely copy or distribute this
+software, but if you modify it and distribute it (even locally) you must
+change the name to avoid confusion.
+See: CTAN:: help/Catalog/Licenses.html. \ No newline at end of file
diff --git a/support/texdepend/texdepend.1 b/support/texdepend/texdepend.1
new file mode 100644
index 0000000000..d9b24e3b22
--- /dev/null
+++ b/support/texdepend/texdepend.1
@@ -0,0 +1,385 @@
+.rn '' }`
+''' $RCSfile$$Revision$$Date$
+'''
+''' $Log$
+'''
+.de Sh
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp
+.if t .sp .5v
+.if n .sp
+..
+.de Ip
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve
+.ft R
+
+.fi
+..
+'''
+'''
+''' Set up \*(-- to give an unbreakable dash;
+''' string Tr holds user defined translation string.
+''' Bell System Logo is used as a dummy character.
+'''
+.tr \(*W-|\(bv\*(Tr
+.ie n \{\
+.ds -- \(*W-
+.ds PI pi
+.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+.ds L" ""
+.ds R" ""
+''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
+''' \*(L" and \*(R", except that they are used on ".xx" lines,
+''' such as .IP and .SH, which do another additional levels of
+''' double-quote interpretation
+.ds M" """
+.ds S" """
+.ds N" """""
+.ds T" """""
+.ds L' '
+.ds R' '
+.ds M' '
+.ds S' '
+.ds N' '
+.ds T' '
+'br\}
+.el\{\
+.ds -- \(em\|
+.tr \*(Tr
+.ds L" ``
+.ds R" ''
+.ds M" ``
+.ds S" ''
+.ds N" ``
+.ds T" ''
+.ds L' `
+.ds R' '
+.ds M' `
+.ds S' '
+.ds N' `
+.ds T' '
+.ds PI \(*p
+'br\}
+.\" If the F register is turned on, we'll generate
+.\" index entries out stderr for the following things:
+.\" TH Title
+.\" SH Header
+.\" Sh Subsection
+.\" Ip Item
+.\" X<> Xref (embedded
+.\" Of course, you have to process the output yourself
+.\" in some meaninful fashion.
+.if \nF \{
+.de IX
+.tm Index:\\$1\t\\n%\t"\\$2"
+..
+.nr % 0
+.rr F
+.\}
+.TH TEXDEPEND 1 "perl 5.004, patch 04" "13/Jul/99" "User Contributed Perl Documentation"
+.UC
+.if n .hy 0
+.if n .na
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.de CQ \" put $1 in typewriter font
+.ft CW
+'if n "\c
+'if t \\&\\$1\c
+'if n \\&\\$1\c
+'if n \&"
+\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
+'.ft R
+..
+.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
+. \" AM - accent mark definitions
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds ? ?
+. ds ! !
+. ds /
+. ds q
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
+. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
+.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
+.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
+.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.ds oe o\h'-(\w'o'u*4/10)'e
+.ds Oe O\h'-(\w'O'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds v \h'-1'\o'\(aa\(ga'
+. ds _ \h'-1'^
+. ds . \h'-1'.
+. ds 3 3
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+. ds oe oe
+. ds Oe OE
+.\}
+.rm #[ #] #H #V #F C
+.SH "NAME"
+texdepend \- Find dependencies for a LaTeX file
+.SH "SYNOPSIS"
+\fBtexdepend\fR
+[\fB\-help\fR]
+[\fB\-expand\fR]
+[\fB\-format\fR\ \fIformat-spec\fR]
+[\fB\-ignore\fR\ \fIlist\fR]
+[\fB\-out\fR\ \fIoutfile\fR]
+[\fB\-print\fR\ \fIflags\fR]
+[\fB\-styles\fR\ \fIlist\fR]
+[\fB\-verbose\fR]
+\fIfile\fR[.tex]
+.SH "DESCRIPTION"
+\fBtexdepend\fR reads a .tex file, and (recursively) all \einput{} and
+\einclude{} files referenced therein, collecting the names of .tex,
+\&.sty, .bib, .eps files as it goes. If the .log and .aux file for
+the same \fIfile.tex\fR file exist in the current directory, texdepend
+also reads these, and parses names of included dependent files.
+.PP
+It creates the following lists. Only files which actually exist are
+included.
+.Ip "@includes " 4
+from \einput{} and \einclude{} commands in the .tex file and its desendents.
+.Ip "@packages" 4
+the names of all style and class files from \eusepackage{},
+\edocumentclass{} and \edocumentstyle{}
+commands in the preamble of the main .tex file.
+.Ip "@figs" 4
+the names of all graphics files from \eincludegraphics{} commands in the .tex file.
+.Ip "@styles " 4
+the full path names of \fIall\fR style/tex/cfg files used directly
+or indirectly, found in the .log file (except those config'd in \f(CW@ignore\fR
+or specifed with the \fB\-ignore\fR option).
+.Ip "@bibfiles" 4
+the full path names of .bib files found in the .aux file
+as \ebibdata{} files
+.Ip "@depends" 4
+the full path names of all files found in the .log and .aux files
+(which includes everything in all lists except \f(CW@figs\fR).
+.PP
+By default, the program uses kpsewhich (if an executable exists)
+from the teTeX/kpathsea distribution
+to locate tex/bst/sty files before trying the various \f(CW$TEXINPUTS\fR,
+\f(CW$BIBINPUTS\fR, and \f(CW$TEXFMTS\fR paths, to determine the full path names of input
+files. You may need to change the \f(CW$KPSEWHICH\fR path in the configuration
+section of \fBtexdepend\fR
+.SH "OPTIONS AND ARGUMENTS"
+All options may be abbreviated to their unique truncations, so \fB\-h\fR, \fB\-he\fR,
+\fB\-hel\fR all print help.
+Options which take an argument may be followed by a blank or \*(L'=\*(R'.
+.Ip "\fB\-help\fR" 4
+Print a brief help message and exit.
+.Ip "\fB\-expand\fR" 4
+Expand all file names found in the .tex file to their full path names.
+(File names listed in the .log file always appear as full path names.)
+.Ip "\fB\-format\fR\ [make | perl | 1]" 4
+Determines the output format. \fB\-format=make\fR prints these lists in the form
+of Makefile lists. \fB\-format=perl\fR prints in the form of assignments to
+Perl string variables. In these two cases, each list is printed as a single
+line, with filenames separated by one blank space.
+\fB\-format=1\fR prints these with one filename per line, each preceeded by
+a line beginning with a \*(L'#\*(R'.
+.Ip "\fB\-ignore\fR\ \fIlist\fR" 4
+Specifies a list (enclosed in \*(L' \*(L' if more than one)
+of one or more file extensions (without the leading \*(L'.')
+to be ignored as style files in the set of filenames found in the .log file.
+By default, \*(L'fd\*(R' files are always ignored.
+.Ip "\fB\-out\fR\ \fIfilename\fR" 4
+Send the output to a file
+.Ip "\fB\-print\fR\ [i|p|f|b|s|d]" 4
+Any one or more of the characters i (includes) p (packages)
+f (figs) b (bibfiles) s (styles) d (all dependencies) to specify which
+lists are produced in the output.
+.Ip "\fB\-styles\fR\ \fIlist\fR" 4
+Specifies a list (enclosed in \*(L' \*(L' if more than one)
+of one or more file extensions (without the leading \*(L'.')
+to be treated as style files in the set of filenames found in the .log file,
+in addition to \*(L'sty\*(R' files.
+.Ip "\fB\-verbose\fR" 4
+Lots of messages, written to \s-1STDERR\s0.
+.SH "EXAMPLES"
+To produce lists suitable for a Makefile,
+.PP
+.Vb 3
+\& texdepend -out=myfile.mak myfile.tex
+\&
+\&Then in the Makefile, say
+.Ve
+.Vb 3
+\& include myfile.mak
+\&
+\&A Makefile target ('make lists') which updates the lists could be written:
+.Ve
+.Vb 6
+\& MAIN = myfile
+\& include $(MAIN).mak
+\& ALLFILES = $(MAIN).tex $(INCLUDES) $(BIB_FILES) $(STYLES) $(FIGS)
+\&
+\& lists:
+\& texdepend -out=$(MAIN).mak $(MAIN).tex
+.Ve
+A common requirement for submitting a journal article as LaTeX
+source is to include in a .zip or .tar.gz file copies of all packages
+which have been used in the document. One way to do this is to
+create symbolic links from each such package to a ./styles
+subdirectory.
+.PP
+.Vb 3
+\& texdepend -pr=p -fo=perl -out=packages.pin -expand myfile.tex
+\& perl -e 'do "packages.pin"; @p = split( /\es+/, $packages );' \e
+\& -e 'foreach (@p) {symlink $_, "./styles";}'
+.Ve
+.SH "LIMITATIONS"
+The program is tuned to LaTeX, not TeX.
+.PP
+The handling of graphics files is rudimentary. No attempt is made to
+parse graphics files (for the \f(CW@figs\fR list)
+listed in the .log file because of the complex nesting
+of < > and \*(L"( )\*(R". (Some experiments using \fIText::Balanced.pm\fR
+were made, but made the program very inefficient.)
+In parsing the .tex file, only a limited number
+of graphics commands are recognized, including \eincludegraphics{},
+\eepsfbox{}, and \eepsffile{}. But, you should be using \eincludegraphics{}
+anyway!
+.PP
+Doesn't handle multiple .aux files for a single .tex file, or other
+complexities I've never thought of.
+.SH "BUGS"
+Output may break on systems which have a limitation on line length.
+.SH "SEE ALSO"
+the \fIlatexmk(1l)\fR manpage
+texfind: CTAN support/texfind
+.PP
+/usr/local/teTeX/bin/kpsewhich
+.SH "AUTHOR"
+Michael Friendly <friendly@yorku.ca>
+.SH "LICENSE"
+\fBtexdepend\fR is distributed under the terms of the LaTeX Project Public
+License (LPPL). This means that you may freely copy or distribute this
+software, but if you modify it and distribute it (even locally) you must
+change the name to avoid confusion.
+See: CTAN:: help/Catalog/Licenses.html.
+
+.rn }` ''
+.IX Title "TEXDEPEND 1"
+.IX Name "texdepend - Find dependencies for a LaTeX file"
+
+.IX Header "NAME"
+
+.IX Header "SYNOPSIS"
+
+.IX Header "DESCRIPTION"
+
+.IX Item "@includes "
+
+.IX Item "@packages"
+
+.IX Item "@figs"
+
+.IX Item "@styles "
+
+.IX Item "@bibfiles"
+
+.IX Item "@depends"
+
+.IX Header "OPTIONS AND ARGUMENTS"
+
+.IX Item "\fB\-help\fR"
+
+.IX Item "\fB\-expand\fR"
+
+.IX Item "\fB\-format\fR\ [make | perl | 1]"
+
+.IX Item "\fB\-ignore\fR\ \fIlist\fR"
+
+.IX Item "\fB\-out\fR\ \fIfilename\fR"
+
+.IX Item "\fB\-print\fR\ [i|p|f|b|s|d]"
+
+.IX Item "\fB\-styles\fR\ \fIlist\fR"
+
+.IX Item "\fB\-verbose\fR"
+
+.IX Header "EXAMPLES"
+
+.IX Header "LIMITATIONS"
+
+.IX Header "BUGS"
+
+.IX Header "SEE ALSO"
+
+.IX Header "AUTHOR"
+
+.IX Header "LICENSE"
+