Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

TeX::Hyphen

Name TeX::Hyphen
Version 1.18
Located at /usr/share/perl5/vendor_perl
File /usr/share/perl5/vendor_perl/TeX/Hyphen.pm
Is Core No
Search CPAN for this module TeX::Hyphen
Documentation TeX::Hyphen
Module Details TeX::Hyphen

NAME

TeX::Hyphen -- hyphenate words using TeX's patterns


SYNOPSIS

        use TeX::Hyphen;
        my $hyp = new TeX::Hyphen 'file' => 'hyphen.tex',
                'style' => 'czech', leftmin => 2,
                rightmin => 2;
        my $hyp = new TeX::Hyphen 'file' => 'hyphen.tex',
                'style' => 'utf8';
        # my $hyp = new TeX::Hyphen "hyphen.tex";
        my $word = "representation";
        my @points = $hyp->hyphenate($word);
        print $hyp->visualize($word), "\n";


DESCRIPTION

Constructor new() creates a new Hyphen object and loads the file with patterns into memory. Then you can ask it for hyphenation of a word by calling a method of this object. If no file is specified, the default Donald E. Knuth's hyphen.tex, that is included in this module, is used instead.

Arguments to constructor

You can pass arguments to the new() call as hash, possible options are

file
Name of the file with the patters. It will be loaded and the resulting object will be able to hyphenate according to patterns in that file.

For convenience and backward compatibility, the file name can also be specified as the first (odd) parameter to new().

style
Various languages use special shortcuts to specify the patterns. Instead of doing the full TeX expansion, we use Perl code to parse the patterns. The style option loads TeX::Hyphen::name_of_the_style module and uses the parsing functions found in it.

Currently, the default czech (which also works for English alright), german, and utf8 are available. See the TeX::Hyphen::czech man page for more information, especially if you want to support other languages/styles.

leftmin
The minimum starting substring which will not be hyphenated. This overrides the default specified in the style file.

rightmin
The minimum ending substring which will not be hyphenated. This overrides the default specified in the style file.

Methods that are supported

Method hyphenate() returns list of places where the word can be divided, so

        $hyp->hyphenate('representation')

returns list (3, 5, 8, 10).

Method visualize() can be used to show these points, so

        $hyp->visualize('representation')

should return C<rep-re-sen-ta-tion>, at least for English patterns.

Variables $TeX::Hyphen::LEFTMIN and $TeX::Hyphen::RIGHTMIN can be used to restrict minimal starting and ending substring where it is not possible to hyphenate. They both default to 2 but should be changed to match the paratemers used to generate the patterns.

Variable $TeX::Hyphen::DEBUG can be set to see some statistics and processing.

The file with hyphenation patterns may contain \' and \v accents, used in the Czech (and other) languages.


VERSION

1.18


AVAILABLE FROM

http://www.adelton.com/perl/TeX-Hyphen/


AUTHOR

(c) 1997--2016 Jan Pazdziora.

All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Contact the author at jpx dash perl at adelton dot com.


SEE ALSO

perl(1), TeX::Hyphen::czech.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2025