[latex3-commits] [git/LaTeX3-latex3-babel] master: Preliminary code for ‘labels’. (6ba9031)

Javier email at dante.de
Mon Jul 27 11:14:20 CEST 2020


Repository : https://github.com/latex3/babel
On branch  : master
Link       : https://github.com/latex3/babel/commit/6ba90318b693a85300bf191ceb1d4d1e7496445c

>---------------------------------------------------------------

commit 6ba90318b693a85300bf191ceb1d4d1e7496445c
Author: Javier <email at localhost>
Date:   Mon Jul 27 11:14:20 2020 +0200

    Preliminary code for ‘labels’.


>---------------------------------------------------------------

6ba90318b693a85300bf191ceb1d4d1e7496445c
 README.md              |  10 ++--
 babel.dtx              | 137 ++++++++++++++++++++++++++++++++++++++-----------
 babel.ins              |   2 +-
 babel.pdf              | Bin 792238 -> 796145 bytes
 bbcompat.dtx           |   2 +-
 locale/hu/babel-hu.ini |   3 ++
 locale/ja/babel-ja.ini |  11 +++-
 7 files changed, 130 insertions(+), 35 deletions(-)

diff --git a/README.md b/README.md
index 51b28dd..a03df2d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.47
+## Babel 3.47.2081
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -7,9 +7,9 @@ lualatex out of the box.  A few even work with plain formats.
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.47 are described in:
+Changes in version 3.48 are described in:
 
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47
+https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48
 
 Included is a set of ini files for about 200 languages. 
 
