summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-02-06 23:39:39 +0000
committerKarl Berry <karl@freefriends.org>2012-02-06 23:39:39 +0000
commitf1cf6c51ef351da06da255b05a237a417a15b9b2 (patch)
tree3222d6151448c41213429b0ecd07e1f7a8013e90 /Master
parentd1fa41d1e3da91e706a0fb84aab888756a3d279e (diff)
findhyph (6feb12)
git-svn-id: svn://tug.org/texlive/trunk@25322 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/support/findhyph/Makefile.doc (renamed from Master/texmf-dist/doc/support/findhyph/Makefile)4
-rw-r--r--Master/texmf-dist/doc/support/findhyph/README2
-rwxr-xr-xMaster/texmf-dist/doc/support/findhyph/findhyph.bat65
-rw-r--r--Master/texmf-dist/doc/support/findhyph/findhyph.txt21
-rwxr-xr-xMaster/texmf-dist/scripts/findhyph/findhyph65
-rw-r--r--Master/texmf/doc/man/man1/findhyph.123
-rw-r--r--Master/texmf/doc/man/man1/findhyph.man1.pdfbin6774 -> 7477 bytes
7 files changed, 155 insertions, 25 deletions
diff --git a/Master/texmf-dist/doc/support/findhyph/Makefile b/Master/texmf-dist/doc/support/findhyph/Makefile.doc
index 808cba34385..bcb3573496c 100644
--- a/Master/texmf-dist/doc/support/findhyph/Makefile
+++ b/Master/texmf-dist/doc/support/findhyph/Makefile.doc
@@ -1,9 +1,9 @@
-TEX = \\documentclass{article}\\usepackage[T1]{fontenc}\\usepackage{textcomp}\\begin{document}\\input{fh.tex}\\end{document}
+TEX = \\documentclass{article}\\usepackage[T1]{fontenc}\\usepackage{textcomp}\\usepackage{a4wide}\\begin{document}\\input{fh.tex}\\end{document}
doc:
pod2man -c "" ../findhyph > findhyph.1
pod2text ../findhyph > findhyph.txt
- echo $(TEX) > findhyph.tex
+ env echo $(TEX) > findhyph.tex
pod2latex -out fh.tex ../findhyph
pdflatex findhyph.tex
pdflatex findhyph.tex
diff --git a/Master/texmf-dist/doc/support/findhyph/README b/Master/texmf-dist/doc/support/findhyph/README
index 17c56b1ca89..1451de807bc 100644
--- a/Master/texmf-dist/doc/support/findhyph/README
+++ b/Master/texmf-dist/doc/support/findhyph/README
@@ -1,7 +1,7 @@
findhyph -- Perl program which finds all words hyphenated by TeX in a document;
see findhyph.pdf or findhyph.1 for details
-Copyright (c) Martin Budaj 2000, 2001, 2009
+Copyright (c) Martin Budaj 2000, 2001, 2009, 2012
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/Master/texmf-dist/doc/support/findhyph/findhyph.bat b/Master/texmf-dist/doc/support/findhyph/findhyph.bat
index cc8d2ce283a..46ed04cbccc 100755
--- a/Master/texmf-dist/doc/support/findhyph/findhyph.bat
+++ b/Master/texmf-dist/doc/support/findhyph/findhyph.bat
@@ -19,7 +19,7 @@ $opt_l = 'kKsSvVzZoOuUiIA'; # defaults for Slovak and Czech
$opt_c = $opt_f = $opt_h = $opt_v = 0;
getopts('cfphvl:');
-$version_msg = "findhyph version 2.0\n";
+$version_msg = "findhyph version 3.0\n";
$help_msg = "\nUsage: findhyph [options] <yourtexfile.log>\n" .
"\n" .
"Options: -c display hyphenated words in context\n" .
@@ -46,9 +46,13 @@ $pageno_allowed = 0;
$write_hyph_page = 0;
$write_prep_page = 0;
$act_text = "";
+$looseness = 0;
while(<IN>) {
chomp;
+ if (/^\@looseness=(\-?\d+)$/) {
+ $looseness = $1;
+ }
if (/^\@firstpass$/) {
$pageno_allowed = 0;
$endgraf = 0;
@@ -59,6 +63,7 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
if (/^\@secondpass$/) {
@@ -67,6 +72,7 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
if (/^\@emergencypass$/) {
@@ -74,14 +80,20 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
- if ($search && /^@@(\d+).+ t=(\d+) \-\> @@(\d+)/) {
+ if ($search && /^@@(\d+): line (\d+)\..+ t=(\-?\d+) \-\> @@(\d+)/) {
$act_break = $1;
- $BREAKS{$act_break}{'prev'} = $3;
- if ($endgraf && $2 < $demerits) {
+ $BREAKS{$act_break}{'prev'} = $4;
+ if ($endgraf && $3 < $demerits) {
$max_break = $1;
- $demerits = $2;
+ $max_line = $2;
+ $demerits = $3;
+ }
+ if ($endgraf && $looseness != 0) {
+ $LOOSE{$1}{"line"} = $2;
+ $LOOSE{$1}{"demerits"} = $3;
}
$act_text .= "\@$act_break\@";
next;
@@ -101,6 +113,7 @@ while(<IN>) {
$pageno_allowed = 1;
do_hyph();
$search = 0;
+ $looseness = 0;
next;
}
if ($search) {
@@ -125,6 +138,22 @@ close(O1);
close(O2) if $opt_p;
sub do_hyph {
+ if ($looseness != 0) {
+ $diff_line = 1e10;
+ $diff_demer = 1e10;
+ for $i (keys %LOOSE) {
+ if (abs($LOOSE{$i}{"line"} - $max_line - $looseness) < $diff_line) {
+ $diff_line = abs($LOOSE{$i}{"line"} - $max_line - $looseness);
+ $diff_demer = $LOOSE{$i}{"demerits"};
+ $max_break = $i;
+ }
+ if (abs($LOOSE{$i}{"line"} - $max_line - $looseness) == $diff_line &&
+ $LOOSE{$i}{"demerits"} < $diff_demer) {
+ $diff_demer = $LOOSE{$i}{"demerits"};
+ $max_break = $i;
+ }
+ }
+ }
$br = $max_break;
while (1) {
$br = $BREAKS{$br}{'prev'};
@@ -213,6 +242,13 @@ B<findhyph [options]> F<foo.log>
=back
+If you are setting C<\looseness=E<lt>NE<gt>> to optimize paragraphs,
+you need to pass that information to the file F<foo.log> in a form
+C<@looseness=E<lt>NE<gt>> (on a separate line). You can use a macro like
+C<\def\setlooseness#1{\immediate\write-1{@looseness=#1}\looseness=#1}>
+for this purpose. If the paragraph contains material in display math mode,
+you need to use the macro in all split parts of the paragraph.
+
=head1 OPTIONS
=over 4
@@ -285,7 +321,7 @@ public release
=item *
-fixes in line breaks detection algorithm; support for third pass of line
+fixes in line breaks detection algorithm; support for the third pass of line
breaking algorithm in TeX (positive \emergencystretch); support for
discretionary breaks in the first pass
@@ -310,6 +346,21 @@ suggestions and testing by Pavel Striz
=back
+=head4 3.0 (2012-02-01)
+
+=over 4
+
+=item *
+
+fixed a bug when total paragraph demerits are negative
+
+=item *
+
+C<\looseness> setting is now taken into account (thanks to Karel Horak
+for identifying the issue)
+
+=back
+
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
@@ -319,7 +370,7 @@ any later version.
=head1 AUTHOR
-Copyright (c) Martin Budaj E<lt>m.b@speleo.skE<gt> 2000, 2001, 2009
+Copyright (c) Martin Budaj E<lt>m.b@speleo.skE<gt> 2000, 2001, 2009, 2012
=cut
diff --git a/Master/texmf-dist/doc/support/findhyph/findhyph.txt b/Master/texmf-dist/doc/support/findhyph/findhyph.txt
index 1362b9a8222..ed089eed89e 100644
--- a/Master/texmf-dist/doc/support/findhyph/findhyph.txt
+++ b/Master/texmf-dist/doc/support/findhyph/findhyph.txt
@@ -13,6 +13,13 @@ SYNOPSIS
3) findhyph [options] foo.log
+ If you are setting "\looseness=<N>" to optimize paragraphs, you need to
+ pass that information to the file foo.log in a form "@looseness=<N>" (on
+ a separate line). You can use a macro like
+ "\def\setlooseness#1{\immediate\write-1{@looseness=#1}\looseness=#1}"
+ for this purpose. If the paragraph contains material in display math
+ mode, you need to use the macro in all split parts of the paragraph.
+
OPTIONS
-c display hyphenated words in context
@@ -53,9 +60,9 @@ HISTORY
* public release
2.0 (2009-08-10)
- * fixes in line breaks detection algorithm; support for third pass of
- line breaking algorithm in TeX (positive \emergencystretch); support
- for discretionary breaks in the first pass
+ * fixes in line breaks detection algorithm; support for the third pass
+ of line breaking algorithm in TeX (positive \emergencystretch);
+ support for discretionary breaks in the first pass
* page number detection improved (recognized negative page numbers,
compound page numbers when "\count1" to "\count9" registers are
@@ -69,6 +76,12 @@ HISTORY
* suggestions and testing by Pavel Striz
+ 3.0 (2012-02-01)
+ * fixed a bug when total paragraph demerits are negative
+
+ * "\looseness" setting is now taken into account (thanks to Karel
+ Horak for identifying the issue)
+
LICENSE
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -76,5 +89,5 @@ LICENSE
version.
AUTHOR
- Copyright (c) Martin Budaj <m.b@speleo.sk> 2000, 2001, 2009
+ Copyright (c) Martin Budaj <m.b@speleo.sk> 2000, 2001, 2009, 2012
diff --git a/Master/texmf-dist/scripts/findhyph/findhyph b/Master/texmf-dist/scripts/findhyph/findhyph
index 75af7d2a829..66fa67d999a 100755
--- a/Master/texmf-dist/scripts/findhyph/findhyph
+++ b/Master/texmf-dist/scripts/findhyph/findhyph
@@ -6,7 +6,7 @@ $opt_l = 'kKsSvVzZoOuUiIA'; # defaults for Slovak and Czech
$opt_c = $opt_f = $opt_h = $opt_v = 0;
getopts('cfphvl:');
-$version_msg = "findhyph version 2.0\n";
+$version_msg = "findhyph version 3.0\n";
$help_msg = "\nUsage: findhyph [options] <yourtexfile.log>\n" .
"\n" .
"Options: -c display hyphenated words in context\n" .
@@ -33,9 +33,13 @@ $pageno_allowed = 0;
$write_hyph_page = 0;
$write_prep_page = 0;
$act_text = "";
+$looseness = 0;
while(<IN>) {
chomp;
+ if (/^\@looseness=(\-?\d+)$/) {
+ $looseness = $1;
+ }
if (/^\@firstpass$/) {
$pageno_allowed = 0;
$endgraf = 0;
@@ -46,6 +50,7 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
if (/^\@secondpass$/) {
@@ -54,6 +59,7 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
if (/^\@emergencypass$/) {
@@ -61,14 +67,20 @@ while(<IN>) {
$act_text = "";
@USED = ();
%BREAKS = ();
+ %LOOSE = ();
next;
}
- if ($search && /^@@(\d+).+ t=(\d+) \-\> @@(\d+)/) {
+ if ($search && /^@@(\d+): line (\d+)\..+ t=(\-?\d+) \-\> @@(\d+)/) {
$act_break = $1;
- $BREAKS{$act_break}{'prev'} = $3;
- if ($endgraf && $2 < $demerits) {
+ $BREAKS{$act_break}{'prev'} = $4;
+ if ($endgraf && $3 < $demerits) {
$max_break = $1;
- $demerits = $2;
+ $max_line = $2;
+ $demerits = $3;
+ }
+ if ($endgraf && $looseness != 0) {
+ $LOOSE{$1}{"line"} = $2;
+ $LOOSE{$1}{"demerits"} = $3;
}
$act_text .= "\@$act_break\@";
next;
@@ -88,6 +100,7 @@ while(<IN>) {
$pageno_allowed = 1;
do_hyph();
$search = 0;
+ $looseness = 0;
next;
}
if ($search) {
@@ -112,6 +125,22 @@ close(O1);
close(O2) if $opt_p;
sub do_hyph {
+ if ($looseness != 0) {
+ $diff_line = 1e10;
+ $diff_demer = 1e10;
+ for $i (keys %LOOSE) {
+ if (abs($LOOSE{$i}{"line"} - $max_line - $looseness) < $diff_line) {
+ $diff_line = abs($LOOSE{$i}{"line"} - $max_line - $looseness);
+ $diff_demer = $LOOSE{$i}{"demerits"};
+ $max_break = $i;
+ }
+ if (abs($LOOSE{$i}{"line"} - $max_line - $looseness) == $diff_line &&
+ $LOOSE{$i}{"demerits"} < $diff_demer) {
+ $diff_demer = $LOOSE{$i}{"demerits"};
+ $max_break = $i;
+ }
+ }
+ }
$br = $max_break;
while (1) {
$br = $BREAKS{$br}{'prev'};
@@ -200,6 +229,13 @@ B<findhyph [options]> F<foo.log>
=back
+If you are setting C<\looseness=E<lt>NE<gt>> to optimize paragraphs,
+you need to pass that information to the file F<foo.log> in a form
+C<@looseness=E<lt>NE<gt>> (on a separate line). You can use a macro like
+C<\def\setlooseness#1{\immediate\write-1{@looseness=#1}\looseness=#1}>
+for this purpose. If the paragraph contains material in display math mode,
+you need to use the macro in all split parts of the paragraph.
+
=head1 OPTIONS
=over 4
@@ -272,7 +308,7 @@ public release
=item *
-fixes in line breaks detection algorithm; support for third pass of line
+fixes in line breaks detection algorithm; support for the third pass of line
breaking algorithm in TeX (positive \emergencystretch); support for
discretionary breaks in the first pass
@@ -297,6 +333,21 @@ suggestions and testing by Pavel Striz
=back
+=head4 3.0 (2012-02-01)
+
+=over 4
+
+=item *
+
+fixed a bug when total paragraph demerits are negative
+
+=item *
+
+C<\looseness> setting is now taken into account (thanks to Karel Horak
+for identifying the issue)
+
+=back
+
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
@@ -306,6 +357,6 @@ any later version.
=head1 AUTHOR
-Copyright (c) Martin Budaj E<lt>m.b@speleo.skE<gt> 2000, 2001, 2009
+Copyright (c) Martin Budaj E<lt>m.b@speleo.skE<gt> 2000, 2001, 2009, 2012
=cut
diff --git a/Master/texmf/doc/man/man1/findhyph.1 b/Master/texmf/doc/man/man1/findhyph.1
index 27086ba6590..a32ec0df968 100644
--- a/Master/texmf/doc/man/man1/findhyph.1
+++ b/Master/texmf/doc/man/man1/findhyph.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
+.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "FINDHYPH 1"
-.TH FINDHYPH 1 "2009-08-10" "perl v5.10.0" ""
+.TH FINDHYPH 1 "2012-02-01" "perl v5.10.1" ""
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -147,6 +147,13 @@ set \f(CW\*(C`\etracingparagraphs=1\*(C'\fR in a TeX document \fIfoo.tex\fR and
.IP "3)" 4
.IX Item "3)"
\&\fBfindhyph [options]\fR \fIfoo.log\fR
+.PP
+If you are setting \f(CW\*(C`\elooseness=<N>\*(C'\fR to optimize paragraphs,
+you need to pass that information to the file \fIfoo.log\fR in a form
+\&\f(CW\*(C`@looseness=<N>\*(C'\fR (on a separate line). You can use a macro like
+\&\f(CW\*(C`\edef\esetlooseness#1{\eimmediate\ewrite\-1{@looseness=#1}\elooseness=#1}\*(C'\fR
+for this purpose. If the paragraph contains material in display math mode,
+you need to use the macro in all split parts of the paragraph.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-c\fR" 4
@@ -196,7 +203,7 @@ public release
2.0 (2009\-08\-10)
.IX Subsection "2.0 (2009-08-10)"
.IP "\(bu" 4
-fixes in line breaks detection algorithm; support for third pass of line
+fixes in line breaks detection algorithm; support for the third pass of line
breaking algorithm in TeX (positive \eemergencystretch); support for
discretionary breaks in the first pass
.IP "\(bu" 4
@@ -210,6 +217,14 @@ configurable list of prepositions and conjunctions
hyphenated words can be displayed in context
.IP "\(bu" 4
suggestions and testing by Pavel Striz
+.PP
+3.0 (2012\-02\-01)
+.IX Subsection "3.0 (2012-02-01)"
+.IP "\(bu" 4
+fixed a bug when total paragraph demerits are negative
+.IP "\(bu" 4
+\&\f(CW\*(C`\elooseness\*(C'\fR setting is now taken into account (thanks to Karel Horak
+for identifying the issue)
.SH "LICENSE"
.IX Header "LICENSE"
This program is free software; you can redistribute it and/or modify
@@ -218,4 +233,4 @@ the Free Software Foundation; either version 2 of the License, or
any later version.
.SH "AUTHOR"
.IX Header "AUTHOR"
-Copyright (c) Martin Budaj <m.b@speleo.sk> 2000, 2001, 2009
+Copyright (c) Martin Budaj <m.b@speleo.sk> 2000, 2001, 2009, 2012
diff --git a/Master/texmf/doc/man/man1/findhyph.man1.pdf b/Master/texmf/doc/man/man1/findhyph.man1.pdf
index 96a4fc4e22b..565770f4879 100644
--- a/Master/texmf/doc/man/man1/findhyph.man1.pdf
+++ b/Master/texmf/doc/man/man1/findhyph.man1.pdf
Binary files differ