From c1b648ea672270d1244a279ead7604d9655d8ea8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 17 Feb 2012 23:54:07 +0000 Subject: fixltxhyph (17feb12) git-svn-id: svn://tug.org/texlive/trunk@25420 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/fixltxhyph/README | 16 ++--- .../texmf-dist/doc/latex/fixltxhyph/fixltxhyph.pdf | Bin 410840 -> 409928 bytes .../source/latex/fixltxhyph/fixltxhyph.dtx | 71 ++++++++++++--------- .../texmf-dist/tex/latex/fixltxhyph/fixltxhyph.sty | 13 ++-- 4 files changed, 57 insertions(+), 43 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/fixltxhyph/README b/Master/texmf-dist/doc/latex/fixltxhyph/README index 0f634dbfc41..2eed05d224c 100644 --- a/Master/texmf-dist/doc/latex/fixltxhyph/README +++ b/Master/texmf-dist/doc/latex/fixltxhyph/README @@ -1,18 +1,18 @@ -FixLtxHyph v.0.2a +FixLtxHyph v.0.3 FixLtxHyph.sty is a small extension that allows to "correct' a small glitch -in hyphenating "word" that are partially emphasized. -This happens very frequently in languages suc as Catalan, French, Italian, +in hyphenating "words" that are partially emphasized. +This happens very frequently in languages such as Catalan, French, Italian, Romansh, and other where articles and articulated preposition undergo vocalic elision before a word that starts wit a vowel: example "della eleganza" becomes "dell'eleganza" after vocalic elision. Now if "eleganza" is emphasized as in "dell'\emph{eleganza}" the literal -string that TeX sees as a word include the apostrophe, and this ins fine +string that TeX sees as a word includes the apostrophe, and this is fine in those languages where the apostrophe is set up for proper hyphenation, -but also a font change; therefore TeX does not hyphenate the whole string, -while it has no problems when hyphenating the same word without emphasis: -"del-l'e-le-gan-za". +but it also includes a font change; therefore TeX does not hyphenate the +whole string, while it has no problems when hyphenating the same word without +emphasis: "del-l'e-le-gan-za". This small package works fine with both pdfLaTeX and XeLaTeX; it has been tested with the four languages listed above; at the moment of writing @@ -23,7 +23,7 @@ The single FixLtxHyph.dtx file is auto extracting; if you process it with pdfLaTeX you get both the documentation file in PDF format and the sty file. After extraction move the files, as usual, in the three homonymous folders -latex/fixltXhtph/ rooted in source/, doc/ and tex/ respectively. +latex/fixltxhtph/ rooted in source/, doc/ and tex/ respectively. Claudio Beccari 2012 Author maintained diff --git a/Master/texmf-dist/doc/latex/fixltxhyph/fixltxhyph.pdf b/Master/texmf-dist/doc/latex/fixltxhyph/fixltxhyph.pdf index 3e39df244cf..75ee6c79b92 100644 Binary files a/Master/texmf-dist/doc/latex/fixltxhyph/fixltxhyph.pdf and b/Master/texmf-dist/doc/latex/fixltxhyph/fixltxhyph.pdf differ diff --git a/Master/texmf-dist/source/latex/fixltxhyph/fixltxhyph.dtx b/Master/texmf-dist/source/latex/fixltxhyph/fixltxhyph.dtx index 3f0416dd2b9..902826a9604 100644 --- a/Master/texmf-dist/source/latex/fixltxhyph/fixltxhyph.dtx +++ b/Master/texmf-dist/source/latex/fixltxhyph/fixltxhyph.dtx @@ -15,7 +15,7 @@ \endpreamble \postamble -Copyright 2011 Claudio Beccari +Copyright 20112012 Claudio Beccari Distributable under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of @@ -46,15 +46,15 @@ and the English documentation file in pdf format. % \iffalse %<*driver> \documentclass{ltxdoc} -\ProvidesFile{fixltxhyph.dtx}[2011/12/29 v.0.2a Documented TeX file for -the FixLtxHyph bundle] +\ProvidesFile{fixltxhyph.dtx}[2012/02/17 v.0.3 Documented TeX file for +the FixLtxHyph package] \GetFileInfo{fixltxhyph.dtx} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{color} \usepackage{multicol} -\title{\centering The FixLtxHyph bundle\protect\\ +\title{\centering The FixLtxHyph package\protect\\ A small fix in order to hyphenate emphasized words after a vocalic elision\protect\\ in Catalan, French, Italian and Romansh} \date{\fileversion\space\filedate} @@ -72,13 +72,13 @@ in Catalan, French, Italian and Romansh} \end{document} % % \fi -% \CheckSum{50} +% \CheckSum{48} % % \begin{abstract} % This file fixes a small feature of the hyphenation algorithm used by the \TeX\ system % typesetting engines that manifests itself only with those languages that use the -% apostrophe for marking a vocalic elision. This small package was set up to fix this -% little undesirable feature in Italian, but it was extended to Catalan, French and the +% apostrophe for marking a vocalic elision. This small package was set up to fix this +% little undesirable feature in Italian, but it was extended to Catalan, French and the % future implementation of the fourth official Swiss language Rumantsch Grischun (Romansh % in English). % \end{abstract} @@ -86,7 +86,7 @@ in Catalan, French, Italian and Romansh} % The four languages Catalan, French, Italian and Romansh use the apostrophe for marking % the vocalic elision of the ending vowel at the end of prepositions, articles, articulated % prepositions, definite adjectives, and other words playing similar rôles when they just -% precede a nouns, adjectives, verbs, numerals, that start with a vowel. +% precede nouns, adjectives, verbs, numerals, that start with a vowel. % % This feature is common to most Romance languages (from West to East) from Catalan and % Valencian, to French, Langue d'oc, Occitan, Provençal, Vivaroalpin, Italian, Piedmontese, @@ -115,7 +115,7 @@ in Catalan, French, Italian and Romansh} % or something equivalent. With this little trick, the typesetting engine considers the % apostrophe as a valid word character and treats the whole string as a single word; the % patterns of these languages, of course, take into consideration also the apostrophe so -% that the following correct line break points are easily found\footnote{For typesetting +% that the resulting correct line break points are easily found\footnote{For typesetting % Romansh and hyphenating it, initially I wrote myself a short language definition file, % where, among other things, Romansh was considered as a dialect of Italian. In this way I did % not need to build up the specific Romansh patterns; of course this was done only for thesting @@ -129,11 +129,14 @@ in Catalan, French, Italian and Romansh} % dal rumantsch grischun} published by the Department of romance languages and literature % of the Friburg University, Switzerland. The patterns I produced work pretty well, but they % are not built up for etimological hyphenation, therefore some prefixex or compound words -% might be divides without respecting the compound word barrier.}: +% might be divided without respecting the compound word barrier. At the date of writing these +% notes, the Romansh patterns and the language description file have been +% uploaded to the polyglossia and babel teams, but they are not yet available for the +% general user.}: %\begin{center} %\begin{tabular}{l>{\ttfamily}ll} %Catalan & d'aquesta & d'a-ques-ta \\ -%French & l'électricité & l'élec-tri-ci-té \\ +%French & l'électricité & l'élec-tri-ci-té \\ %Italian & dell'eleganza & del-l'e-le-gan-za \\ %Romansh & l'identitad & l'i-den-ti-tad %\end{tabular} @@ -171,7 +174,7 @@ in Catalan, French, Italian and Romansh} % his PhD student who developed the hyphenation algorithm implemented in the typesetting % engines of the \TeX\ system\footnote{I have been told that Lua\TeX\ is developing % a different algorithm that eliminates this feature.}. -% As all such decisions, it is a compromise between accuracy and speed. And remember the at +% As all such decisions, it is a compromise between accuracy and speed. And remember that at % the beginning \prog{tex} the program was used essentially with English, a language that % does not use accented letters and uses elision in a much different way as the one we are % speaking here. The problem did non exist and, I suppose, it will never exist in English. @@ -188,7 +191,7 @@ in Catalan, French, Italian and Romansh} % But manual or automatic, how should we proceed? Simply we must convince that the % starting letter must not be the start of the part preceding the apostrophe, but what % follows it. -% This is simple: it suffices to put after the apostrophe a unbreakable zero width glob of +% This is simple: it suffices to put after the apostrophe a unbreakable, zero width glob of % glue; \TeX\ starts looking for a potential starting letter after the glue. % Therefore the manual solution consists in defining a short macro such as the following % one: @@ -196,8 +199,8 @@ in Catalan, French, Italian and Romansh} %\newcommand\hz{\nobreak\hskip\z@skip} %\end{verbatim} % or, if you want to avoid setting this short command into a personal \texttt{.sty} file, -% simple change |\z@skip| with |0pt|. You will then have to change the font changing -% phrase in something such as: +% simple change |\z@skip| with |0pt|. You will then have to modify the font changing +% phrase into something such as: %\begin{verbatim} %... d'\hz\textbf{aquesta} ... %\end{verbatim} @@ -207,16 +210,19 @@ in Catalan, French, Italian and Romansh} % introduced in the horizontal list by the selected font identification. % % The automatic solution, on the opposite, implies a small but substantial modification of -% the |\emph| command. In facts the text command uses the text declaration |\em| and as -% such the latter is much simpler to modify by simply attaching the command |\hz| at the -% end % of its definition. +% the |\emph| command. In facts the text command uses the text declaration |\em|; on turn +% |\em| is a robusta commanda, that is it is defined as \verb*|\protext\em |: it would be +% very unwise to modify a protected command, so it is necessary to modifiy the ``protected'' +% one, and this operation is not trivial because of the space in the name of this macro. +% In any case if we find out how, we must add |\hz| to the definition of \verb*|\em | before +% its argument, the real text to emphasize, is processed. % -% This small packages does exactly this, only for the four named languages, and only if +% This small package does exactly this, only for the four named languages, and only if % they are used, and only with the |\emph| command. The |\hz| command is available to the % user in a global way, so that when this package is loaded, the manual solution remains % valid for every language, although in very unlikely situations. % -% It has been tested with the four languages (Romansh in a very embryonal state) and +% It has been tested with the four languages, and % apparently it works as expected; it has been throughly tested in all situations with % Italian; it should work properly also in French and in Romansh. The adopted solution % does not fiddle with active characters and therefore it does not interfere with the @@ -240,16 +246,17 @@ in Catalan, French, Italian and Romansh} %\item Move \texttt{fixltxhyph.sty} to \texttt{.../texmf/tex/latex/FixLtxHyph/}; %\item if your distribution requires it, refresh the file name database. %\end{itemize} -%You are now ready to use the package by simply invoking it in the preamble of your +% You are now ready to use the package by simply invoking it in the preamble of your % documents: %\begin{verbatim} %\usepackage{fixltxhyph} %\end{verbatim} % -%\section{Aknowledgements} +%\ section{Aknowledgements} %I wish to thank Lorenzo Pantieri who tested the preliminary and the actual versions of % this package and directly or indirectly helped debugging the code, especially in the -% preliminary version that used active characters and was particularly buggy. +% preliminary version that used active characters and was particularly buggy. Another +% big thank to Enrico Gregorio who spotted the protection problem of the |\em| command. % % \StopEventually{} % @@ -269,6 +276,11 @@ emphasized words preceded by vocalic elision] \endinput} % \end{macrocode} % +% We need the package |etoolbox| in order to perform any action on control sequences +% that contain spaces in their names. +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} % We define a very short command |\hz| in order to have available a handy command % for inserting an unbreakable zero width glob of glue in case we needed to do some % sort of patching by hand. @@ -287,20 +299,21 @@ emphasized words preceded by vocalic elision] % definitions only for the named four languages and to rest the original situation when a % change of language takes place. % \begin{macrocode} -\let\originalem\em -\let\newem\em -\addto\newem{\hz} +\letcs{\FLH@originalem}{em } +\let\FLH@newem\FLH@originalem +\preto\FLH@newem{\hz} % \end{macrocode} % % We then use a repetition cycle based on a list of language names; if the % language with one of the listed names has been invoked as an option to \texttt{babel}, -% then the patched |\em| definition is made the default, while when changing language the original definition is restored: +% then the patched \verb*|\em | definition is made the default, while when changing +% language the original definition is restored: % \begin{macrocode} \def\@tempB{catalan,french,italian,romansh} \@for\@tempA:=\@tempB\do{% \expandafter\ifx\csname captions\@tempA\endcsname\relax\else -\expandafter\addto\csname extras\@tempA\endcsname{\let\em\newem}% -\expandafter\addto\csname noextras\@tempA\endcsname{\let\em\originalem}\fi} +\expandafter\addto\csname extras\@tempA\endcsname{\cslet{em }{\FLH@newem}}% +\expandafter\addto\csname noextras\@tempA\endcsname{\cslet{em }{\FLH@originalem}}\fi} % \end{macrocode} % % Eventually the documented file is terminated and its final commands are issued. diff --git a/Master/texmf-dist/tex/latex/fixltxhyph/fixltxhyph.sty b/Master/texmf-dist/tex/latex/fixltxhyph/fixltxhyph.sty index a74cf987c48..2061d4af150 100644 --- a/Master/texmf-dist/tex/latex/fixltxhyph/fixltxhyph.sty +++ b/Master/texmf-dist/tex/latex/fixltxhyph/fixltxhyph.sty @@ -18,17 +18,18 @@ emphasized words preceded by vocalic elision] \@ifpackageloaded{babel}{}{% \PackageWarning{FixLtXHyph}{This package must be loaded after babel}% \endinput} +\RequirePackage{etoolbox} \newcommand\hz{\nobreak\hskip\z@skip} -\let\originalem\em -\let\newem\em -\addto\newem{\hz} +\letcs{\FLH@originalem}{em } +\let\FLH@newem\FLH@originalem +\preto\FLH@newem{\hz} \def\@tempB{catalan,french,italian,romansh} \@for\@tempA:=\@tempB\do{% \expandafter\ifx\csname captions\@tempA\endcsname\relax\else -\expandafter\addto\csname extras\@tempA\endcsname{\let\em\newem}% -\expandafter\addto\csname noextras\@tempA\endcsname{\let\em\originalem}\fi} +\expandafter\addto\csname extras\@tempA\endcsname{\cslet{em }{\FLH@newem}}% +\expandafter\addto\csname noextras\@tempA\endcsname{\cslet{em }{\FLH@originalem}}\fi} %% -%% Copyright 2011 Claudio Beccari +%% Copyright 20112012 Claudio Beccari %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of -- cgit v1.2.3