summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/testhyphens
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-09-13 23:20:33 +0000
committerKarl Berry <karl@freefriends.org>2014-09-13 23:20:33 +0000
commit4a25925403eff05bc91792ba22bd62105c3b810e (patch)
tree87c3d8a24d9d8041c39852136867302223a6cc04 /Master/texmf-dist/source/latex/testhyphens
parent94107bb1fcc8f814e75bda7bb15a3cfb213dd735 (diff)
testhyphens (14sep14)
git-svn-id: svn://tug.org/texlive/trunk@35162 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/testhyphens')
-rw-r--r--Master/texmf-dist/source/latex/testhyphens/testhyphens.dtx147
1 files changed, 96 insertions, 51 deletions
diff --git a/Master/texmf-dist/source/latex/testhyphens/testhyphens.dtx b/Master/texmf-dist/source/latex/testhyphens/testhyphens.dtx
index 956ae6348dd..4f3a926f460 100644
--- a/Master/texmf-dist/source/latex/testhyphens/testhyphens.dtx
+++ b/Master/texmf-dist/source/latex/testhyphens/testhyphens.dtx
@@ -63,7 +63,7 @@ charge for copying, etc.
%</driver>
%<package>\ProvidesPackage{testhyphens}[%
%<*driver,package>
-2014/07/07 v.0.5
+2014/09/13 v.0.6
%<package>Prints list of hyphenated words]
%</driver,package>
%<*driver>
@@ -72,7 +72,7 @@ charge for copying, etc.
%<*driver>
\documentclass{ltxdoc}
\GetFileInfo{testhyphens.dtx}
- \title{The \textsf{testhyphens} package\\
+ \title{The \textsf{testhyphens} package%
\thanks{This file
has version number \fileversion, last
revised on \filedate.}}
@@ -105,31 +105,37 @@ charge for copying, etc.
%</driver>
% \fi
%
-% \CheckSum{0}
+% \CheckSum{106}
% \begin{abstract}
% This small file implements some code that was already published on TUGboat,
% but it is adapted to \LaTeX\ and it is enriched with other commands. It helps
% those who create hyphenation patterns, as well normal \LaTeX\ users, to test
% the correctness of the hyphenations of words lists. It works also with
-% \prog{xelatex}.
+% \prog{xelatex} and \prog{lualatex}.
% \end{abstract}
+%
+%{\columnseprule=0.4pt
+%\begin{multicols}{2}
+%\tableofcontents
+%\end{multicols}}
+%
% \section{Introduction}
%
% This small package introduces the declaration |\testhyphens| and the environment
-% |checkhyphens|. The declaration, to be used within a group where the hyphenation
-% parameters may be optionally set to any specific value, and process a list
-% of one or more space delimited words typesetting the one per line with hyphens
+% |checkhyphens|. The declaration is to be used within a group where the hyphenation
+% parameters may be optionally set to any specific value; it processes a list
+% of one or more space delimited words typesetting them one per line with hyphens
% between every syllable.
%
-% The language, its hyphenation rules that are to be checked, may be the
+% The language, the hyphenation rules of which are to be tested, may be the
% default language before entering the group, or can be a language specified
% with |\selectlanguage| within the group before activating the declaration:
-% this declaration could be set within a |\foreignlangeuage|\Arg{language}
+% this declaration could be set within a |\foreignlangeuage|\Arg{language}
% argument or within the body of an |otherlanguage| environment.
%
% The environment |checkhyphens| accepts an optional argument to set the
% hyphenation parameters, and a body consisting of a list
-% of one or more words; again words are separated by spaces, and if the
+% of one or more space separated words; if the
% user just pastes a text copied from somewhere that included punctuation,
% the punctuation signs are ignored, but are not taken off from the text.
%
@@ -138,7 +144,7 @@ charge for copying, etc.
% that code was created by Jonathan Kew; Victor Eijkout just added an empty
% |\discretionary{}{}{}|; the idea came to him from the code created by
% Oliver Schoett that is used for the hyphenation exception list of TUGboat.
-% Credit for the code goes completely to the persons mentioned above; I just
+% Credit for the code goes completely to the authors mentioned above; I just
% added some sugar to use that code in \LaTeX\ documents for the benefit of
% hyphenation pattern creators, and of regular users who want to know how a
% certain word or the words of a certain sentence would be hyphenated by
@@ -157,20 +163,53 @@ charge for copying, etc.
% fundamental before complaining about \TeX\ not working properly with
% hyphenations and possibly before raising a bug notice.
%
+% \section{Incompatibility with the previous version 0.5a}
+% I had to change some definitions within the body of this package in order
+% to avoid clashes mainly with the |french| language option of babel;
+% in facts that option declares most punctuation marls as active characters.
+% Unfortunately those characters receive global definitions, therefore they
+% remain active even when they should not perform any action.
+%
+% It is necessary to emphasize that the previous version used the colon as
+% a parameter separator; while, in order to avoid conflicts with |french|,
+% the parameter separator is a simple hyphen.
+%
+% Defining active characters when using |polyglossia| may produce other
+% incompatibilities that are easily circumvented by specifying languages
+% in a different order. In facts, if you specify languages as such
+%\begin{verbatim}
+%\setmainlanguage[babelshorthands]{italian}
+%\setotherlanguages{english,french}
+%\end{verbatim}
+% produces an error when |french| sets up its parameters for the UNICODE
+% apostrophe: the cause of this error derives from the use of the |italian| option
+% |babelshorthands|; of course if this option is not specified, no problems
+% arise. But if you interchange the declarations as in
+%\begin{verbatim}
+%\setotherlanguages{english,french}
+%\setmainlanguage[babelshorthands]{italian}
+%\end{verbatim}
+% no problems arise.
+%
% \section{Usage}
-% This package has been tested with |pdflatex| and |xelatex|; it should
-% work also with |lualatex| but it was not tested with this engine.
+% This package has been tested with |pdflatex|, |xelatex|, and |lualatex|;
+% for |lualatex| a package |showhyphens| exists that marks the hyphen
+% points of an entire document with thin red vertical strokes at the
+% possible break points. The user may use the package s/he prefers by
+% taking into consideration Her/his needs with respect with the features
+% and the functionalities of package |testhyphens| compared to those
+% of |showhyphens|.
%
-% Remember that Normal Plain \TeX\ and \LaTeX\ have available the command
-% |\showhyphens| but, differently from this package, that command works
-% only when the typesetting engine is |tex| or |pdftex| and the result
-% appears on the console window and in the \texttt{.log} file -- no written
+% Remember that normal Plain \TeX\ and \LaTeX\ have available the command
+% |\showhyphens| but, differently from this package, such command works
+% only when the typesetting engine is |tex| or |pdftex|; moreover the result
+% appears on the console window and in the \texttt{.log} file and no written
% record remains available to the user; for |xelatex| there was a workaround
% provided by another package, but for some reasons it did not work in every
-% circumstance. This package prints the result in the output document and
-% works also with |xelatex|.
+% circumstance. This package |testhyphens|, on the opposite, prints the result
+% in the output document and works also with |xetex| as the typesetting engine.
%
-% This simple package is loaded simply with the usual statement
+% This simple package is loaded just with the usual statement
% \begin{flushleft}
%|\usepackage{testhyphens}|
% \end{flushleft}
@@ -182,9 +221,9 @@ charge for copying, etc.
% \marg{word list}
% |\end{checklist}|
%\end{sintassi}
-% where \meta{hyphenation parameters} is a \emph{colon separated list} of two decimal
+% where \meta{hyphenation parameters} is a \emph{hyphen separated list} of two
% digits that in order will be assigned by the environment respectively to
-% |\lefthyphenmin| and |\righthyphenmin|, and \meta{word list} is self
+% |\lefthyphenmin| and |\righthyphenmin|; \meta{word list} is self
% explanatory. Nevertheless it good to remember that the environment isolates
% single words by using a space as a word separator; this requires that the
% list is preceded and followed by spaces; setting the environment with the
@@ -193,36 +232,36 @@ charge for copying, etc.
% |\begin{checkhyphens}|\oarg{hyphenation parameters}\marg{word list}|\end{checklist}|
% might not produce the desired result.
%
-% \section{Using hyphenation parameters}
+% \section[Hyphenation parameters]{Using hyphenation parameters}
% The hyphenation parameters are just |\lefthyphenmin| and |\righthyphenmin|;
% they represent the minimum number of characters that the first and, respectively,
-% the last word fragment must have before or until hyphenation takes place; in English
-% the default values are 2 and~3; in Italian the default values are 2 and~2; in
-% Greek the default values are 1 and~1.
+% the last word fragment must have before or until hyphenation takes place;
+% for example in English the default values are 2 and~3; in Italian the default
+% values are 2 and~2; in Greek the default values are 1 and~1.
%
% Let us make an example: the word \emph{idea} is spelt the same in English and
% Italian, although it is pronounced differently; but in both cases the word is
% not hyphenated at all in both languages. According to the Italian hyphenation
-% rules its grammatical hyphenation is \emph{i-de-a}; in English possibly the
+% rules its grammatical hyphenation is \emph{i-de-a}; possibly in English the
% grammatical hyphenation is the same; in any case the initial and the terminal
% syllables are too short to comply with the above mentioned \TeX\ hyphenation
% parameters, and \TeX\ refrains from hyphenating this word. In Greek, on the
-% opposite, \foreignlanguage{greek}{ιδέα} it is divided into
+% opposite, \foreignlanguage{greek}{ιδέα} is divided into
% \foreignlanguage{greek}{ι-δέ-α}.
%
% If you use |checkhyphens| with the optional hyphenation parameters specified to
% 1 and~1 in Italian or in English, as in
%\begin{verbatim}
-%checkhyphens[1:1]{idea}
+%checkhyphens[1:1] idea
%\end{verbatim}
% you don't get any useful result in English, and the word remains un-hyphenated;
% but in Italian is turns out to be \emph{i-de-a} as in Greek.
%
-% This happens ecause the Italian patterns were created by hand and tested with
+% This happens because the Italian patterns were created by hand and tested with
% parameters 1 and~1, even if for typesetting purposes the parameters are set
% to 2 and~2. In English the patterns were created by means of the program
% \prog{patgen} where parameters 2 and~3 were set. Typographically speaking
-% the values 1 and~1 for italian are almost useless, but in certain difficult
+% the values 1 and~1 for Italian are almost useless, but in certain difficult
% narrow-measure texts the user has the possibility to locally set the first and/or the
% second parameter to 1, and solve that particular instance of
% problematic narrow-measure typesetting.
@@ -251,7 +290,7 @@ charge for copying, etc.
% on the `y', while the noun ``analyses'' is stressed on the second `a';
% the standard phonetic hyphenation rules for English probably should hyphenate
% the verb as ``an-a-lyses'', but \TeX\ works only on the spelling and not on
-% the sound and does not make any logical analysis of the test to find out
+% the sound and does not make any logical analysis of the text to find out
% if a word plays the rôle of a noun or of a verb. In this and similar
% situations (for example: ``the record'' and ``to record'') the user should
% check a good reliable dictionary and possibly use an explicit discretionary
@@ -272,11 +311,10 @@ charge for copying, etc.
%\end{otherlanguage*}
%Notice that ``idea'' cannot be hyphenated by \TeX\ when it is an isolated
% word; but in Italian the apostrophe is used (also) to mark a vocalic elision,
-% therefore for hyphenation purposes, event it it not a letter, it is assigned
+% therefore for hyphenation purposes, even if it is not a letter, it is assigned
% a lowercase code, and it legally becomes part of a word, in our case the word
% ``bell'idea''. Therefore the patterns that involve the apostrophe produce
% the result shown above, where the first grammatical hyphen shows up again.
-% \StopEventually{}
%
% While typesetting in Greek we might insert in the source file the following code:
%\begin{flushleft}\ttfamily\obeylines
@@ -297,7 +335,7 @@ charge for copying, etc.
%while, had we set the hyphenation parameters different from the default
% values 1 and~1, as in:
%\begin{flushleft}\ttfamily\obeylines
-%|\begin{checkhyphens}[2:2]|
+%|\begin{checkhyphens}[2-2]|
%\begin{otherlanguage*}{greek}
%επεξεργάζεται αρχεία τα οποἰα περιἐχουν τουσ χαρακτήρες που
%υπάρχουν στο πληκτρολὀγιο του υπολογιστἠ σας
@@ -306,22 +344,29 @@ charge for copying, etc.
%\end{flushleft}
%the result would be
%\begin{otherlanguage*}{greek}
-%\begin{checkhyphens}[2:2]
+%\begin{checkhyphens}[2-2]
%επεξεργάζεται αρχεία τα οποἰα περιἐχουν τουσ χαρακτήρες που υπάρχουν
%στο πληκτρολὀγιο του υπολογιστἠ σας
%\end{checkhyphens}
%\end{otherlanguage*}
%
% Notice that as things are at the moment of writing this documentations,
-% the monotonic Greek hyphenation Patterns fail to hyphenate after an
+% the monotonic Greek hyphenation patterns fail to hyphenate after an
% accented vowel followed by a consonant; the grammar allows to hyphenate
% in that position; but it correctly recognises the hiathus between an
% unaccented vowel and an accented one; at the same time the first Greek
% example shows very clearly the effect of |\lefthyphenmin=1| compared
-% to the second example where |\lafthyphenmin=2|. On the other hand, missing
+% to the second example where |\lefthyphenmin=2|. On the other hand, missing
% some hyphen points is certainly a feature that precludes full hyphenation,
% but it does not produce hyphenation errors.
%
+% For the user information it was the very use of this package that highlighted
+% the features/bugs in the Greek hyphenation patterns; at the moment of writing
+% this documentation, work is in progress for solving this behaviour. Notice
+% that this behaviour is present when typesetting with |babel|,
+% while these features are absent when |polyglossia| is used.
+% \StopEventually{}
+%
% \section{The code}
%\iffalse
%<*package>
@@ -333,24 +378,24 @@ charge for copying, etc.
% the commend |\offinterlineskip| from its penultimate position in the original
% code to the first command to be executed within the |\vbox|; in this way
% I avoided certain cases in which the lack of interline skip would remain
-% active after the environment closure.
+% active after closing the environment.
%
% The code is based on treating the interword space as an active character
% that plays different rôles according to its position; it lets the
-% declaration isolate the words to ne hyphenated and open suitable boxes,
+% declaration isolate the words to be hyphenated and open suitable boxes,
% that are closed at the moment of processing the following word; the
-% |\everypar| token list distinguishes the various actions to be performed
+% |\everypar| token-list distinguishes the various actions to be performed
% at each step.
%
-% But the trick is to set each word within a vertical box where the measure
-% (the text width |\hsize| is zero; in this way each word is hyphenated at
-% the first hyphen point, but the word fragment that remains ins the following
+% But the trick is to set each word within a vertical box where the measure
+% (the text width |\hsize|) is zero; in this way each word is hyphenated at
+% the first hyphen point, but the word fragment that remains in the following
% line is still too long and gets hyphenated again; the process is repeated
% again and again until the initial string is exhausted. The contents of the
% |\vbox|, that now contains the syllables one per line, is reassembled to
-% form une line, and this line is output within an |\hbox| and is therefore
+% form one line, and this line is output within an |\hbox| and is therefore
% the box typeset in vertical mode; this is why the declaration must be issued
-% in vertical mode, so as to strat processing the word list with the right
+% in vertical mode, so as to start processing the word list with the right
% foot; this is also why the word list must start and end with spaces; the
% first one before the first word opens the first box, and the last space after
% the last word closes and outputs the last box.
@@ -371,18 +416,18 @@ charge for copying, etc.
\def\nomorelines{\unhbox1}
% \end{macrocode}
-% The above code is substancially the original one; now we define the user
+% The above code is substantially the original one; now we define the user
% declaration control sequence |\testhyphens| by letting it to assume the
-% meaning of the internal control sequence. The we define the |checkhyphens|
+% meaning of the internal control sequence. Then we define the |checkhyphens|
% environment where we make sure that the whole process of the word list
% contained in its body takes place in vertical mode. In oder to process
% the optional argument for setting the hyphenation parameters, we define
-% a delimited argument macro |\s@thyphenpars| that uses the \emph{colon} as
+% a delimited argument macro |\s@thyphenpars| that uses the \emph{hyphen} as
% argument delimiter.
% \begin{macrocode}
\let\testhyphens\t@sthyphens
-\newenvironment{checkhyphens}[1][\lefthyphenmin:\righthyphenmin]{%
+\newenvironment{checkhyphens}[1][\lefthyphenmin-\righthyphenmin]{%
\@tempcnta=\lefthyphenmin
\@tempcntb=\righthyphenmin
\s@thyphenpars[#1]\par\bgroup\t@sthyphens
@@ -390,7 +435,7 @@ charge for copying, etc.
\egroup\par
}
-\def\s@thyphenpars[#1:#2]{%
+\def\s@thyphenpars[#1-#2]{%
\@tempcnta=#1\relax
\@tempcntb=#2\relax
\unless\ifnum\@tempcnta=\lefthyphenmin \lefthyphenmin=\@tempcnta\fi