summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel/babel.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/babel/babel.dtx')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx134
1 files changed, 83 insertions, 51 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index ab5d8146295..73602cb01aa 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -31,7 +31,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2018/10/16 v3.26 The Babel package]
+\ProvidesFile{babel.dtx}[2018/11/13 v3.27 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -2307,12 +2307,12 @@ bug described in the previous paragraph.
If non-ASCII encodings are not loaded (or no encoding at all), it is
no-op (also |\TeX| and |\LaTeX| are not redefined); otherwise,
|\ensureascii| switches to the encoding at the beginning of the
-document if ASCII-savvy, or else the last ASCII-savvy encoding loaded.
-For example, if you load |LY1,LGR|, then it is set to |LY1|, but if you
-load |LY1,T2A| it is set to |T2A|. The symbol encodings |TS1|, |T3|,
-and |TS3| are not used for ``ordinary'' text, so they should be
-selected with some other encoding, but they are taken into account,
-just in case.
+document if ASCII-savvy, or else the last ASCII-savvy encoding
+loaded. For example, if you load |LY1,LGR|, then it is set to |LY1|,
+but if you load |LY1,T2A| it is set to |T2A|. The symbol encodings
+|TS1|, |T3|, and |TS3| are not taken into account, since they are not
+used for ``ordinary'' text (they are stored in |\BabelNonText|, used
+in some special cases when no Latin encoding is explicitly set).
The foregoing rules (which are applied ``at begin document'') cover
most of cases. No asumption is made on characters above
@@ -2339,7 +2339,7 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic
elements, including the |picture| environment and PDF or PS based
graphics, are not yet correctly handled. Also, indexes and the like
are under study, as well as math.
-
+
An effort is being made to avoid incompatibilities in the future
(this one of the reason currently bidi must be explicitly requested
as a package option, with a certain bidi model, and also the |layout|
@@ -2910,12 +2910,42 @@ chapters), in Hungarian ``from (1)'' is ``(1)-b\H{o}l'', but ``from
\subsection{Tentative and experimental code}
+See the code section for |\foreignlanguage*| (a new starred
+version of |\foreignlanguage|).
+
+\medskip
\textbf{Southeast Asian interword spacing}
-There is some preliminary interword spacing for Thai, Lao and Khemer
-in \luatex{} (provided there are hyphenation patters). It is activated
-automatically if a language with of one of these scripts are loaded
-with |\babelprovide|. See the sample on the \babel{} repository.
+There is some preliminary interword spacing for Thai, Lao and Khemer in
+\luatex{} (provided there are hyphenation patters) and \xetex. It is
+activated automatically if a language with one of those scripts are
+loaded with |\babelprovide|. See the sample on the \babel{} repository.
+With both engines, interword spacing is based on the ``current'' em
+unit (the size of the previous char in \luatex{} and the font size set
+by the last |\selectfont| in \xetex).
+
+\medskip
+\textbf{Bidi writing} in \luatex{} is still under development, but the
+basic implementation is finished. On the other hand, in \xetex{} it is
+taking its first steps. The latter engine poses quite different
+challenges. An option to manage document layout in \luatex{} (lists,
+footnotes, etc.) is almost finished, but \xetex{} required more work.
+
+Unfortunately, proper support for \xetex{} requires patching somehow
+lots of macros and packages (and some issues related to |\special|s
+remain, like color and hyperlinks).
+
+\medskip
+\textbf{bidi=bidi}
+
+\New{3.27} This package option is a new experimental support for bidi
+writing with \xetex{} and the \textsf{bidi} package (by Vafa Khalighi).
+Currently, it just provides the basic direction switches with
+|\selectlanguage| and |\foreignlanguage|. Any help in making \babel{}
+and \textsf{bidi} collaborate will be welcome (although the underlying
+concepts in both packages seem very different).
+
+See the babel repository for a small example (|xe-bidi|).
\medskip
\textbf{Old stuff}
@@ -2940,19 +2970,6 @@ So, for example:
\babelFSfeatures{turkish}{Language=Turkish}
\end{verbatim}
-\medskip
-\textbf{Bidi writing} in \luatex{} is under development, but a basic
-implementation is almost finished. On the other hand, in \xetex{} it is
-taking its first steps. The latter engine poses quite different
-challenges. An option to manage document layout in \luatex{} (lists,
-footnotes, etc.) is almost finished, but \xetex{} required more work.
-
-See the code section for |\foreignlanguage*| (a new starred version of
-|\foreignlanguage|).
-
-\xetex{} relies on the font to properly handle these unmarked changes,
-so it is not under the control of \TeX.
-
\section{Loading languages with \file{language.dat}}
\TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX,
@@ -3633,7 +3650,7 @@ set for Turkish:
\end{verbatim}
(Note the mapping for |OT1| is not complete.)
-\Describe\SetHyphenMap{\marg{to-lower-macros}}
+\Describe{\SetHyphenMap}{\marg{to-lower-macros}}
\New{3.9g} Case mapping serves in \TeX{} for two unrelated purposes: case
transforms (upper/lower) and hyphenation. |\SetCase| handles the
former, while hyphenation is handled by |\SetHyphenMap| and controlled
@@ -3776,7 +3793,7 @@ help from Bernd Raichle, for which I am grateful.
% \global\let\check@percent\saved@check@percent
%\endgroup
%
-% \part{The code}
+% \part{Source code}
%
% \babel{} is being developed incrementally, which means parts of the
% code are under development and therefore incomplete. Only documented
@@ -3857,8 +3874,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.26>>
-%<<date=2018/10/16>>
+%<<version=3.27>>
+%<<date=2018/11/13>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -8997,18 +9014,18 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\bbl@trace{Encoding and fonts}
-\newcommand\BabelNonASCII
- {LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,TS1,T3,TS3}
+\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
+\newcommand\BabelNonText{TS1,T3,TS3}
\let\org@TeX\TeX
\let\org@LaTeX\LaTeX
\let\ensureascii\@firstofone
\AtBeginDocument{%
\in@false
- \bbl@foreach\BabelNonASCII{% is there a non-ascii enc?
+ \bbl@foreach\BabelNonASCII{% is there a text non-ascii enc?
\ifin@\else
\lowercase{\bbl@xin@{,#1enc.def,}{,\@filelist,}}%
\fi}%
- \ifin@ % if a non-ascii has been loaded
+ \ifin@ % if a text non-ascii has been loaded
\def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}%
\DeclareTextCommandDefault{\TeX}{\org@TeX}%
\DeclareTextCommandDefault{\LaTeX}{\org@LaTeX}%
@@ -9017,7 +9034,7 @@ help from Bernd Raichle, for which I am grateful.
\ifx\@empty#2\else
\bbl@ifunset{T@#1}%
{}%
- {\bbl@xin@{,#1,}{,\BabelNonASCII,}%
+ {\bbl@xin@{,#1,}{,\BabelNonASCII,\BabelNonText,}%
\ifin@
\DeclareTextCommand{\TeX}{#1}{\ensureascii{\org@TeX}}%
\DeclareTextCommand{\LaTeX}{#1}{\ensureascii{\org@LaTeX}}%
@@ -9026,7 +9043,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\fi}%
\bbl@foreach\@filelist{\bbl@tempb#1\@@}% TODO - \@@ de mas??
- \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,}%
+ \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,\BabelNonText,}%
\ifin@\else
\edef\ensureascii#1{{%
\noexpand\fontencoding{\cf@encoding}\noexpand\selectfont#1}}%
@@ -9284,6 +9301,18 @@ help from Bernd Raichle, for which I am grateful.
\newtoks\everypar
\everypar=\bbl@severypar
\bbl@severypar{\bbl@xeeverypar\the\everypar}}
+ \@ifpackagewith{babel}{bidi=bidi}%
+ {\let\bbl@textdir@i\@gobbletwo
+ \let\bbl@xebidipar\@empty
+ \AddBabelHook{bidi}{foreign}{%
+ \def\bbl@tempa{\def\BabelText####1}%
+ \ifcase\bbl@thetextdir
+ \expandafter\bbl@tempa\expandafter{\BabelText{\LR{##1}}}%
+ \else
+ \expandafter\bbl@tempa\expandafter{\BabelText{\RL{##1}}}%
+ \fi}
+ \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}}
+ {}%
\fi
% \end{macrocode}
%
@@ -10214,7 +10243,7 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@tentative{\protect\bbl@tentative@i}
\def\bbl@tentative@i#1{%
\bbl@warning{%
- Some functions in '#1' are tentative.\\%
+ Some functions for '#1' are tentative.\\%
They might not work as expected and their behavior\\%
could change in the future.\\%
Reported}}
@@ -10687,6 +10716,16 @@ help from Bernd Raichle, for which I am grateful.
\AtEndOfPackage{%
\EnableBabelHook{babel-bidi}%
\bbl@xebidipar}}
+ \DeclareOption{bidi=bidi}%
+ {\bbl@tentative{bidi=bidi}%
+ \ifx\RTLfootnotetext\@undefined
+ \AtEndOfPackage{%
+ \EnableBabelHook{babel-bidi}%
+ \ifx\fontspec\@undefined
+ \usepackage{fontspec}% bidi needs fontspec
+ \fi
+ \usepackage{bidi}}%
+ \fi}
\fi
\DeclareOption{bidi=default}%
{\let\bbl@beforeforeign\leavevmode
@@ -11032,16 +11071,9 @@ help from Bernd Raichle, for which I am grateful.
%
% \textit{In progress.}
%
-% Unfortunately, proper support for \xetex{} requires patching somehow
-% lots of macros and packages (and some issues related to |\special|s
-% remain, like color and hyperlinks). At least at this stage, \babel{}
-% will not do it and therefore a package like \textsf{bidi} (by Vafa
-% Khalighi) would be necessary to overcome the limitations of
-% \xetex. Any help in making \babel{} and \textsf{bidi} collaborate
-% will be welcome, although the underlying concepts in both packages
-% seem very different. Note also elements like headlines and margins
-% can be modified easily with packages like \textsf{fancyhdr},
-% \textsf{typearea} or \textsf{titleps}, and \textsf{geometry}.
+% Note elements like headlines and margins can be modified easily with
+% packages like \textsf{fancyhdr}, \textsf{typearea} or
+% \textsf{titleps}, and \textsf{geometry}.
%
% |\bbl@startskip| and |\bbl@endskip| are available to package
% authors. Thanks to the \TeX{} expansion mechanism the following
@@ -11581,7 +11613,7 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
% \end{macro}
%
-% \section{Southeast Asian scripts}
+% \subsection{Southeast Asian scripts}
%
% \changes{babel~3.24}{2018/09/24}{Lua code for interword spacing
% in Southeast Asian scripts.}
@@ -11591,8 +11623,8 @@ help from Bernd Raichle, for which I am grateful.
% sense, because the hyphen and the previous char go always together).
% Other discretionaries are not touched.
%
-% For the moment, only 3 SA languages are
-% activated by default (see Unicode UAX 14).
+% For the moment, only 3 SA languages are activated by default (see
+% Unicode UAX 14).
%
% \begin{macrocode}
\def\bbl@intraspace#1 #2 #3\@@{%
@@ -11822,7 +11854,7 @@ help from Bernd Raichle, for which I am grateful.
%</luatex>
% \end{macrocode}
%
-% \subsection{Auto bidi with \texttt{basic-r}}
+% \subsection{Auto bidi with \texttt{basic} and \texttt{basic-r}}
%
% \changes{3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r}
%
@@ -18591,7 +18623,7 @@ function Babel.bidi(head, ispar, hdir)
end
end
-
+
return node.prev(head) or head
end
%</basic>