@@ -44,6 +44,9 @@ respective authors.
 ### Latest changes
 
 ```
+3.48   2020-07-27 (development)
+       - New keys to customize labels (chapter, enumerate, etc.).
+
 3.47   2020-07-13
        - Fixes:
          - Spurious spaces when autoloading locales (bug introduced
@@ -53,6 +56,7 @@ respective authors.
        - New - \getlocaleproperty*, which doesn't raise an error.
        - Basic ini+tex templates for about 500 languages in the GitHub
          repository.
+https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47
 
 3.46   2020-07-06
        - Languages can now be optionally selected with their BCP 47
diff --git a/babel.dtx b/babel.dtx
index acc0b39..33e2196 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2020/07/13 v3.47 The Babel package]
+\ProvidesFile{babel.dtx}[2020/07/27 v3.47.2081 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -4691,8 +4691,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.47>>
-%<<date=2020/07/13>>
+%<<version=3.47.2081>>
+%<<date=2020/07/27>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5905,13 +5905,13 @@ help from Bernd Raichle, for which I am grateful.
 % but it broke bookmarks. This was quickly fixed in \pkg{hyperref},
 % which essentially made it no-op. However, it will not removed for
 % the moment because \pkg{hyperref} is expecting it. TODO. Still
-% true? 
+% true? Commented out in 2020/07/27.
 %
 %    \begin{macrocode}
-\AtBeginDocument{%
-  \ifx\pdfstringdefDisableCommands\@undefined\else
-    \pdfstringdefDisableCommands{\languageshorthands{system}}%
-  \fi}
+% \AtBeginDocument{%
+%   \ifx\pdfstringdefDisableCommands\@undefined\else
+%     \pdfstringdefDisableCommands{\languageshorthands{system}}%
+%   \fi}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -7226,23 +7226,23 @@ help from Bernd Raichle, for which I am grateful.
   % set the locale id
   \bbl at id@assign
   % switch captions, date
-  \ifcase\bbl at select@type
-    \bbl at bsphack
-      \csname captions#1\endcsname\relax
-      \csname date#1\endcsname\relax
-    \bbl at esphack
-  \else
-    \bbl at bsphack
-      \bbl at xin@{,captions,}{,\bbl at select@opts,}%
-      \ifin@
+  % No text is supposed to be added here, so we remove any
+  % spurious spaces.  
+  \bbl at bsphack
+    \ifcase\bbl at select@type
         \csname captions#1\endcsname\relax
-      \fi
-      \bbl at xin@{,date,}{,\bbl at select@opts,}%
-      \ifin@  % if \foreign... within \<lang>date
         \csname date#1\endcsname\relax
-      \fi
-    \bbl at esphack
-  \fi
+    \else
+        \bbl at xin@{,captions,}{,\bbl at select@opts,}%
+        \ifin@
+          \csname captions#1\endcsname\relax
+        \fi
+        \bbl at xin@{,date,}{,\bbl at select@opts,}%
+        \ifin@  % if \foreign... within \<lang>date
+          \csname date#1\endcsname\relax
+        \fi
+    \fi
+  \bbl at esphack
   % switch extras
   \bbl at usehooks{beforeextras}{}%
   \csname extras#1\endcsname\relax
@@ -10336,7 +10336,11 @@ help from Bernd Raichle, for which I am grateful.
         {Use this macro as documented}}%
       {\bbl at provide@renew{#2}}}%
   % Post tasks
-  \bbl at exp{\\\babelensure[exclude=\\\today]{#2}}%
+  \bbl at ifunset{bbl at extracaps@#2}%
+    {\bbl at exp{\\\babelensure[exclude=\\\today]{#2}}}%
+    {\toks@\expandafter\expandafter\expandafter
+      {\csname bbl at extracaps@#2\endcsname}%
+     \bbl at exp{\\\babelensure[exclude=\\\today,include=\the\toks@}]{#2}}%
   \bbl at ifunset{bbl at ensure@\languagename}%
     {\bbl at exp{%
       \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
@@ -11008,10 +11012,85 @@ help from Bernd Raichle, for which I am grateful.
     {\bbl at trim\toks@{#2}}%
   \bbl at exp{%
     \\\bbl at add\\\bbl at savestrings{%
-      \\\SetString\<\bbl at tempa name>{\the\toks@}}}}
+      \\\SetString\<\bbl at tempa name>{\the\toks@}}}%
+  \toks@\expandafter{\bbl at captionslist}%
+  \bbl at exp{\\\in@{\<\bbl at tempa name>}{\the\toks@}}%
+  \ifin@\else
+    \bbl at exp{%
+      \\\bbl at add\<bbl at extracaps@\languagename>{\<\bbl at tempa name>}%
+      \\\bbl at toglobal\<bbl at extracaps@\languagename>}%
+  \fi}
+%    \end{macrocode}
+%
+% \textbf{Labels.} Captions must contain just strings, no
+% format at all, so there is new group in ini files.
+% 
+%    \begin{macrocode}
+\def\bbl at bktoname[[#1]]{\csname#1name\endcsname} % TODO - ugly
+\def\bbl at bktothe[#1]{\csname the#1\endcsname}
+\def\bbl at inikv@labels#1=#2\@@{%
+  \def\bbl at toreplace{#2}%
+  \bbl at replace\bbl at toreplace{[ ]}{\nobreakspace{}}%
+  \bbl at replace\bbl at toreplace{[[}{\bbl at bktoname[[}%
+  \bbl at replace\bbl at toreplace{[}{\bbl at bktothe[}% 
+  \bbl at replace\bbl at toreplace{\bbl at bktothe[\bbl at bktothe}{[}% Ugly
+  \in@{,#1,}{,chapter,}%
+  \ifin@
+    \bbl at patchchapter
+    \global\bbl at csarg\let{chapfmt@\languagename}\bbl at toreplace
+  \fi 
+  \in@{,#1,}{,appendix,}%
+  \ifin@
+    \bbl at patchchapter
+    \global\bbl at csarg\let{appxfmt@\languagename}\bbl at toreplace
+  \fi 
+  %
+  \in@{,#1,}{,figure,table,}%
+  \ifin@
+    \toks@\expandafter{\bbl at toreplace}%
+    \bbl at exp{\gdef\<fnum@#1>{\the\toks@}}%
+  \fi
+  %
+  \in@{enumerate.}{#1}%
+  \ifin@
+    \def\bbl at tempa{#1}%
+    \bbl at replace\bbl at tempa{enumerate.}{}%
+    \toks@\expandafter{\bbl at toreplace}%
+    \bbl at exp{%
+      \\\bbl at add\<extras\languagename>{%
+        \\\babel at save\<labelenum\romannumeral\bbl at tempa>%
+        \def\<labelenum\romannumeral\bbl at tempa>{\the\toks@}}%
+      \\\bbl at toglobal\<extras\languagename>}%
+  \fi}
+%    \end{macrocode}
+%% 
+% To show correctly some captions in a few languages, we need to patch
+% some internal macros, because the order is hardcoded. For example, in
+% Japanese the chapter number is surrounded by two string, while
+% in Hungarian is placed after. 
+
+%    \begin{macrocode}
+\def\bbl at chaptype{chap}
+\ifx\@makechapterhead\@undefined
+  \let\bbl at patchchapter\relax
+\else
+  \def\bbl at patchchapter{%
+    \global\let\bbl at patchchapter\relax
+    \bbl at add\appendix{\def\bbl at chaptype{appx}}% Not harmful, I hope
+    \bbl at toglobal\appendix
+    % This replacement works in many classes, but not all
+    \bbl at sreplace\@makechapterhead
+      {\@chapapp\space\thechapter}%
+      {\bbl at chapterformat}%
+    \bbl at toglobal\@makechapterhead
+    \gdef\bbl at chapterformat{%
+      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
+        {\@chapapp\space\thechapter}
+        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}}
+\fi
 %    \end{macrocode}
 %
-% TODO. Document
+% \textbf{Date.} TODO. Document
 %
 %    \begin{macrocode}
 % Arguments are _not_ protected.
@@ -11082,9 +11161,9 @@ help from Bernd Raichle, for which I am grateful.
       {}}}
 %    \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. Oddly enough, the CLDR places particles like “de”
+% \textbf{Dates} will require some macros for the basic formatting.
+% They may be redefined by language, so ``semi-public'' names (camel
+% case) are used. Oddly enough, the CLDR places particles like “de”
 % inconsistently in either in the date or in the month name.
 %
 %    \begin{macrocode}
diff --git a/babel.ins b/babel.ins
index f967de9..9f96a4d 100644
--- a/babel.ins
+++ b/babel.ins
@@ -26,7 +26,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%
-\def\filedate{2020/07/13}
+\def\filedate{2020/07/27}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 1e8c2a0..57b111f 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 9a2431f..7093831 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2020/07/13 v3.47]
+\ProvidesFile{bbcompat.dtx}[2020/07/27 v3.47.2081]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/hu/babel-hu.ini b/locale/hu/babel-hu.ini
index f0c4baa..8146138 100644
--- a/locale/hu/babel-hu.ini
+++ b/locale/hu/babel-hu.ini
@@ -74,6 +74,9 @@ also = l\'asd m\'eg
 proof = Bizony\'\i t\'as
 glossary = Sz\'ojegyz\'ek
 
+[labels]
+chapter = [chapter]. [[chapter]]
+
 [date.gregorian]
 date.long = [y].[ ][MMMM] [d].
 date.short = [y]. [MM]. [dd].
diff --git a/locale/ja/babel-ja.ini b/locale/ja/babel-ja.ini
index 2e25548..8c1636d 100644
--- a/locale/ja/babel-ja.ini
+++ b/locale/ja/babel-ja.ini
@@ -34,6 +34,8 @@ preface = 前書き
 ref = 参考文献
 abstract = 概要
 bib = 参考文献
+; empty
+chapter =
 prechapter = 第
 postchapter = 章
 appendix = 付録
@@ -43,7 +45,9 @@ listtable = 表目次
 index = 索引
 figure = 図
 table = 表
-part = 第
+; empty
+part =
+prepart = 第
 postpart = 部
 encl =
 cc =
@@ -54,6 +58,11 @@ also =
 proof = 証明
 glossary = 用語集
 
+[labels]
+chapter = [[prechapter]] [chapter] [[postchapter]]
+; part = [[prepart]] [part] [[postpart]]
+; enumerate.1 = [enumi])
+
 [captions.licr]
 preface = 
 ref = 





More information about the latex3-commits mailing list.