diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-03 23:23:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-03 23:23:04 +0000 |
commit | cf96ca13c66cc873f51f3f580dc438d013b31241 (patch) | |
tree | 5e10bdf65b841bbcf04fcc73bccf57fed8aa7fea /Master/texmf-dist/source/latex/babel | |
parent | 5bde818d4507934bd514e3a8a2cba02b718928c3 (diff) |
babel (2feb16)
git-svn-id: svn://tug.org/texlive/trunk@39571 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 46 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.ins | 24 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/bbunicode.dtx | 130 |
3 files changed, 141 insertions, 59 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 4d8444ab9fe..bc8980420e8 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -36,7 +36,7 @@ %\iffalse %% File 'babel.dtx' %\fi -%%\ProvidesFile{babel.dtx}[2016/01/08 v3.9n The Babel package] +%%\ProvidesFile{babel.dtx}[2016/02/01 v3.9o The Babel package] %\iffalse % % Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX; @@ -196,8 +196,8 @@ \vspace{2cm}\hspace{1.5cm} \begin{minipage}{5cm} \Large -Version 3.9n\newline -2016/01/08 +Version 3.9o\newline +2016/02/01 \vspace{1cm} \textit{Original author}\newline @@ -1313,6 +1313,7 @@ far from complete): some languages (kerning and spacing). Ligatures can be disabled. \item[substitutefont] Combines fonts in several encodings. \item[mkpattern] Generates hyphenation patterns. +\item[tracklang] Tracks which languages have been requested. \end{description} \subsection{Future work} @@ -1366,17 +1367,30 @@ Note you can set any feature required for the language -- not only |Language|, but also |Script| or a local |.fea|. This makes those macros a bit more verbose, but also more powerful. -\section{Preloading languages with \file{language.dat}} +\section{Loading languages with \file{language.dat}} \TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX, the main exception being \luatex) require hyphenation patterns to be -loaded when a format is created (eg, \LaTeX, Xe\LaTeX, +preloaded when a format is created (eg, \LaTeX, Xe\LaTeX, pdf\LaTeX). \babel{} provides a tool which has become standand in many distributions and based on a ``configuration file'' named \file{language.dat}. The exact way this file is used depends on the distribution, so please, read the documentation for the latter (note also some distributions generate the file with some tool). +\New{3.9o} With \luatex, however, patterns are loaded on the fly when +requested by the language (except the ``0th'' language, +\textsf{english}, which is preloaded always). Until 3.9n, this task +was delegated to the package \textsf{luatex-hyphen}, by Khaled Hosny, +\'Elie Roux, and Manuel P\'egouri\'e-Gonnard, and required an extra +file named |language.dat.lua|, but now a new mechanism has been +devised based solely on |language.dat|. \textbf{You must rebuild the +formats} if upgrading from a previous version. You may want to have a +local |language.dat| for a particular project (for example, a book on +Chemistry). + +\subsection{Format} + In that file the person who maintains a \TeX\ environment has to record for which languages he has hyphenation patterns \emph{and} in which files these are stored\footnote{This is because different operating @@ -1622,7 +1636,7 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later). \begin{verbatim} \ProvidesLanguage{<language>} - [2016/01/08 v0.0 <Language> support from the babel system] + [2016/02/01 v0.0 <Language> support from the babel system] \LdfInit{<language>}{captions<language>} \ifx\undefined\l@<language> @@ -2405,8 +2419,8 @@ help from Bernd Raichle, for which I am grateful. % little bit of literate programming. % % \begin{macrocode} -%<<version=3.9n>> -%<<date=2016/01/08>> +%<<version=3.9o>> +%<<date=2016/02/01>> % \end{macrocode} % % We define some basic macros which just make the code cleaner. @@ -6625,11 +6639,17 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.6u}{1999/04/20}{Moved this code to % \file{babel.def}} % \changes{babel~3.9l}{2014/08/02}{fontspec used to set -% \cs{latinencoding} to EUx, but now it doesn't. So, it's done here.} +% \cs{latinencoding} to EUx, but now it doesn't. So, it's done +% here.} +% \changes{babel~3.9o}{2016/01/27}{With fontspec, first check if +% \cs{UTFencname} exists.} % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{fontspec}% - {\xdef\latinencoding{EU\ifcase\bbl@engine\or2\or1\fi}}% + {\xdef\latinencoding{% + \@ifundefined{UTFencname}% + {EU\ifcase\bbl@engine\or2\or1\fi}% + {\UTFencname}}}% {\gdef\latinencoding{OT1}% \ifx\cf@encoding\bbl@t@one \xdef\latinencoding{\bbl@t@one}% @@ -8270,11 +8290,14 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9g}{2013/07/28}{In non-LaTeX formats the number of % languages were not printed. Moved from \cs{dump} and cleaned up: % now \cs{toks}8 is expanded here.} +% \changes{babel~3.9o}{2016/01/25}{The number of languages loaded was +% off by 1.} % \begin{macrocode} \if/\the\toks@/\else \errhelp{language.dat loads no language, only synonyms} \errmessage{Orphan language synonym} \fi +\advance\last@language\@ne \edef\bbl@tempa{% \everyjob{% \the\everyjob @@ -8283,7 +8306,8 @@ help from Bernd Raichle, for which I am grateful. \else \noexpand\typeout \fi - {\the\toks8 \the\last@language\space languages loaded.}}} + {\the\toks8 \the\last@language\space language(s) loaded.}}} +\advance\last@language\m@ne \bbl@tempa % \end{macrocode} % Also remove some macros from memory and raise an error diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index ad476a6fa26..bcf3855f0d4 100644 --- a/Master/texmf-dist/source/latex/babel/babel.ins +++ b/Master/texmf-dist/source/latex/babel/babel.ins @@ -42,7 +42,7 @@ %% %% You are not allowed to modify its contents. %% -\def\filedate{2014/03/24} +\def\filedate{2016/02/01} \def\batchfile{babel.ins} \input docstrip.tex @@ -62,16 +62,15 @@ \fi} % Modify docstrip. A pseudo-guard is defined to set variables: -% <<name=value>>. These variables are used with <@name@> -% Two further pseudo-guards define "block" variables: <<*name>> and -% <</name>> delimite the lines to be retrived with <@name@>. Note -% the verbatim guard is overriden, which it's not used here. -% It's done in two passes: 1) with saving true, blocks are always -% read and saved; 2) with saving false, blocks are always ignored, -% but replacing <@name@>. -% While <@name@> can be used freely outside <<>>, it is only -% allowed inside <<>> if previouly defined. Deeper nesting is -% not allowed. +% <<name=value>>. These variables are used with <@name@> Two further +% pseudo-guards define "block" variables: <<*name>> and <</name>> +% delimite the lines to be retrived with <@name@>. Note the verbatim +% guard is overriden, but it's not used here. This is done in two +% passes: 1) with saving true, there is a dummy pass, generating +% nothing, but blocks are read and saved; 2) with saving false, blocks +% are always ignored, but replacing <@name@>. While <@name@> can be +% used freely outside <<>>, it's only allowed inside <<>> if +% previouly defined. Deeper nesting is not allowed. \def\replaceVar#1<@#2{% #1% @@ -191,8 +190,6 @@ This file is a style file for the MakeIndex program \usedir{tex/generic/babel} -\askforoverwritefalse - \usepreamble\mainpreamble % Dummy, it just read "modules" to be used when generating @@ -228,7 +225,6 @@ This file is a style file for the MakeIndex program } % compatibility files - \def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{#1}}} \generate{% diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx index 02265c3108e..e4365b9c1e6 100644 --- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx +++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx @@ -31,12 +31,12 @@ % \iffalse %<*dtx> \ProvidesFile{bbunicode.dtx} - [2016/01/05 v1.0f Babel hooks for Unicode engines] + [2016/02/01 v1.1a Babel hooks for Unicode engines] %</dtx> % %% File `bbunicode.dtx' %% Babel package for LaTeX version 2e -%% Copyright (C) 2103-2014 +%% Copyright (C) 2103-2016 %% by Javier Bezos % %<*filedriver> @@ -179,9 +179,15 @@ % \end{macrocode} % \subsection{LuaTeX} % -% This part relies on the |lua| stripts in \pkg{luatex-hyphen} by Khaled -% Hosny, \'{E}lie Roux, and Manuel -% P\'{e}gouri\'{e}-Gonnard. \'{E}lie also improved the code below. +% The new loader for luatex is based solely on |language.dat|, which is +% read on the fly. The code shouldn't be executed when the format is +% build, so we check if |\bbl@get@enc| is defined. Then comes a +% simplified version of the loader in |hyphen.cfg| (without the +% hyphenmins stuff, which is under the direct control of \babel). A +% language has been loaded if |bbl@hyphendata@<num>| exists. The names +% |\l@<language>| are defined and take some value from the beginning +% because all ldf files assume this for the corresponding language to be +% considered valid. Of course, there is room for improvements. % \changes{bbunicode~1.0b}{2013/04/22}{luatex-hyphen is loaded % with require. Changes supplied by \'{E}lie Roux.} % \changes{bbunicode~1.0c}{2014/03/10}{Defined hook for @@ -193,16 +199,81 @@ % \cs{luaescapestring}} % \changes{bbunicode~1.0e}{2015/07/26}{Added function addpatterns and % modified the patterns hook.} +% \changes{bbunicode~1.1a}{2016/01/26}{New hyphenation loader for luatex.} % % \begin{macrocode} %<*luatex> +\ifx\bbl@get@enc\@undefined + \def\bbl@process@line#1#2 #3 #4 {% + \ifx=#1% + \bbl@process@synonym{#2}% + \else + \bbl@process@language{#1#2}{#3}{#4}% + \fi + \ignorespaces} + \def\bbl@process@language#1#2#3{% + \@ifundefined{l@#1}% + {\expandafter\addlanguage\csname l@#1\endcsname + \expandafter\language\csname l@#1\endcsname + \let\bbl@elt\relax + \edef\bbl@languages{% + \bbl@languages\bbl@elt{#1}{\the\language}{#2}{#3}}}% + {}} + \def\bbl@process@synonym#1{% + \@ifundefined{l@#1}% + {\expandafter\chardef\csname l@#1\endcsname\last@language + \let\bbl@elt\relax + \edef\bbl@languages{% + \bbl@languages\bbl@elt{#1}{\the\last@language}{}{}}}% + {}} + \ifnum\last@language>\z@ + \bbl@warning{Wrong or old hyphenation setup. Please, rebuild\\% + the format. I'll try to fix it for this run.\\% + Reported}% + \def\bbl@elt#1#2#3#4{% + \ifnum#2>\z@\else + \noexpand\bbl@elt{#1}{#2}{#3}{#4}% + \fi}% + \edef\bbl@languages{\bbl@languages}% + \fi + \ifnum\l@english=\z@\else + \bbl@warning{Wrong hyphenation setup. The 0th language must\\% + be `english'. Reported}% + \fi + \@namedef{bbl@hyphendata@0}{{hyphen.tex}{}}% + \openin1=language.dat + \ifeof1 + \bbl@warning{I couldn't find language.dat. No additional\\% + patterns loaded. Reported}% + \else + \loop + \endlinechar\m@ne + \read1 to \bbl@line + \endlinechar`\^^M + \if T\ifeof1F\fi T\relax + \ifx\bbl@line\@empty\else + \edef\bbl@line{\bbl@line\space\space\space}% + \expandafter\bbl@process@line\bbl@line\relax + \fi + \repeat + \fi + \def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}} + \def\bbl@luapatterns#1#2{% + \bbl@get@enc#1::\@@@ + \begingroup + \input #1\relax + \endgroup + \def\bbl@tempa{#2}% + \ifx\bbl@tempa\@empty\else + \input #2\relax + \fi}% +\fi \begingroup \catcode`\%=12 \catcode`\'=12 \catcode`\"=12 \catcode`\:=12 \directlua{ - require("luatex-hyphen") Babel = {} function Babel.bytes(line) return line:gsub("(.)", @@ -264,12 +335,23 @@ \luabbl@stop \let\luabbl@stop\relax} \AddBabelHook{luatex}{patterns}{% - \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \directlua{ - luatexhyphen.loadlanguage([[\string#1]], - '\the\language')}% - \fi + \@ifundefined{bbl@hyphendata@\the\language}% + {\def\bbl@elt##1##2##3##4{% + \def\bbl@tempa{##1}% + \def\bbl@tempb{##3}% + \ifx\bbl@tempb\@empty\else % if not synonymous + \def\bbl@tempc{{##3}{##4}}% + \fi + \def\bbl@tempb{#2}% eg, spanish, dutch:OT1, etc. + \ifx\bbl@tempa\bbl@tempb + \bbl@csarg\edef{hyphendata@##2}{\bbl@tempc}% + \fi}% + \bbl@languages + \@ifundefined{bbl@hyphendata@\the\language}% + {\bbl@info{No hyphenation patterns were set for\\% + language ‘#2’. Reported}}% + {\expandafter\expandafter\expandafter\bbl@luapatterns + \csname bbl@hyphendata@\the\language\endcsname}}{}% \@ifundefined{bbl@patterns@}{}{% \begingroup \@expandtwoargs\in@{,\number\language,}{,\bbl@pttnlist}% @@ -286,29 +368,9 @@ \xdef\bbl@pttnlist{\bbl@pttnlist\number\language,}% \fi \endgroup}} -\AddBabelHook{luatex}{adddialect}{% - \ifx\directlua\relax\else - \directlua{ - luatexhyphen.adddialect([[\string#1]], - [[\string#2]]) - }% - \fi} \AddBabelHook{luatex}{everylanguage}{% - \directlua{ - processnow = (tex.language == 0) or - (luatexhyphen.lookupname([[\string#1]]) == nil)}% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \global\@namedef{lu@texhyphen@loaded@\the\language}{}% - \fi} -\AddBabelHook{luatex}{loadpatterns}{% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \input #1\relax - \fi} -\AddBabelHook{luatex}{loadexceptions}{% - \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax - \input #1\relax - \fi - \directlua{processnow = nil}} + \def\process@language##1##2##3{% + \def\process@line####1####2 ####3 ####4 {}}} % \end{macrocode} % % \begin{macro}{\babelpatterns} |