summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/findhyph
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/texmf-dist/doc/support/findhyph
parentd1fa41d1e3da91e706a0fb84aab888756a3d279e (diff)
findhyph (6feb12)
git-svn-id: svn://tug.org/texlive/trunk@25322 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/findhyph')
-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
4 files changed, 78 insertions, 14 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