summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-19 22:08:09 +0000
committerKarl Berry <karl@freefriends.org>2017-09-19 22:08:09 +0000
commite0dfc03c2a2eabcb087ac68cf8127dbe38008976 (patch)
treeec706b859d6d38177107ad52884db72b2c64a26f /Master/texmf-dist/source/latex/babel
parentbfd07842d2d959cfcf25115db678791bc9f929ba (diff)
babel (19sep17)
git-svn-id: svn://tug.org/texlive/trunk@45345 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx629
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx2
-rw-r--r--Master/texmf-dist/source/latex/babel/locale.zipbin682747 -> 682708 bytes
3 files changed, 445 insertions, 186 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 10f0d5fa509..fe92b27336b 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}[2017/06/29 v3.12 The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/09/18 v3.13 The Babel package]
%\iffalse
%
% Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX;
@@ -52,9 +52,10 @@
%
%<*filedriver>
\documentclass{ltxdoc}
-\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
-\usepackage{bera}
+\usepackage{fontspec}
+\setmainfont[Scale=.89]{DejaVu Serif}
+\setsansfont[Scale=.87]{DejaVu Sans}
+\setmonofont[Scale=.87]{DejaVu Sans Mono}
\raggedright
\addtolength{\textwidth}{25pt}
\addtolength{\textheight}{3.5cm}
@@ -80,6 +81,7 @@
\newcommand*\cls[1]{\texttt{#1}}
\newcommand*\pkg[1]{\texttt{#1}}
\addtolength{\oddsidemargin}{1em}
+\setlength{\leftmargini}{1.5em}
% Stolen and adapted from microtype:
\usepackage{color,colortbl}
\newcommand\New[1]{%
@@ -95,7 +97,8 @@
\def\@begintheorem#1#2{%
\list{}{}%
\global\advance\@listdepth\m@ne
- \item[{\sffamily\bfseries\color{messages}\MakeUppercase{#1}}]}%
+ \item[{\sffamily\bfseries\color{messages}\hspace*{1.3em}%
+ \MakeUppercase{#1}}]}%
\makeatother
\newtheorem{warning}{Warning}
\newtheorem{note}{Note}
@@ -127,7 +130,6 @@
backgroundcolor=\color{theshade},
rulecolor=\color{theframe},
framerule=\fboxrule,
- inputencoding=utf8
}
\let\verbatim\relax
\lstnewenvironment{verbatim}[1][]{\lstset{style=verbatim,##1}}{}
@@ -177,6 +179,7 @@
\renewcommand*\l@subsubsection{\@dottedtocline{3}{5em}{4em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{9em}{4.5em}}
\renewcommand\partname{Part}
+\def\@pnumwidth{3em}
\makeatother
\begin{document}
\title{Babel, a multilingual package for use with \LaTeX's standard
@@ -208,8 +211,8 @@
\vspace{2cm}\hspace{1.5cm}
\begin{minipage}{5cm}
\Large
-Version 3.12\newline
-2017/06/29
+Version 3.13\newline
+2017/09/18
\vspace{1cm}
\textit{Original author}\newline
@@ -240,7 +243,14 @@ Javier Bezos
Current development is focused on Unicode engines (Xe\TeX{} and
Lua\TeX). New features related to font selection, bidi writing and
- the like will be added incrementally. \vspace{20cm}
+ the like will be added incrementally, but you may use \babel{} for
+ many languages.
+
+ Currently \babel{} provides support (total or partial) for about 200
+ languages, either as a package option or as an |ini|
+ file. Furthermore, new languages can be created from scratch easily.
+
+ \vspace{20cm}
\end{minipage}
\end{tabular}
\end{minipage}
@@ -251,6 +261,9 @@ Javier Bezos
\part{User guide}
+This user guide focuses on \LaTeX. There are also some notes on its
+use with Plain \TeX.
+
\section{The user interface}\label{U-I}
\subsection{Monolingual documents}
@@ -264,7 +277,7 @@ addition, you may want to set the font and input encodings.
Here is a simple full example. The packages |fontenc| and |inputenc|
do not belong to \babel, but they are included in the example
because typically you will need them:
-\begin{verbatim}[escapechar=\&]
+\begin{verbatim}
\documentclass{article}
\usepackage[T1]{fontenc}
@@ -274,7 +287,7 @@ addition, you may want to set the font and input encodings.
\begin{document}
-Plus &\c c&a change, plus c'est la m&\^e&me chose!
+Plus ça change, plus c'est la même chose!
\end{document}
\end{verbatim}
@@ -284,8 +297,8 @@ A common source of trouble is a wrong setting of the input
encoding. Make sure you set the encoding actually used by your editor.
\end{warning}
-Another approach is making \Lopt{french} a global
-option in order to let other packages detect and use it:
+Another approach is making the language (\Lopt{french} in the example)
+a global option in order to let other packages detect and use it:
\begin{verbatim}
\documentclass[french]{article}
@@ -312,7 +325,7 @@ the option and will be able to use it.
In multilingual documents, just use several options. The last one is
considered the main language, activated by default. Sometimes, the
-main language changes the document layout (eg., |spanish| and |french|).
+main language changes the document layout (eg, |spanish| and |french|).
\begin{example}
In \LaTeX, the preamble of the document:
@@ -349,6 +362,34 @@ You can also set the main language explicitly:
want to use some of the language selectors described below.
\end{warning}
+To switch the language there are two basic macros, decribed below in
+detail: |\selectlanguage| is used for blocks of text, while
+|\foreignlanguage| is for chunks of text inside paragraphs.
+
+\begin{example}
+A full bilingual document follows. The main language is |french|,
+which is activated when the document begins.
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+
+\usepackage[english,french]{babel}
+
+\begin{document}
+
+Plus ça change, plus c'est la même chose!
+
+\selectlanguage{english}
+
+And an English paragraph, with a short text in
+\foreignlanguage{french}{français}.
+
+\end{document}
+\end{verbatim}
+\end{example}
+
\subsection{Modifiers}
\New{3.9c} The basic behaviour of some languages can be modified when
@@ -367,33 +408,108 @@ Attributes (described below) are considered modifiers, ie, you can
set an attribute by including it in the list of modifiers. However,
modifiers is a more general mechanism.
-\subsection{Notes}
+\subsection{\textsf{xelatex} and \textsf{lualatex}}
+
+Many languages are compatible with \textsf{xetex} and \textsf{luatex}.
+With them you can use \babel{} to localize the documents, but an
+advanced interface to handle fonts is still under development (among
+other things, language and script will be set by \babel).
-Loading directly |sty| files in \LaTeX{} (ie,
-|\usepackage|\marg{language}) is deprecated and you will get the
-error:\footnote{In old versions the error read ``You have used an
-old interface to call babel'', not very helpful.}
+The Latin script is covered by default in current \LaTeX{} (provided
+the document encoding is UTF-8), because the font loader is preloaded
+and the font is switched to |lmroman|. Other scripts require loading
+\textsf{fontspec}.
+
+\begin{example}
+ The following bilingual, single script document in UTF-8 encoding
+ just prints a couple of ‘captions’ and |\today| in Danish and
+ Vietnamese. No additional packages are required.
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[vietnamese,danish]{babel}
+
+\begin{document}
+
+\prefacename{} -- \alsoname{} -- \today
+
+\selectlanguage{vietnamese}
+
+\prefacename{} -- \alsoname{} -- \today
+
+\end{document}
+\end{verbatim}
+\end{example}
+
+\begin{example}
+Here is a simple monolingual document in Russian (text from the
+Wikipedia). Note neither \textsf{fontenc} nor \textsf{inputenc} are
+necessary, but the document should be encoded in UTF-8 and a
+so-called Unicode font must be loaded with \textsf{fontspec}.
+\begin{verbatim}[escapechar=\&]
+\documentclass{article}
+
+\usepackage[russian]{babel}
+
+\usepackage{fontspec}
+\setmainfont[Language=Russian,Script=Cyrillic]{DejaVu Serif}
+
+\begin{document}
+
+&Россия, находящаяся на пересечении множества культур, а также&
+&с учётом многонационального характера её населения, — отличается&
+&высокой степенью этнокультурного многообразия и способностью к&
+&межкультурному диалогу.&
+
+\end{document}
+\end{verbatim}
+
+\end{example}
+
+\subsection{Troubleshooting}
+
+\begin{itemize}
+\item Loading directly |sty| files in \LaTeX{} (ie,
+ |\usepackage|\marg{language}) is deprecated and you will get the
+ error:\footnote{In old versions the error read ``You have used an
+ old interface to call babel'', not very helpful.}
\begin{verbatim}
! Package babel Error: You are loading directly a language style.
(babel) This syntax is deprecated and you must use
(babel) \usepackage[language]{babel}.
\end{verbatim}
-Another typical error when using \babel{} is the
-following:\footnote{In old versions the error read ``You haven't
-loaded the language LANG yet''.}
+\item Another typical error when using \babel{} is the
+ following:\footnote{In old versions the error read ``You haven't
+ loaded the language LANG yet''.}
\begin{verbatim}
! Package babel Error: Unknown language `LANG'. Either you have misspelled
(babel) its name, it has not been installed, or you requested
(babel) it in a previous run. Fix its name, install it or just
(babel) rerun the file, respectively
\end{verbatim}
-The most frequent reason is, by far, the latest (for example, you
-included |spanish|, but you realized this language is not used after
-all, and therefore you removed it from the option list). In most cases,
-the error vanishes when the document is typeset again, but in more
-severe ones you will need to remove the |aux| file.
-
+ The most frequent reason is, by far, the latest (for example, you
+ included |spanish|, but you realized this language is not used after
+ all, and therefore you removed it from the option list). In most
+ cases, the error vanishes when the document is typeset again, but in
+ more severe ones you will need to remove the |aux| file.
+
+\item The following warning is about hyphenation patterns and it is not
+ under the direct control of \babel:
+\begin{verbatim}
+Package babel Warning: No hyphenation patterns were preloaded for
+(babel) the language `LANG' into the format.
+(babel) Please, configure your TeX system to add them and
+(babel) rebuild the format. Now I will use the patterns
+(babel) preloaded for \language=0 instead on input line 57.
+\end{verbatim}
+ The document will be typeset, but very likely the text will not be
+ correctly hyphenated. Some languages may be raising this warning
+ wrongly (because they are not hyphenated); it is a bug to be fixed
+ -- just ignore it. See the manual of your distribution (Mac\TeX,
+ Mik\TeX, \TeX Live, etc.) for further info about how to configure
+ it.
+\end{itemize}
\subsection{Plain}
In Plain, load languages styles with |\input| and then use
@@ -491,7 +607,7 @@ environment are \textit{not} ignored.
This environment was originally intended for intermixing left-to-right
typesetting with right-to-left typesetting in engines not supporting a
change in the writing direction inside a line. However, by default it never
-complied with the documented behaviour and it was just a version as
+complied with the documented behaviour and it is just a version as
environment of |\foreignlanguage|.
\Describe{\begin\menv{hyphenrules}}{\marg{language}\Eenv{hyphenrules}}
@@ -524,11 +640,13 @@ It defines |\text|\m{tag1}\marg{text} to be
|\foreignlanguage|\marg{language1}\marg{text}, and |\begin|\marg{tag1}
to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note
|\|\m{tag1} is also allowed, but remember to set it locally inside a
-group. So, with
+group.
+\begin{example}
+With
\begin{verbatim}
\babeltags{de = german}
\end{verbatim}
-yo can write
+you can write
\begin{verbatim}
text \textde{German text} text
\end{verbatim}
@@ -536,13 +654,18 @@ and
\begin{verbatim}
text
\begin{de}
-German text
+ German text
\end{de}
text
\end{verbatim}
+\end{example}
+
+\begin{note}
+ Something like \verb|\babeltags{finnish = finnish}| is legitimate --
+ it defines |\textfinnish| and |\finnish| (and, of course,
+ |\begin{finnish}|).
+\end{note}
-Something like \verb|\babeltag{finnish = finnish}| is legitimate -- it
-defines |\textfinnish| and |\finnish|.
\Describe\babelensure{|[include=|\m{commands}|,exclude=|\m{commands}%
|,fontenc=|\m{encoding}|]|\marg{language}}
@@ -556,12 +679,16 @@ you should set it explicitly if you want to use them, or hyphenation
Of course, \TeX{} can do it for you. To avoid switching the language
all the while, |\babelensure| redefines the captions for a given
-language to wrap them with a selector. By default only the basic
-captions and |\today| are redefined, but you can add further macros
-with the key |include| in the optional argument (without
-commas). Macros not to be modified are listed in |exclude|. You can
-also enforce a font encoding with |fontenc|.\footnote{With it encoded
-string may not work as expected.} A couple of examples:
+language to wrap them with a selector:
+\begin{verbatim}
+\babelensure{polish}
+\end{verbatim}
+By default only the basic captions and |\today| are redefined, but you
+can add further macros with the key |include| in the optional argument
+(without commas). Macros not to be modified are listed in
+|exclude|. You can also enforce a font encoding with
+|fontenc|.\footnote{With it encoded string may not work as expected.}
+A couple of examples:
\begin{verbatim}
\babelensure[include=\Today]{spanish}
\babelensure[fontenc=T5]{vietnamese}
@@ -615,9 +742,6 @@ contains glyphs for Modern Greek does not mean it includes them for
Classic Greek. As to directionality, it poses special challenges
because it also affects individual characters and layout elements.}
-The same applies for bidi texts -- writing direction is intrinsic to
-each writing system and therefore it is best set by the language
-(which could be a dummy one).
Some languages sharing the same script define macros to switch it (eg,
|\textcyrillic|), but be aware they may also set the language to a
@@ -627,6 +751,13 @@ fonts (for example, if the main latin encoding was |LY1|), and
therefore it has been deprecated.\footnote{But still defined for
backwards compatibility.}
+No macros to select the writing direction are provided, either --
+writing direction is intrinsic to each script and therefore it is best
+set by the language (which could be a dummy one). Furthermore, there
+are in fact two right-to-left modes, depending on the language, which
+differ in the way `weak' numeric characters are ordered (Arabic \%123
+\textit{vs} Hebrew 123\%).
+
\Describe{\ensureascii}{\marg{text}}
\New{3.9i} This macro makes sure \m{text} is typeset with a
@@ -665,11 +796,11 @@ easily with |"-|, |"=|, etc.
The package \textsf{inputenc} as well as \xetex{} an \luatex{} have
alleviated entering non-ASCII characters, but minority languages and
-some kinds of text can still require characters not directly
-available in the keyboards (and sometimes not even as separated or
-precomposed Unicode characters). As to the point 2, now
-\textsf{pdfTeX} provides |\knbccode|. Tools of point 3 can be still
-very useful in general.
+some kinds of text can still require characters not directly available
+on the keyboards (and sometimes not even as separated or precomposed
+Unicode characters). As to the point 2, now \textsf{pdfTeX} provides
+|\knbccode|, and \luatex{} can manipulate the glyph list. Tools for
+point 3 can be still very useful in general.
There are three levels of shorthands: \textit{user},
\textit{language}, and \textit{system} (by order of
@@ -1027,9 +1158,10 @@ too, but in such a case the code is executed only if
\meta{option-name} is the same as |\CurrentOption| (which could not
be the same as the option name as set in |\usepackage|!).
-For example, consider two languages \textsf{foo} and \textsf{bar}
-defining the same |\macro| with |\newcommand|. An error is raised if
-you attempt to load both. Here is a way to overcome this problem:
+\begin{example}
+ Consider two languages \textsf{foo} and \textsf{bar} defining the
+ same |\macro| with |\newcommand|. An error is raised if you attempt
+ to load both. Here is a way to overcome this problem:
\begin{verbatim}
\usepackage[base]{babel}
\AfterBabelLanguage{foo}{%
@@ -1037,6 +1169,7 @@ you attempt to load both. Here is a way to overcome this problem:
\let\macro\relax}
\usepackage[foo,bar]{babel}
\end{verbatim}
+\end{example}
\subsection{Creating a language}
@@ -1060,7 +1193,8 @@ Package babel Warning: \mylangchaptername not set. Please, define
In most cases, you will only need to define a few macros.
-For example, if you need a language named |arhinish|:
+\begin{example}
+ If you need a language named |arhinish|:
\begin{verbatim}
\usepackage[danish]{babel}
\babelprovide{arhinish}
@@ -1068,22 +1202,48 @@ For example, if you need a language named |arhinish|:
\renewcommand\arhinishrefname{Refirenke}
\renewcommand\arhinishhyphenmins{22}
\end{verbatim}
+\end{example}
The main language is not changed (\texttt{danish} in this example).
-So, you must add |\selectlanguage{arhinish}| or other selectors when
+So, you must add |\selectlanguage{arhinish}| or other selectors where
necessary.
+If the language has been loaded as an argument in |\documentclass| or
+|\usepackage|, then |\babelprovide| redefines the requested data.
+
+\Describe{import=}{\meta{language-tag}}
+\New{3.13} Imports data from an |ini| file, including captions, date,
+and hyphenmins. For example:
+\begin{verbatim}
+\babelprovide[import=hu]{hungarian}
+\end{verbatim}
+Unicode engines load the UTF-8 variants, while
+8-bit engines load the LICR (ie, with macros like |\'| or |\ss|) ones.
+
+There are about 200 |ini| files, with data taken from the |ldf| files
+and the CLDR provided by Unicode. Not all languages in the latter are
+complete, and therefore neither are the |ini| files. A few languages
+will show a warning about the current lack of suitability of the date
+format (\textsf{hindi}, \textsf{french}, \textsf{breton}, and
+\textsf{occitan}).
+
+Besides |\today|, there is a |\<language>date| macro with three
+arguments: year, month and day numbers. In fact, |\today| calls
+|\<language>today| which in turn calls
+|\<language>date{\year}{\month}{\day}|.
+
+Encoding, font, \textsf{fontspec} language and script, writing
+direction, etc., are not touched at all. They will be loaded in the
+future and used in a forthcoming set of tools to set the language
+fonts.
+
\Describe{captions=}{\meta{language-tag}}
-Currently, the \oarg{options} may be used to load captions from an
-|ini| file, but note these files are still tentative and might change.
-For example:
+Loads only the strings. For example:
\begin{verbatim}
\babelprovide[captions=hu]{hungarian}
\end{verbatim}
-It just loads the strings, no more. Encoding, font,
-\textsf{fontspec} language and script, writing direction, etc., are
-not touched at all. Unicode engines load the UTF-8 variants, while
-8-bit engines load the LICR (ie, with macros like |\'| or |\ss|) ones.
+Encoding, font, \textsf{fontspec} language and script, writing
+direction, etc., are not touched at all.
\Describe{hyphenrules=}{\meta{language-list}} With this option, with a
space-separated list of hyphenation rules, \babel{} assigns to the
@@ -1111,11 +1271,10 @@ list is empty).
one. Only in newly defined languages.
\begin{note}
- (1) Setting \verb|\today| is not so easy, and requires more work
- (some tools are on the way). (2) If you need shorthands, you can use
- |\useshorthands| and |\defineshorthand| as described above. (3)
- Captions and |\today| are ``ensured'' with |\babelensure| (because
- this will be the default in |ini|-based languages).
+ (1) If you need shorthands, you can use |\useshorthands| and
+ |\defineshorthand| as described above. (2) Captions and |\today| are
+ ``ensured'' with |\babelensure| (because this will be the default in
+ |ini|-based languages).
\end{note}
\subsection{Hooks}
@@ -1685,7 +1844,7 @@ The following assumptions are made:
selected, \babel{} will attempt setting it after lowercasing its
name.
\item The semantics of modifiers is not defined (on purpose). In
- most cases, they will just be simple separated options (eg.,
+ most cases, they will just be simple separated options (eg,
\texttt{spanish}), but a language might require, say, a set of
options organized as a tree with suboptions (in such a case, the
recommended separator is \verb|/|).
@@ -2086,7 +2245,7 @@ added.\nb{like `monetary', `time', `address', `name', `case' or
\begin{verbatim}
\StartBabelCommands{language}{captions}
- [unicode, fontenc=EU1 EU2, charset=utf8]
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
\SetString{\chaptername}{utf8-string}
\StartBabelCommands{language}{captions}
@@ -2096,14 +2255,14 @@ added.\nb{like `monetary', `time', `address', `name', `case' or
\end{verbatim}
A real example is:
-\begin{verbatim}[escapechar=\&]
+\begin{verbatim}
\StartBabelCommands{austrian}{date}
- [unicode, fontenc=EU1 EU2, charset=utf8]
- \SetString\monthiname{J&\"a&nner}
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
+ \SetString\monthiname{Jänner}
\StartBabelCommands{german,austrian}{date}
- [unicode, fontenc=EU1 EU2, charset=utf8]
- \SetString\monthiiiname{M&\"a&rz}
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
+ \SetString\monthiiiname{März}
\StartBabelCommands{austrian}{date}
\SetString\monthiname{J\"{a}nner}
@@ -2191,19 +2350,19 @@ optional one. This command, unlike |\SetString|, is executed always
only.
For example, as |T1| is the default case mapping in \LaTeX, we could
-set for Turkish:
+set for Turkish: % :-( Seem to be a bug in listings. Fixed with &&.
\begin{verbatim}[escapechar=\&]
\StartBabelCommands{turkish}{}[ot1enc, fontenc=OT1]
\SetCase
{\uccode"10=`I\relax}
{\lccode`I="10\relax}
-\StartBabelCommands{turkish}{}[unicode, fontenc=EU1 EU2, charset=utf8]
+\StartBabelCommands{turkish}{}[unicode, fontenc=TU EU1 EU2, charset=utf8]
\SetCase
- {\uccode`i=`&\rmfamily\.{\ttfamily I}&\relax
- \uccode`&\i&=`I\relax}
- {\lccode`&\rmfamily\.{\ttfamily I}&=`i\relax
- \lccode`I=`&\i&\relax}
+ {\uccode`i=`&İ&\relax
+ \uccode`&ı&=`I\relax}
+ {\lccode`&İ&=`i\relax
+ \lccode`I=`&ı&\relax}
\StartBabelCommands{turkish}{}
\SetCase
@@ -2335,14 +2494,12 @@ have occurred:
lowercase codes, uppercase codes, and category codes are kept
local to that group. If they are needed for the language, these
changes will need to be repeated and stored in |\extras...|
-\item The concept of language attributes is introduced. It is
- intended to give the user some control over the
- features a language-definition file provides. Its
- first use is for the Greek language, where the user can choose
- the $\pi o\lambda\upsilon\tau o\nu\kappa\acute{o}$
- (``Polutoniko'' or multi-accented) Greek way of typesetting
- texts. These attributes will possibly find wider use in future
- releases.
+\item The concept of language attributes is introduced. It is intended
+ to give the user some control over the features a
+ language-definition file provides. Its first use is for the Greek
+ language, where the user can choose the πολυτονικό (``polytonikó'' or
+ multi-accented) Greek way of typesetting texts. These attributes
+ will possibly find wider use in future releases.
\item The environment \Lenv{hyphenrules} is introduced.
\item The syntax of the file \file{language.dat} has been
extended to allow (optionally) specifying the font
@@ -2433,28 +2590,15 @@ with the previous release. Here is a list of the most important ones:
\item the language definition files now have a new extension,
\file{ldf};
\item the syntax of the file \file{language.dat} is extended to
- be compatible with the \pkg{french} package by Bernard Gaulle;
+ be compatible with the \pkg{french} package by Bernard Gaulle [this
+ package is now named \textsf{frenchle}];
\item each language definition file looks for a configuration
file which has the same name, but the extension \file{.cfg}. It
-can contain any valid \LaTeX\ code.
+can contain any valid \LaTeX\ code.
\end{itemize}
\DocInput{babel.dtx}
-\section{Conclusion}
-
-A system of document options has been presented that enable the user
-of \LaTeX\ to adapt the standard document classes of \LaTeX\ to the
-language he or she prefers to use. These options offer the possibility
-of switching between languages in one document. The basic interface
-consists of using one option, which is the same for \emph{all}
-standard document classes.
-
-In some cases the language definition files provide macros that can be
-useful to plain \TeX\ users as well as to \LaTeX\ users. The \babel{}
-system has been implemented so that it can be used by both groups of
-users.
-
\section{Acknowledgements}
I would like to thank all who volunteered as $\beta$-testers for their
@@ -2539,7 +2683,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \part{The code}
%
-% \babel{} is being developed incrementtally, which means parts of the
+% \babel{} is being developed incrementally, which means parts of the
% code are under development and therefore incomplete. Only documented
% features are considered complete. In other words, use \babel{} only
% as documented (except, of course, if you want to explore and test
@@ -2573,8 +2717,8 @@ help from Bernd Raichle, for which I am grateful.
% little bit of literate programming.
%
% \begin{macrocode}
-%<<version=3.12>>
-%<<date=2017/06/29>>
+%<<version=3.13>>
+%<<date=2017/09/18>>
% \end{macrocode}
%
% \section{Tools}
@@ -2660,7 +2804,7 @@ help from Bernd Raichle, for which I am grateful.
%
% The following piece of code is stolen (with some changes) from
% \textsf{keyval}, by David Carlisle. It defines two macros:
-% |\bbl@trim| and |bbl@trim@def|. The first one strips the leading
+% |\bbl@trim| and |\bbl@trim@def|. The first one strips the leading
% and trailing spaces from the second argument and then applies the
% first argument (a macro, |\toks@| and the like). The second one, as
% its name suggests, defines the first argument as the stripped second
@@ -2708,7 +2852,7 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% A tool from \textsf{url}, by Donald
-% Arseneau, which test if a string is empty or space.
+% Arseneau, which tests if a string is empty or space.
%
% \begin{macrocode}
\def\bbl@ifblank#1{%
@@ -3291,28 +3435,29 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{babel~3.9t}{2017/04/23}{Removed options for English, Indonesian and
% Malay, now handled with proxy files}
+% \changes{babel~3.13}{2017/08/24}{Removed options for French,
+% too. ldf files now takes priority if exist, except Hebrew (to do)}
%
% \begin{macrocode}
-\DeclareOption{acadian}{\bbl@load@language{frenchb}}
-\DeclareOption{afrikaans}{\bbl@load@language{dutch}}
-\DeclareOption{brazil}{\bbl@load@language{portuges}}
-\DeclareOption{brazilian}{\bbl@load@language{portuges}}
-\DeclareOption{canadien}{\bbl@load@language{frenchb}}
-\DeclareOption{francais}{\bbl@load@language{frenchb}}
-\DeclareOption{french}{\bbl@load@language{frenchb}}%
+\def\bbl@try@load@lang#1#2#3{%
+ \IfFileExists{\CurrentOption.ldf}%
+ {\bbl@load@language{\CurrentOption}}%
+ {#1\bbl@load@language{#2}#3}}
+\DeclareOption{afrikaans}{\bbl@try@load@lang{}{dutch}{}}
+\DeclareOption{brazil}{\bbl@try@load@lang{}{portuges}{}}
+\DeclareOption{brazilian}{\bbl@try@load@lang{}{portuges}{}}
\DeclareOption{hebrew}{%
\input{rlbabel.def}%
\bbl@load@language{hebrew}}
-\DeclareOption{hungarian}{\bbl@load@language{magyar}}
-\DeclareOption{lowersorbian}{\bbl@load@language{lsorbian}}
-\DeclareOption{nynorsk}{\bbl@load@language{norsk}}
+\DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}}
+\DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}}
+\DeclareOption{nynorsk}{\bbl@try@load@lang{}{norsk}{}}
\DeclareOption{polutonikogreek}{%
- \bbl@load@language{greek}%
- \languageattribute{greek}{polutoniko}}
-\DeclareOption{portuguese}{\bbl@load@language{portuges}}
-\DeclareOption{russian}{\bbl@load@language{russianb}}
-\DeclareOption{ukrainian}{\bbl@load@language{ukraineb}}
-\DeclareOption{uppersorbian}{\bbl@load@language{usorbian}}
+ \bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}}
+\DeclareOption{portuguese}{\bbl@try@load@lang{}{portuges}{}}
+\DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}}
+\DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}}
+\DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}}
% \end{macrocode}
%
% Another way to extend the list of `known' options for \babel\ was
@@ -6294,15 +6439,21 @@ help from Bernd Raichle, for which I am grateful.
% provide the real string.
%
% \changes{3.10}{2017/05/19}{Added \cs{babelprovide}}
+% \changes{3.13}{2017/08/30}{Added \cs{import}, which also reads
+% dates. Some refactoring in the ini reader.}
%
% \begin{macrocode}
\newcommand\babelprovide[2][]{%
\let\bbl@savelangname\languagename
\def\languagename{#2}%
\let\bbl@KVP@captions\@nil
+ \let\bbl@KVP@import\@nil
\let\bbl@KVP@main\@nil
\let\bbl@KVP@hyphenrules\@nil
\bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling
+ \ifx\bbl@KVP@captions\@nil
+ \let\bbl@KVP@captions\bbl@KVP@import
+ \fi
\bbl@ifunset{date#2}%
{\bbl@provide@new{#2}}%
{\bbl@ifblank{#1}%
@@ -6312,7 +6463,7 @@ help from Bernd Raichle, for which I am grateful.
options: captions=lang-tag, hyphenrules=lang-list}%
{Use this macro as documented}}%
{\bbl@provide@renew{#2}}}%
- \babelensure{#2}%
+ \bbl@exp{\\\babelensure[exclude=\\\today]{#2}}%
\let\languagename\bbl@savelangname}
% \end{macrocode}
%
@@ -6325,8 +6476,8 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{extras#1}{}%
\@namedef{noextras#1}{}%
\StartBabelCommands*{#1}{captions}%
- \ifx\bbl@KVP@captions\@nil
- \def\bbl@tempb##1{% elt for \bbl@captionslist
+ \ifx\bbl@KVP@captions\@nil % and also if import, implicit
+ \def\bbl@tempb##1{% elt for \bbl@captionslist
\ifx##1\@empty\else
\bbl@exp{%
\\\SetString\\##1{%
@@ -6340,10 +6491,18 @@ help from Bernd Raichle, for which I am grateful.
\bbl@savestrings
\fi
\StartBabelCommands*{#1}{date}%
- \bbl@exp{%
- \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}%
+ \ifx\bbl@KVP@import\@nil
+ \bbl@exp{%
+ \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}%
+ \else
+ \bbl@savetoday
+ \bbl@savedate
+ \fi
\EndBabelCommands
- \expandafter\gdef\csname#1hyphenmins\endcsname{23}%
+ \bbl@exp{%
+ \def\<#1hyphenmins>{%
+ {\bbl@ifunset{bbl@lfthm@#1}{2}{\@nameuse{bbl@lfthm@#1}}}%
+ {\bbl@ifunset{bbl@rgthm@#1}{3}{\@nameuse{bbl@rgthm@#1}}}}}%
\ifx\bbl@KVP@main\@nil\else
\expandafter\main@language\expandafter{#1}%
\fi}
@@ -6355,7 +6514,13 @@ help from Bernd Raichle, for which I am grateful.
\bbl@after@ini
\bbl@savestrings
\EndBabelCommands
- \fi}
+ \fi
+ \ifx\bbl@KVP@import\@nil\else
+ \StartBabelCommands*{#1}{date}%
+ \bbl@savetoday
+ \bbl@savedate
+ \EndBabelCommands
+ \fi}
% \end{macrocode}
%
% The |hyphenrules| option is handled with an auxiliary macro.
@@ -6400,6 +6565,10 @@ help from Bernd Raichle, for which I am grateful.
\else
\let\bbl@section\@empty
\let\bbl@savestrings\@empty
+ \let\bbl@savetoday\@empty
+ \let\bbl@savedate\@empty
+ \let\bbl@inireader\bbl@iniskip
+ \bbl@info{Importing data from babel-#1.ini for \languagename}%
\loop
\endlinechar\m@ne
\read1 to \bbl@line
@@ -6411,67 +6580,142 @@ help from Bernd Raichle, for which I am grateful.
\repeat
\fi}
\def\bbl@iniline#1\bbl@iniline{%
- \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inikv}#1\@@} %]
+ \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inireader}#1\@@}% ]
+% \end{macrocode}
+%
+% The special cases for comment lines and sections are handled by the
+% two following commands. In sections, we provide the posibility to
+% take extra actions at the end or at the start (TODO - but note the last
+% section is not ended). By default, key=val pairs are ignored.
+%
+% \begin{macrocode}
\def\bbl@iniskip#1\@@{}% if starts with ;
\def\bbl@inisec[#1]#2\@@{% if starts with opening bracket
+ \@nameuse{bbl@secpost@\bbl@section}% ends previous section
\def\bbl@section{#1}%
- \bbl@debug{\message{[[ #1 ]]^^J}}}
-\def\bbl@inikv#1=#2\@@{% otherwise, key=value
+ \@nameuse{bbl@secpre@\bbl@section}% starts current section
+ \bbl@ifunset{bbl@secline@#1}%
+ {\let\bbl@inireader\bbl@iniskip}%
+ {\bbl@exp{\let\\\bbl@inireader\<bbl@secline@#1>}}}
+% \end{macrocode}
+%
+% Reads a key=val line and stores the trimmed val in
+% |\bbl@@kv@<section>.<key>|.
+%
+% \begin{macrocode}
+\def\bbl@inikv#1=#2\@@{% key=value
\bbl@trim@def\bbl@tempa{#1}%
\bbl@trim\toks@{#2}%
- \bbl@ifunset{bbl@ini@\bbl@section}%
- {}%
- {\bbl@exp{%
- \<bbl@ini@\bbl@section>\bbl@tempa=\the\toks@\\\@nil}}}
-\def\bbl@after@ini{%
- % make sure Script and Language takes some value
- \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@lotf@\languagename}}}%
- {\bbl@csarg\gdef{lotf@\languagename}{dflt}}{}%
- \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@sotf@\languagename}}}%
- {\bbl@csarg\gdef{sotf@\languagename}{DFLT}}{}}
+ \bbl@csarg\edef{@kv@\bbl@section.\bbl@tempa}{\the\toks@}}
+% \end{macrocode}
+%
+% The previous assignments are local, so we need to export them. If
+% the value is empty, we can provide a default value.
+%
+% \begin{macrocode}
+\def\bbl@exportkey#1#2#3{%
+ \bbl@ifunset{bbl@@kv@#2}%
+ {\bbl@csarg\gdef{#1@\languagename}{#3}}%
+ {\expandafter\ifx\csname bbl@@kv@#2\endcsname\@empty
+ \bbl@csarg\gdef{#1@\languagename}{#3}%
+ \else
+ \bbl@exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
+ \fi}}
% \end{macrocode}
%
% Key-value pairs are treated differently depending on the section in
% the |ini| file. The following macros are the readers for
-% |captions| (with Unicode) or |captions.licr| (for 8-bit) and for
-% |identification|. But first, an auxiliary macro.
+% |identification| and |typography|.
+%
+% \begin{macrocode}
+\let\bbl@secline@identification\bbl@inikv
+\def\bbl@secpost@identification{%
+ \bbl@exportkey{lname}{identification.name.english}{}%
+ \bbl@exportkey{lbcp}{identification.tag.bcp47}{}%
+ \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}%
+ \bbl@exportkey{sname}{identification.script.name}{}%
+ \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}%
+ \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}}
+\let\bbl@secline@typography\bbl@inikv
+\def\bbl@after@ini{%
+ \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}%
+ \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}%
+ \def\bbl@tempa{0.9}%
+ \bbl@csarg\ifx{@kv@identification.version}\bbl@tempa
+ \bbl@warning{%
+ The `\languagename' date format may not be suitable\\%
+ for proper typesetting, and therefore it very likely will\\%
+ change in a future release. Reported}%
+ \fi
+ \bbl@toglobal\bbl@savetoday
+ \bbl@toglobal\bbl@savedate}
+% \end{macrocode}
+%
+% Now |captions| and |captions.licr|, depending on the engine. And
+% also for dates. They rely on a few auxilary macros.
%
% \begin{macrocode}
-\def\bbl@exportkey#1#2#3#4{% 1:bbl id,2:ini name,3:ini key,4:ini val
- \bbl@ifsamestring{#2}{#3}%
- {\bbl@csarg\gdef{#1@\languagename}{#4}}%
- {}}
\ifcase\bbl@engine
- \bbl@csarg\def{ini@captions.licr}#1=#2\@nil{% TODO - copypaste pattern
- \bbl@ifblank{#2}%
- {\bbl@exp{%
- \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
- {\toks@{#2}}%
- \bbl@exp{%
- \\\bbl@add\\\bbl@savestrings{% NOTE - with date will be global
- \\\SetString\<#1name>{\the\toks@}}}}
+ \bbl@csarg\def{secline@captions.licr}#1=#2\@@{%
+ \bbl@ini@captions@aux{#1}{#2}}
+ \bbl@csarg\def{secline@date.gregorian}#1=#2\@@{% for defaults
+ \bbl@ini@dategreg#1...\relax{#2}}
+ \bbl@csarg\def{secline@date.gregorian.licr}#1=#2\@@{% override
+ \bbl@ini@dategreg#1...\relax{#2}}
\else
- \def\bbl@ini@captions#1=#2\@nil{%
- \bbl@ifblank{#2}%
- {\bbl@exp{%
- \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
- {\toks@{#2}}%
- \bbl@exp{%
- \\\bbl@add\\\bbl@savestrings{%
- \\\SetString\<#1name>{\the\toks@}}}}
+ \def\bbl@secline@captions#1=#2\@@{%
+ \bbl@ini@captions@aux{#1}{#2}}
+ \bbl@csarg\def{secline@date.gregorian}#1=#2\@@{%
+ \bbl@ini@dategreg#1...\relax{#2}}
\fi
-\def\bbl@ini@identification#1=#2\@nil{% TODO - not only with captions
- \bbl@exportkey{lname}{name.english}{#1}{#2}%
- \bbl@exportkey{lbcp}{tag.bcp47}{#1}{#2}%
- \bbl@exportkey{lotf}{tag.opentype}{#1}{#2}%
- \bbl@exportkey{sname}{script.name}{#1}{#2}%
- \bbl@exportkey{sbcp}{script.tag.bcp47}{#1}{#2}%
- \bbl@exportkey{sotf}{script.tag.opentype}{#1}{#2}}
+% \end{macrocode}
+%
+% The auxiliary macro for captions define |\<caption>name|.
+%
+% \begin{macrocode}
+\def\bbl@ini@captions@aux#1#2{%
+ \bbl@trim@def\bbl@tempa{#1}%
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{\bbl@tempa}\<\languagename\bbl@tempa name>}}}%
+ {\bbl@trim\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{%
+ \\\SetString\<\bbl@tempa name>{\the\toks@}}}}
+% \end{macrocode}
+%
+% But dates are more complex. The full date format is stores in
+% |date.gregorian|, so we must read it in non-Unicode engines, too.
+%
+% \begin{macrocode}
+\bbl@csarg\def{secpre@date.gregorian.licr}{%
+ \ifcase\bbl@engine\let\bbl@savedate\@empty\fi}
+\def\bbl@ini@dategreg#1.#2.#3.#4\relax#5{% TODO - ignore with 'captions'
+ \bbl@trim@def\bbl@tempa{#1.#2}%
+ \bbl@ifsamestring{\bbl@tempa}{months.wide}%
+ {\bbl@trim@def\bbl@tempa{#3}%
+ \bbl@trim\toks@{#5}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savedate{%
+ \\\SetString\<month\romannumeral\bbl@tempa name>{\the\toks@}}}}%
+ {\bbl@ifsamestring{\bbl@tempa}{date.long}%
+ {\bbl@trim@def\bbl@toreplace{#5}%
+ \bbl@TG@@date
+ \global\bbl@csarg\let{date@\languagename}\bbl@toreplace
+ \bbl@exp{%
+ \gdef\<\languagename date>####1####2####3{%
+ \<bbl@ensure@\languagename>{%
+ \<bbl@date@\languagename>{####1}{####2}{####3}}}%
+ \\\bbl@add\\\bbl@savetoday{%
+ \\\SetString\\\today{%
+ \<\languagename date>{\year}{\month}{\day}}}}}}%
+ {}}
% \end{macrocode}
%
% Dates will require some macros for the basic formatting. They may be
% redefined by language, so ``semi-public'' names (camel case) are
-% used.
+% used. Oddly enough, the CLDR places particles like “de”
+% inconsistenly in either in the date or in the month name.
%
% \begin{macrocode}
\newcommand\BabelDateSpace{\nobreakspace{}}
@@ -6488,9 +6732,15 @@ help from Bernd Raichle, for which I am grateful.
\else\ifnum#1<100 \number#1 %
\else\ifnum#1<1000 \expandafter\@gobble\number#1 %
\else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
- \else\ERRORd % TODO - real error
+ \else
+ \bbl@error
+ {Currently two-digit years are restricted to the\\
+ range 0-9999.}%
+ {There is little you can do. Sorry.}%
\fi\fi\fi\fi}}
\newcommand\BabelDateyyyy[1]{{\number#1}}
+\def\bbl@replace@finish@iii#1{%
+ \bbl@exp{\def\\#1####1####2####3{\the\toks@}}}
\def\bbl@TG@@date{%
\bbl@replace\bbl@toreplace{[ ]}{\BabelDateSpace{}}%
\bbl@replace\bbl@toreplace{[.]}{\BabelDateDot{}}%
@@ -6501,7 +6751,10 @@ help from Bernd Raichle, for which I am grateful.
\bbl@replace\bbl@toreplace{[MMMM]}{\BabelDateMMMM{####2}}%
\bbl@replace\bbl@toreplace{[y]}{\BabelDatey{####1}}%
\bbl@replace\bbl@toreplace{[yy]}{\BabelDateyy{####1}}%
- \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}}
+ \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}%
+% Note after \bbl@replace \toks@ contains the resulting string.
+% TODO - Using this implicit behavior doesn't seem a good idea.
+ \bbl@replace@finish@iii\bbl@toreplace}
% \end{macrocode}
%
% \subsection{Cross referencing macros}
@@ -7310,14 +7563,15 @@ help from Bernd Raichle, for which I am grateful.
% \begin{itemize}
% \item pdftex provides a minimal support for bidi text, and it
% must be done by hand. Vertical typesetting is not possible.
-% \item XeTeX is somewhat better, thanks to the font
-% engine. However, very little is done at the paragraph level.
+% \item XeTeX fares somewhat better, thanks to the font engine and
+% a few additional tools. However, very little is done at the
+% paragraph level.
% \item LuaTeX could provide the most complete solution, as we can
% manipulate almost freely the node list, the generated lines,
-% and so on, but unlike XeTeX bidi text does not work out of the
-% box and some development is necessary. It also provides tools
-% to properly set left-to-right and right-to-left page
-% layouts. As LuaTeX-ja shows, vertical typesetting is posible.
+% and so on, but bidi text does not work out of the box and some
+% development is necessary. It also provides tools to properly
+% set left-to-right and right-to-left page layouts. As LuaTeX-ja
+% shows, vertical typesetting is posible.
% \end{itemize}
%
% \begin{macrocode}
@@ -7810,8 +8064,8 @@ help from Bernd Raichle, for which I am grateful.
% constructing the names of three macros by concatenating three
% words with the argument of |\selectlanguage|, and calling these
% macros. \nb{What if \cs{hyphenation} was used in |extras|? Patch
-% temply set@hyphenmins and hyphenation. It can be done in hooks if
-% necessary.}
+% temporarily |\set@hyphenmins| and hyphenation. It can be done in
+% hooks if necessary.}
%
%
% The switching of the values of |\lefthyphenmin| and
@@ -8135,7 +8389,9 @@ help from Bernd Raichle, for which I am grateful.
% |\righthyphenmin|. It expects two values as its argument.
%
% \begin{macrocode}
-\def\set@hyphenmins#1#2{\lefthyphenmin#1\relax\righthyphenmin#2\relax}
+\def\set@hyphenmins#1#2{%
+ \lefthyphenmin#1\relax
+ \righthyphenmin#2\relax}
% \end{macrocode}
%
% \end{macro}
@@ -9950,4 +10206,7 @@ help from Bernd Raichle, for which I am grateful.
%
% Local Variables:
% mode: doctex
-% End: \ No newline at end of file
+% coding: utf-8
+% TeX-engine: luatex
+% End:
+
diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
index 1237f3fcc4d..0bb31228187 100644
--- a/Master/texmf-dist/source/latex/babel/bbcompat.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2017/06/29 v3.12]
+\ProvidesFile{bbcompat.dtx}[2017/09/18 v3.13]
%</dtx>
%
%% File 'bbcompat.dtx'
diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip
index e271aa75dbb..fb5cf859531 100644
--- a/Master/texmf-dist/source/latex/babel/locale.zip
+++ b/Master/texmf-dist/source/latex/babel/locale.zip
Binary files differ