Difference between revisions of "Documentation/SL/Using TeX hyphenation patterns in OpenOffice.org"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Created page with 'OpenOffice.org uses http://sourceforge.net/projects/hunspell/files/Hyphen/ Hyphen, part of the Hunspell project, as its hyphenation tool. Hyphen can use TeX hyphenation patters …')
 
Line 20: Line 20:
 
3. Run the substrings.pl conversion script
 
3. Run the substrings.pl conversion script
 
Download the latest version of substrings.pl conversion script from http://sourceforge.net/projects/hunspell/files/Hyphen the Hyphen repository. At the time of writing this was http://sourceforge.net/projects/hunspell/files/Hyphen/2.5/hyphen-2.5.tar.gz/download hyphen-2.5.tar.gz
 
Download the latest version of substrings.pl conversion script from http://sourceforge.net/projects/hunspell/files/Hyphen the Hyphen repository. At the time of writing this was http://sourceforge.net/projects/hunspell/files/Hyphen/2.5/hyphen-2.5.tar.gz/download hyphen-2.5.tar.gz
./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic ISO8859-2 2 2
+
 
 +
The script takes the following parameters: the input file name, the output file name, the code-page setting and the LEFTHYPHENMIN and RIGHTHYPHEMIN values that define the minimum left and right length of hyphenated words.
 +
 
 +
Example: for Slovenian the ISO-8859-2 code page is used and left and right hyphenmin values are 2. So one would use:
 +
./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic ISO8859-2 2 2
 +
Warning: see how ISO8859-2 is used and not ISO-8859-2, remember to omit the first hyphen in the ISO-2 codepage name!
  
 
4. Add hyphenation rules for hyphens
 
4. Add hyphenation rules for hyphens
OpenOffice.org (until version 3.4) treated hyphens as letters, so there were problems hyphenating words with hyphens. If your user base includes many using OOo prior to 3.4 consider adding the following lines at the end of the converted hyphenation patterns file (.dat):  
+
Special characters (apostrophe and hyphen) are word characters in OpenOffice.org (until version 3.4), so there are problems hyphenating words with hyphens or apostrophes. Please consider adding the following lines at the end of the converted hyphenation patterns file (.dat):  
  
 
5. Package the converted hyphenation patterns in a OpenOffice.org extension and upload it to the OOo extension repository. Try extensively if it works properly in OpenOffice.org.
 
5. Package the converted hyphenation patterns in a OpenOffice.org extension and upload it to the OOo extension repository. Try extensively if it works properly in OpenOffice.org.
  
With OpenOffice.org 3.4 support for UTF-8 patters will be introduced, which makes the Step 2 (from above) obsolete and changes the conversion line from Step 3 into "./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic UTF-8 2 2". But that change will not affect older OOo version and such patterns will not work with version before 3.4. If you decide to make an extension version with hyphenation patterns for OOo in UTF-8, do not forget to set the required version of OpenOffice.org to 3.4 or higher!
+
With OpenOffice.org 3.4 support for UTF-8 patters will be introduced, which makes the Step 2 (from above) obsolete and changes the conversion line from Step 3 into:
 +
./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic UTF-8 2 2
 +
But that change will not affect older OOo version and such patterns will not work with version before 3.4. If you decide to make an extension version with hyphenation patterns for OOo in UTF-8, do not forget to set the required version of OpenOffice.org to 3.4 or higher!

Revision as of 10:34, 23 July 2010

OpenOffice.org uses http://sourceforge.net/projects/hunspell/files/Hyphen/ Hyphen, part of the Hunspell project, as its hyphenation tool.

Hyphen can use TeX hyphenation patters for hyphenation, but because of differences between TeX hyphenation and Hyphen the TeX hyphenation patterns must be first converted. If conversion is not applied, several issues can surprise: 1) not all TeX patterns work in OpenOffice.org which means that TeX patterns perform sub-quality; 2) if code-page is not set correctly the TeX patterns can behave erratically in Hyphen;

Because of this the following conversion process must be followed step-by-step:

1. Download up-to-date TeX hyphenation patterns http://tug.org/tex-hyphen/Tex hyphenation repository contains up-to-date TeX hyphenation patterns. They are located here: http://tug.org/svn/texhyphen/trunk/hyph-utf8/

Example: for Slovenian language one would download file hyph-sl.pat.txt from the SVN repository.

2. Convert TeX hyphenation patterns file into proper character set Hyphen for OpenOffice.org (prior to version 3.4) uses ISO-8859-X code-pages while TeX hyphenation patterns are in UTF-8. So conversion of downloaded patterns into right ISO-8859-X code-page is necessary.

Example: Slovenian language uses ISO-8859-2 code-page, so one would open the UTF-8 file in a code-page savvy text editor and convert&save it into ISO-8859-2 code-page.

3. Run the substrings.pl conversion script Download the latest version of substrings.pl conversion script from http://sourceforge.net/projects/hunspell/files/Hyphen the Hyphen repository. At the time of writing this was http://sourceforge.net/projects/hunspell/files/Hyphen/2.5/hyphen-2.5.tar.gz/download hyphen-2.5.tar.gz

The script takes the following parameters: the input file name, the output file name, the code-page setting and the LEFTHYPHENMIN and RIGHTHYPHEMIN values that define the minimum left and right length of hyphenated words.

Example: for Slovenian the ISO-8859-2 code page is used and left and right hyphenmin values are 2. So one would use: ./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic ISO8859-2 2 2 Warning: see how ISO8859-2 is used and not ISO-8859-2, remember to omit the first hyphen in the ISO-2 codepage name!

4. Add hyphenation rules for hyphens Special characters (apostrophe and hyphen) are word characters in OpenOffice.org (until version 3.4), so there are problems hyphenating words with hyphens or apostrophes. Please consider adding the following lines at the end of the converted hyphenation patterns file (.dat):

5. Package the converted hyphenation patterns in a OpenOffice.org extension and upload it to the OOo extension repository. Try extensively if it works properly in OpenOffice.org.

With OpenOffice.org 3.4 support for UTF-8 patters will be introduced, which makes the Step 2 (from above) obsolete and changes the conversion line from Step 3 into: ./substrings.pl hyph-sl.pat.txt hyph_sl_SI.dic UTF-8 2 2 But that change will not affect older OOo version and such patterns will not work with version before 3.4. If you decide to make an extension version with hyphenation patterns for OOo in UTF-8, do not forget to set the required version of OpenOffice.org to 3.4 or higher!

Personal tools