summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-21 22:08:40 +0000
committerKarl Berry <karl@freefriends.org>2013-08-21 22:08:40 +0000
commitff68e0198284583e7105810ca73c7cc5c10d39f5 (patch)
tree5f193223a35a55859966ccda5f0d7f0327f9e502 /Master
parentc3c661426b38899deda17ccef1b1494d440b297c (diff)
latexpand (21aug13)
git-svn-id: svn://tug.org/texlive/trunk@31489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/support/latexpand/Makefile10
-rw-r--r--Master/texmf-dist/doc/support/latexpand/README111
-rw-r--r--Master/texmf-dist/doc/support/latexpand/tests/df-conflict/a.tex7
-rw-r--r--Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b.tex1
-rw-r--r--Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b/README-df-conflict.txt1
-rw-r--r--Master/texmf-dist/doc/support/latexpand/tests/text-after-end.tex16
-rw-r--r--Master/texmf-dist/doc/support/latexpand/version.txt4
-rwxr-xr-xMaster/texmf-dist/scripts/latexpand/latexpand37
8 files changed, 122 insertions, 65 deletions
diff --git a/Master/texmf-dist/doc/support/latexpand/Makefile b/Master/texmf-dist/doc/support/latexpand/Makefile
index b0715a74dfb..0b8b24c2914 100644
--- a/Master/texmf-dist/doc/support/latexpand/Makefile
+++ b/Master/texmf-dist/doc/support/latexpand/Makefile
@@ -1,11 +1,13 @@
all: latexpand.zip
README: latexpand
- ./latexpand --help > README
+ pod2text latexpand > README
-.PHONY: latexpand.zip
-latexpand.zip: README
+.PHONY: all force
+latexpand.zip: README force
-$(RM) $@
@echo "latexpand version $$(git rev-parse HEAD).\n\
-Commited on $$(git show HEAD --pretty=format:'%cd')." > version.txt
+Commited on $$(git show -s HEAD --pretty=format:'%cd')." > version.txt
zip $@ README version.txt $$(git ls-files | grep -v '\.gitignore')
+
+force:
diff --git a/Master/texmf-dist/doc/support/latexpand/README b/Master/texmf-dist/doc/support/latexpand/README
index 605466deb12..18ab86cce42 100644
--- a/Master/texmf-dist/doc/support/latexpand/README
+++ b/Master/texmf-dist/doc/support/latexpand/README
@@ -1,52 +1,59 @@
-LATEXPAND(1) User Contributed Perl Documentation LATEXPAND(1)
-
-
-
-NNAAMMEE
- latexpand - Flatten LaTeX file by expanding \include and \input, remove
- comments
-
-SSYYNNOOPPSSIISS
- latexpand [options] FILE...
-
- Options:
- --verbose show what's going on
- --keep-comments don't strip comments
- --empty-comments keep empty comments (i.e. % at end of lines) for clarity
- --keep-includes don't expand \input and \include directives
- --expand-usepackage
- Expand \usepackage{...} directives if the
- corresponding .sty file is found in
- $TEXINPUTS
- --expand-bbl FILE
- Expand the bibliography by inlining FILE
- (should be a *.bbl file)
- --help this help message
- --output <file>, -o <file>
- generate output in <file>
- --explain generate explanatory comments in output
- --show-graphics show included graphics
- --graphics_extensions
- colon-separated list of possible graphics extensions
- (used by --show-graphics to find the actual graphics files)
-
-UUSSEESS
- The most common use of latexpand is to simplify distribution of source
- LaTeX files, typically to satisfy the requirement of editors and
- archival sites (springer, arXiv.org, ...) who force the authors to
- submit sources. One does not necessarily want to submit sources with
- comments, and uploading a document made of several files including each
- other is a bit painful. By default, latexpand answers both problems by
- outputing a single LaTeX file that contain no comment.
-
-GGEETTTTIINNGG LLAATTEEXXPPAANNDD
- The latest version of latexpand is available here:
-
- https://gitorious.org/latexpand
-
-BBUUGGSS
- Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
-
-
-
-perl v5.10.1 2012-11-07 LATEXPAND(1)
+NAME
+ latexpand - Flatten LaTeX file by expanding \include and \input, ... and
+ remove comments
+
+SYNOPSIS
+ latexpand [options] FILE...
+
+ Options:
+ --verbose show what's going on
+ --keep-comments don't strip comments (comments are lines
+ starting with %, and anything below
+ \end{document})
+ --empty-comments keep empty comments (i.e. % at end of lines) for clarity
+ --keep-includes don't expand \input and \include directives
+ --expand-usepackage
+ Expand \usepackage{...} directives if the
+ corresponding .sty file is found in
+ $TEXINPUTS
+ --expand-bbl FILE
+ Expand the bibliography by inlining FILE
+ (should be a *.bbl file)
+ --help this help message
+ --output <file>, -o <file>
+ generate output in <file>
+ --explain generate explanatory comments in output
+ --show-graphics show included graphics
+ --graphics_extensions
+ colon-separated list of possible graphics extensions
+ (used by --show-graphics to find the actual graphics files)
+
+USES
+ The most common use of latexpand is to simplify distribution of source
+ LaTeX files, typically to satisfy the requirement of editors and
+ archival sites (springer, arXiv.org, ...) who force the authors to
+ submit sources. One does not necessarily want to submit sources with
+ comments, and uploading a document made of several files including each
+ other is a bit painful. By default, latexpand answers both problems by
+ outputing a single LaTeX file that contain no comment.
+
+GETTING LATEXPAND
+ The latest version of latexpand is available here:
+
+ https://gitorious.org/latexpand
+
+ Versions are uploaded to ctan.org from time to time:
+
+ http://www.ctan.org/pkg/latexpand
+
+BUGS
+ Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
+
+ Known bugs
+ latexpand currently ignores \begin{verbatim} ... \end{verbatim}, and
+ will therefore process any \include, \input, ... directives that appear
+ within verbatim environments (while it shouldn't).
+
+ It would be nice to remove code between \begin{comment} and
+ \end{comment} too if \usepackage{comment} is used.
+
diff --git a/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/a.tex b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/a.tex
new file mode 100644
index 00000000000..a91beee2607
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/a.tex
@@ -0,0 +1,7 @@
+\documentclass{article}
+\begin{document}
+
+Hello
+\input{b}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b.tex b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b.tex
new file mode 100644
index 00000000000..1aa90fca797
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b.tex
@@ -0,0 +1 @@
+world.
diff --git a/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b/README-df-conflict.txt b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b/README-df-conflict.txt
new file mode 100644
index 00000000000..8097e2eb5fc
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexpand/tests/df-conflict/b/README-df-conflict.txt
@@ -0,0 +1 @@
+This directory is likely to confuse latexpand.
diff --git a/Master/texmf-dist/doc/support/latexpand/tests/text-after-end.tex b/Master/texmf-dist/doc/support/latexpand/tests/text-after-end.tex
new file mode 100644
index 00000000000..16bd1b73398
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexpand/tests/text-after-end.tex
@@ -0,0 +1,16 @@
+\documentclass{article}
+
+\begin{document}
+should be displayed
+\verb|\end{document}|
+should be displayed too.
+\end{document} end of line discarded.
+
+should not be displayed.
+\end{document}
+should not be displayed either.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/doc/support/latexpand/version.txt b/Master/texmf-dist/doc/support/latexpand/version.txt
index 75cbc53870a..70838403e17 100644
--- a/Master/texmf-dist/doc/support/latexpand/version.txt
+++ b/Master/texmf-dist/doc/support/latexpand/version.txt
@@ -1,2 +1,2 @@
-latexpand version b88cfb73604b8424c9cae5ea4acc6ff2f27d3c12.
-Commited on Wed Nov 7 10:55:26 2012 +0100.
+latexpand version 349e09efc922330e4f158b5871f89f5f2e0900b9.
+Commited on Wed Aug 14 12:44:40 2013 +0200.
diff --git a/Master/texmf-dist/scripts/latexpand/latexpand b/Master/texmf-dist/scripts/latexpand/latexpand
index e66f8187ec7..23bf1d1db09 100755
--- a/Master/texmf-dist/scripts/latexpand/latexpand
+++ b/Master/texmf-dist/scripts/latexpand/latexpand
@@ -73,12 +73,19 @@ sub process_file
my $prefix = (shift || "");
local(*FILE);
open(FILE, $file) or die "could not open input file '$file'\n";
- while (<FILE>) {
- process_line($_, $prefix);
+ while (my $line = <FILE>) {
+ process_line($line, $prefix);
if (/^%.*[^\n]\z/ || /[^\\]%.*[^\n]\z/) {
# file ends with a comment not ending with a newline
print "\n";
}
+ # Garbage at end of line after \end{document} is
+ # ignored by LaTeX, but we don't allow anything before
+ # to avoid e.g. \verb|\end{document}| from terminating
+ # the file.
+ if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+ last;
+ }
}
close(FILE);
}
@@ -178,14 +185,14 @@ sub find_file
{
my ($file, $path) = @_;
if (File::Spec->file_name_is_absolute($file)) {
- if (-e "$file") {
+ if (-e "$file" && ! -d "$file") {
return $file;
} else {
return;
}
}
foreach my $dir (split(':', $path)) {
- if (-e "$dir/$file") {
+ if (-e "$dir/$file" && ! -d "$dir/$file") {
return("$dir/$file");
}
}
@@ -197,15 +204,18 @@ __END__
=head1 NAME
-latexpand - Flatten LaTeX file by expanding \include and \input, remove comments
+latexpand - Flatten LaTeX file by expanding \include and \input, ... and remove comments
=head1 SYNOPSIS
latexpand [options] FILE...
- Options:
+=head2 Options:
+
--verbose show what's going on
- --keep-comments don't strip comments
+ --keep-comments don't strip comments (comments are lines
+ starting with %, and anything below
+ \end{document})
--empty-comments keep empty comments (i.e. % at end of lines) for clarity
--keep-includes don't expand \input and \include directives
--expand-usepackage
@@ -240,6 +250,19 @@ The latest version of latexpand is available here:
https://gitorious.org/latexpand
+Versions are uploaded to ctan.org from time to time:
+
+ http://www.ctan.org/pkg/latexpand
+
=head1 BUGS
Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
+
+=head2 Known bugs
+
+latexpand currently ignores \begin{verbatim} ... \end{verbatim}, and
+will therefore process any \include, \input, ... directives that
+appear within verbatim environments (while it shouldn't).
+
+It would be nice to remove code between \begin{comment} and
+\end{comment} too if \usepackage{comment} is used.