From 37729ddea335ca0dfe40ada381d05bde37c5ea61 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 30 Nov 2021 03:00:43 +0000 Subject: CTAN sync 202111300300 --- macros/latex/contrib/easybook/easybook.dtx | 64 ++++-- macros/latex/contrib/easybook/easybook.pdf | Bin 582743 -> 583057 bytes macros/latex/contrib/easybook/easybook.tex | 8 +- macros/latex/contrib/l3build/CHANGELOG.md | 20 +- macros/latex/contrib/l3build/README.md | 2 +- macros/latex/contrib/l3build/l3build-arguments.lua | 2 +- macros/latex/contrib/l3build/l3build-check.lua | 4 +- .../contrib/l3build/l3build-file-functions.lua | 2 +- macros/latex/contrib/l3build/l3build-help.lua | 2 +- macros/latex/contrib/l3build/l3build-install.lua | 4 + .../contrib/l3build/l3build-manifest-setup.lua | 2 +- .../latex/contrib/l3build/l3build-typesetting.lua | 10 +- macros/latex/contrib/l3build/l3build-upload.lua | 1 + macros/latex/contrib/l3build/l3build-variables.lua | 2 +- macros/latex/contrib/l3build/l3build.1 | 2 +- macros/latex/contrib/l3build/l3build.dtx | 16 +- macros/latex/contrib/l3build/l3build.lua | 2 +- macros/latex/contrib/l3build/l3build.pdf | Bin 740125 -> 740695 bytes macros/latex/required/babel/base/README.md | 11 +- macros/latex/required/babel/base/babel.dtx | 253 ++++++++++++++------- macros/latex/required/babel/base/babel.ins | 2 +- macros/latex/required/babel/base/babel.pdf | Bin 854250 -> 858700 bytes macros/latex/required/babel/base/bbcompat.dtx | 2 +- 23 files changed, 279 insertions(+), 132 deletions(-) (limited to 'macros/latex') diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 2e13fa3db6..c4e52d8a91 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/11/28}{1.41A} +\ProvidesExplClass{easybook}{2021/11/28}{1.41B} {Typeset Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -325,7 +325,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2021/11/28}{1.41A} +\ProvidesExplPackage{easybase}{2021/11/28}{1.41B} {Typeset Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1288,9 +1288,9 @@ lolskip .initial:n = 10pt, main-voffset .skip_set:N = \l__eb_toc_main_voffset_skip, main-voffset .initial:n = \bool_if:NTF \l__eb_class_book_bool { 1pc } { 0.2pc }, - line-align .bool_set:N = \l__eb_toc_line_align_bool, - line-align .default:n = true, - line-align .initial:n = true, + dotalign .bool_set:N = \l__eb_toc_dot_align_bool, + dotalign .default:n = true, + dotalign .initial:n = true, hang .bool_set:N = \eb@titletoc@hang@fix@bool, hang .default:n = true, hang .initial:n = false, @@ -1304,7 +1304,7 @@ \IfBooleanTF{#1} {\thecontentspage} { - \bool_if:NTF \l__eb_toc_line_align_bool + \bool_if:NTF \l__eb_toc_dot_align_bool { \contentspage } { \thecontentspage } } @@ -1513,7 +1513,8 @@ \keys_define:nn { eb/listoc } { section .code:n = \tl_set:Nn \l__eb_toc_type_tl { section }, - chapter .code:n = { }, + chapter .code:n = \tl_set:Nn \l__eb_toc_type_tl { chapter }, + none .code:n = \tl_set:Nn \l__eb_toc_type_tl { none }, article .meta:n = section, book .meta:n = chapter, multoc .int_set:N = \l__eb_toc_columns_int, @@ -1536,31 +1537,40 @@ { \tl_set:Nn \eb@bitoc@title {#2} } } -\cs_new_protected:Npn \eb_title_mark_intoc:n #1 +\cs_new_protected:Npn \eb_toc_type_section_initial: { - \tl_if_eq:NnTF \l__eb_toc_type_tl { chapter } - { \bichapter*{#1}{\eb@bitoc@title} } - { \bisection*{#1}{\eb@bitoc@title} } + \bool_if:NF \l__eb_class_book_bool + { + \tl_if_eq:NnT \l__eb_toc_type_tl { chapter } + { \tl_set:Nn \l__eb_toc_type_tl { section } } + } } -\cs_new_protected:Npn \eb_title_mark_notoc:n #1 +\cs_new_protected:Npn \eb_title_mark_intoc:n #1 { - \tl_if_eq:NnTF \l__eb_toc_type_tl { chapter } + \str_case:Vn \l__eb_toc_type_tl { - \chapter*{\phantomsection #1} - \chaptermark{#1} + { chapter } { \bichapter*{#1}{\eb@bitoc@title} } + { section } { \bisection*{#1}{\eb@bitoc@title} } } + } +\cs_new_protected:Npn \eb_title_mark_notoc:n #1 + { + \str_case:Vn \l__eb_toc_type_tl { - \section*{\phantomsection #1} - \sectionmark{#1} + { chapter } { \chapter*{\phantomsection #1}\chaptermark{#1} } + { section } { \section*{\phantomsection #1}\sectionmark{#1} } } } \cs_new_protected:Npn \eb_title_number_intoc_spec:nn #1#2 { + \eb_toc_type_section_initial: \IfBooleanTF{#1} { - \tl_if_eq:NnTF \l__eb_toc_type_tl { chapter } - { \bichapter{\eb@toc@title}{\eb@bitoc@title} } - { \bisection{\eb@toc@title}{\eb@bitoc@title} } + \str_case:Vn \l__eb_toc_type_tl + { + { chapter } { \bichapter{\eb@toc@title}{\eb@bitoc@title} } + { section } { \bisection{\eb@toc@title}{\eb@bitoc@title} } + } }{ \IfBooleanTF{#2} {\eb_title_mark_notoc:n { \eb@toc@title }} @@ -1584,13 +1594,18 @@ } { \@starttoc{#1} } } +\cs_new_protected:Npn \eb_toc_if_title_voffset:n #1 + { + \tl_if_eq:NnF \l__eb_toc_type_tl { none } + { \vspace*{-\dim_use:c { l__eb_toc_#1_voffset_skip }} } + } \cs_new_protected:Npn \eb_toc_list_parse:nnnnn #1#2#3#4#5 { \group_begin: \tl_set_eq:Nc \eb@toc@title { list#4name } \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_title_number_intoc_spec:nn {#2} {#1} - \vspace*{-\dim_use:c { l__eb_toc_#4_voffset_skip }} + \eb_toc_if_title_voffset:n {#4} \eb_toc_start_multi_column_ext:n {#5} \group_end: } @@ -1613,13 +1628,14 @@ \tl_set_eq:NN \eb@toc@title \contentsname \tl_set:Nn \eb@bitoc@title { Contents } \IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}} + \eb_toc_type_section_initial: \eb_title_mark_notoc:n { \eb@toc@title } - \vspace*{-\dim_use:N \l__eb_toc_main_voffset_skip} + \eb_toc_if_title_voffset:n { main } \eb_toc_start_multi_column_ext:n { toc }#3 \IfBooleanT{#1} { \eb_title_mark_notoc:n { \eb@bitoc@title } - \vspace*{-\dim_use:N \l__eb_toc_main_voffset_skip} + \eb_toc_if_title_voffset:n { main } \eb_toc_start_multi_column_ext:n { tec } } \group_end: @@ -2381,7 +2397,7 @@ } % %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2021/11/28}{1.41A} +\ProvidesExplFile{eb-tcolorbox.cfg}{2021/11/28}{1.41B} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \setexercise #1 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf index 9ef9511eae..45d99e1141 100644 Binary files a/macros/latex/contrib/easybook/easybook.pdf and b/macros/latex/contrib/easybook/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 1289434785..168e49d8e4 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -20,7 +20,7 @@ name = easybook, color-scheme = blue, title = EASYBOOK 使用手册, - version = v1.41A, + version = v1.41B, date = 2021/11/28, authors = 瞿毅, info = 排版简体中文学位论文和书籍, @@ -305,6 +305,8 @@ 使当前目录标题按照 \code{chapter} 章级别输出。 \opt{section}\Default! 使当前目录标题按照 \code{section} 节级别输出。 + \opt{none}\Default! + 使当前目录没有 \code{chapter} 或 \code{section} 级别的标题,仅输出目录原始内容。 \keyval-{multoc}{整数}\Default{2} 与 \module*{style} 模块的 \option{multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同类型目录的排版栏数。\meta{整数} 为目录栏数,不指定栏数值则默认为双栏。 \kvsplit{title}{中文目录标题,英文目录标题}\newline @@ -826,8 +828,8 @@ 图片、表格或代码目录标题下方的间距补偿,一般为正值,用于抵消目录中首行的额外垂直间距。路径为 \module*{figure}、\module*{table} 和 \module*{lstlisting},或者用 \module*{list} 路径统一设置。 \keyval-{main-voffset}{弹性长度} 文档主目录标题下方的间距补偿,一般为正值,用于抵消目录中首行的额外垂直间距。 - \keybool{line-align}\Default{true} - 引导线选项 \option{line-align} 可以使目录引导线右边对齐并与页码保持一定间隙,否则会与页码连接。 + \keybool{dotalign}\Default{true} + 引导线选项 \option{dotalign} 可以使目录引导线右边对齐并与页码保持一定间隙,否则会与页码连接。 \keyval-{tocafter-all}{距离命令}\Default{\cs*{hspace}\Carg{1em}} 统一设置所有级别在目录中标签与标题间的代码。 \keyval-{tocindent-all}{刚性长度} diff --git a/macros/latex/contrib/l3build/CHANGELOG.md b/macros/latex/contrib/l3build/CHANGELOG.md index 5834851339..edb288f555 100644 --- a/macros/latex/contrib/l3build/CHANGELOG.md +++ b/macros/latex/contrib/l3build/CHANGELOG.md @@ -7,8 +7,25 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2021-11-29] + +### Changed +- Documentation improvements +- Use `checkengines[1]` as the default for `stdengine` +- Add sanity check for `TEXMFHOME` value +- Double \ when writing the curl options, so that \ + does not need to be doubled in note and announcement texts. + +### Fixed +- Installation of files when using MiKTeX (see #125) +- Incorrect line in `manifest` target (see #195) +- Placement of PDF files in subdirectory locations (issue #209) +- Detection of engine-specific tlg files for non-standard LuaTeX based engines (issues #214) + ## [2021-11-24] +- Always typeset in `typesetdir` (fixes #210) + ## [2021-11-12] ### Changed @@ -521,7 +538,8 @@ this project uses date-based 'snapshot' version identifiers. - Rationalise short option names: removed `-d`, `-E`, `-r` - Target `cmdcheck`: specific to LaTeX kernel work -[Unreleased]: https://github.com/latex3/l3build/compare/2021-11-24...HEAD +[Unreleased]: https://github.com/latex3/l3build/compare/2021-11-29...HEAD +[2021-11-29]: https://github.com/latex3/l3build/compare/2021-11-24...2021-11-29 [2021-11-24]: https://github.com/latex3/l3build/compare/2021-11-12...2021-11-24 [2021-11-12]: https://github.com/latex3/l3build/compare/2021-08-28...2021-11-12 [2021-08-28]: https://github.com/latex3/l3build/compare/2021-08-27...2021-08-28 diff --git a/macros/latex/contrib/l3build/README.md b/macros/latex/contrib/l3build/README.md index de540162dd..ef9f7e9b24 100644 --- a/macros/latex/contrib/l3build/README.md +++ b/macros/latex/contrib/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX ================================================= -Release 2021-11-24 +Release 2021-11-29 Overview -------- diff --git a/macros/latex/contrib/l3build/l3build-arguments.lua b/macros/latex/contrib/l3build/l3build-arguments.lua index 470290db56..fdabb9d949 100644 --- a/macros/latex/contrib/l3build/l3build-arguments.lua +++ b/macros/latex/contrib/l3build/l3build-arguments.lua @@ -136,7 +136,7 @@ option_list = }, ["show-log-on-error"] = { - desc = "If 'halt-on-error' stops, show the full log of the failure", + desc = "Show the full log of the failure with 'halt-on-error'", type = "boolean" }, ["show-saves"] = diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua index 3e8089970a..249b22164a 100644 --- a/macros/latex/contrib/l3build/l3build-check.lua +++ b/macros/latex/contrib/l3build/l3build-check.lua @@ -684,9 +684,9 @@ function compare_tlg(difffile, tlgfile, logfile, cleanup, name, engine) local errorlevel local testname = name .. "." .. engine -- Do additional log formatting if the engine is LuaTeX, there is no - -- LuaTeX-specific .tlg file and the default engine is not LuaTeX + -- engine-specific .tlg file and the default engine is not LuaTeX if (match(engine,"^lua") or match(engine,"^harf")) - and not match(tlgfile, "%.luatex" .. "%" .. tlgext) + and not match(tlgfile, "%." .. engine .. "%" .. tlgext) and not match(stdengine,"^lua") then local lualogfile = logfile diff --git a/macros/latex/contrib/l3build/l3build-file-functions.lua b/macros/latex/contrib/l3build/l3build-file-functions.lua index 1fc9e1d47a..4aa591dd50 100644 --- a/macros/latex/contrib/l3build/l3build-file-functions.lua +++ b/macros/latex/contrib/l3build/l3build-file-functions.lua @@ -177,7 +177,7 @@ function abspath(path) if ok then local result = currentdir() chdir(oldpwd) - return escapepath(gsub(result, "\\", "/")) + return escapepath(gsub(gsub(result,"^\\\\%?\\",""), "\\", "/")) end error(msg) end diff --git a/macros/latex/contrib/l3build/l3build-help.lua b/macros/latex/contrib/l3build/l3build-help.lua index 2e7d776a73..137fc040c5 100644 --- a/macros/latex/contrib/l3build/l3build-help.lua +++ b/macros/latex/contrib/l3build/l3build-help.lua @@ -32,7 +32,7 @@ function version() "\n" .. "l3build: A testing and building system for LaTeX\n\n" .. "Release " .. release_date .. "\n" .. - "Copyright (C) 2014-2020 The LaTeX Project" + "Copyright (C) 2014-2021 The LaTeX Project" ) end diff --git a/macros/latex/contrib/l3build/l3build-install.lua b/macros/latex/contrib/l3build/l3build-install.lua index 21257aad0d..78fe2d4b2f 100644 --- a/macros/latex/contrib/l3build/l3build-install.lua +++ b/macros/latex/contrib/l3build/l3build-install.lua @@ -38,6 +38,10 @@ local insert = table.insert local function gethome() set_program("latex") local result = options["texmfhome"] or var_value("TEXMFHOME") + if not result or result == "" or match(result, os_pathsep) then + print("Ambiguous TEXMFHOME setting: please use the --texmfhome option") + os.exit(1) + end mkdir(result) return abspath(result) end diff --git a/macros/latex/contrib/l3build/l3build-manifest-setup.lua b/macros/latex/contrib/l3build/l3build-manifest-setup.lua index f7051dac5c..e74e667394 100644 --- a/macros/latex/contrib/l3build/l3build-manifest-setup.lua +++ b/macros/latex/contrib/l3build/l3build-manifest-setup.lua @@ -243,7 +243,7 @@ function manifest_write_opening(filehandle) filehandle:write("# Manifest for " .. module .. "\n\n") filehandle:write([[ This file is a listing of all files considered to be part of this package. -It is automatically generated with `texlua build.lua manifest`. +It is automatically generated with `l3build manifest`. ]]) end diff --git a/macros/latex/contrib/l3build/l3build-typesetting.lua b/macros/latex/contrib/l3build/l3build-typesetting.lua index 1d44a2bc08..d6d3981d7b 100644 --- a/macros/latex/contrib/l3build/l3build-typesetting.lua +++ b/macros/latex/contrib/l3build/l3build-typesetting.lua @@ -141,9 +141,7 @@ local function typesetpdf(file,dir) print(" ! Compilation failed") return errorlevel end - local pdfname = name .. pdfext - rm(docfiledir,pdfname) - return cp(pdfname,dir,docfiledir) + return 0 end function typeset(file,dir,exe) @@ -211,7 +209,8 @@ function doc(files) local done = {} for _,typesetfiles in ipairs({typesetdemofiles,typesetfiles}) do for _,glob in pairs(typesetfiles) do - for _,p in ipairs(tree(typesetdir,glob)) do + local destpath,globstub = splitpath(glob) + for _,p in ipairs(tree(typesetdir,globstub)) do local path,srcname = splitpath(p.cwd) local name = jobname(srcname) if not done[name] then @@ -233,6 +232,9 @@ function doc(files) return errorlevel else done[name] = true + local pdfname = jobname(srcname) .. pdfext + rm(pdfname,destpath) + cp(pdfname,path,destpath) end end end diff --git a/macros/latex/contrib/l3build/l3build-upload.lua b/macros/latex/contrib/l3build/l3build-upload.lua index be814ce5ae..4b3aa7aea6 100644 --- a/macros/latex/contrib/l3build/l3build-upload.lua +++ b/macros/latex/contrib/l3build/l3build-upload.lua @@ -319,6 +319,7 @@ function ctan_single_field(fname,fvalue,max,desc,mandatory) if (max > 0 and len(vs) > max) then error("The field " .. fname .. " is longer than " .. max) end + vs = vs:gsub('\\','\\\\') vs = vs:gsub('"','\\"') vs = vs:gsub('`','\\`') vs = vs:gsub('\n','\\n') diff --git a/macros/latex/contrib/l3build/l3build-variables.lua b/macros/latex/contrib/l3build/l3build-variables.lua index 9f2b25b8d2..d78c39c92f 100644 --- a/macros/latex/contrib/l3build/l3build-variables.lua +++ b/macros/latex/contrib/l3build/l3build-variables.lua @@ -133,7 +133,7 @@ if not string.find(status.banner,"2019") then {luatex = {binary="luahbtex",format = "lualatex-dev"}} end -stdengine = stdengine or "pdftex" +stdengine = stdengine or checkengines[1] or "pdftex" -- The tests themselves includetests = includetests or {"*"} diff --git a/macros/latex/contrib/l3build/l3build.1 b/macros/latex/contrib/l3build/l3build.1 index 5cf404fdf0..48aa33a92e 100644 --- a/macros/latex/contrib/l3build/l3build.1 +++ b/macros/latex/contrib/l3build/l3build.1 @@ -1,4 +1,4 @@ -.TH l3build 1 "2021-11-24" +.TH l3build 1 "2021-11-29" .SH NAME l3build \- Checking and building packages .SH SYNOPSIS diff --git a/macros/latex/contrib/l3build/l3build.dtx b/macros/latex/contrib/l3build/l3build.dtx index 88cb82e0d4..cf3ebd8cd5 100644 --- a/macros/latex/contrib/l3build/l3build.dtx +++ b/macros/latex/contrib/l3build/l3build.dtx @@ -236,7 +236,7 @@ % }^^A % } % -% \date{Released 2021-11-24} +% \date{Released 2021-11-29} % % \maketitle % \tableofcontents @@ -1525,7 +1525,8 @@ % \meta{package}|-ctan.curlopt|. This is then passed to curl using its % |--config| commandline option. (Using an intermediate file helps % keep \pkg{l3build} portable between systems using different -% commandline quoting conventions.) +% commandline quoting conventions. Any backslashes are doubled when writing +% to this file, so they do not need to be doubled in announcement and note texts.) % % By default the file is written into the current directory alongside % the zip file to be uploaded. You may wish to specify that this file @@ -1858,7 +1859,7 @@ % % \subsection{Typesetting functions} % -% All typetting functions return $0$ on a successful completion. +% All typesetting functions return $0$ on a successful completion. % % \begin{function}{biber()} % \begin{syntax} @@ -1905,7 +1906,7 @@ % when creating non-standard typesetting steps. % \end{function} % -% \subsection{Customising the target list} +% \subsection{Customising the target and option lists} % % The targets known to \pkg{l3build} are stored in the global table % |target_list|. Each entry should have at least a |func|, pointing to the @@ -1924,6 +1925,13 @@ % \end{itemize} % The functions |func|, |bundle_func| and |pre| must return 0 on success. % +% The list of options (switches) is controlled by the |option_list| table. +% The name of each entry in the table is the \enquote{long} version of the +% option. Each entry requires a |type|, one of |boolean|, |string| or +% |table|. As for targets, each entry should have a |desc| to construct +% the |help()|. It is also possible to provide a |short| name for the option: +% this should be a single letter. +% % \subsection{Customising the manifest file} % \label{sec:manifest} % diff --git a/macros/latex/contrib/l3build/l3build.lua b/macros/latex/contrib/l3build/l3build.lua index 993e5863a9..09a70942c6 100755 --- a/macros/latex/contrib/l3build/l3build.lua +++ b/macros/latex/contrib/l3build/l3build.lua @@ -25,7 +25,7 @@ for those people who are interested. --]] -- Version information -release_date = "2021-11-24" +release_date = "2021-11-29" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") diff --git a/macros/latex/contrib/l3build/l3build.pdf b/macros/latex/contrib/l3build/l3build.pdf index 06ff54ce90..a5795862b5 100644 Binary files a/macros/latex/contrib/l3build/l3build.pdf and b/macros/latex/contrib/l3build/l3build.pdf differ diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 078385c04e..bfb72cd7cf 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.66 +## Babel 3.67 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -8,9 +8,9 @@ is a set of ini files for about 250 languages. The latest stable version is available on . -Changes in version 3.66 are described in: +Changes in version 3.67 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-3.66.html +https://latex3.github.io/babel/news/whats-new-in-babel-3.67.html Apart from the manual, you can find information on some aspects of babel at: @@ -46,6 +46,11 @@ respective authors. ### Summary of Latest changes ``` +3.67 2021-11-29 + * \IfBabelSelectorTF executes code conditionally based on the + selector type (select, foreign, etc.). + * Transforms can be turned on and off based on Lua attributes. + 3.66 2021-11-08 * Transforms for Greek: - transliteration.omega diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index a8d8834ab3..666c1b1eef 100644 --- a/macros/latex/required/babel/base/babel.dtx +++ b/macros/latex/required/babel/base/babel.dtx @@ -32,7 +32,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2021/11/08 v3.66 The Babel package] +\ProvidesFile{babel.dtx}[2021/11/29 v3.67 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -687,6 +687,12 @@ This command can be used as environment, too. any language, it will get expanded as expected. \end{note} +\begin{note} + Bear in mind |\selectlanguage| can be automatically executed, in some + cases, in the auxiliary files, at heads and foots, and after the + environment |otherlanguage*|. +\end{note} + \begin{warning} If used inside braces there might be some non-local changes, as this would be roughly equivalent to: @@ -3101,6 +3107,16 @@ illustrates: \usepackage[magyar]{babel} \babelprovide[_transforms = digraphs.hyphen_]{magyar} \end{verbatim} +\New{3.67} Transforms predefined in the |ini| locale files can be made +attribute-dependent, too. When an attribute between parenthesis is +inserted subsequent transforms will be assigned to it (up to the list +end or another attribute). For example, +and provided an attribute called |\withsigmafinal| has been declared: +\begin{verbatim} +transforms = transliteration.omega (\withsigmafinal) sigma.final +\end{verbatim} +This applies |transliteration.omega| always, but |sigma.final| only when +|\withsigmafinal| is set. Here are the transforms currently predefined. (More to follow in future releases.) @@ -3164,19 +3180,29 @@ four characters: \textit{!?:;}\,.} danda or double danda if there is a space. For Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Tamil, Telugu.} -\trans{Arabic, Persian}{kashida.plain}{Experimental. A very simple and -basic transform for ‘plain’ Arabic fonts, which attempts to distribute -the tatwil as evenly as possible (starting at the end of the line). See -the news for version 3.59.} +\trans{Latin}{digraphs.ligatures}{Replaces the groups \textit{ae}, +\textit{AE}, \textit{oe}, \textit{OE} with \textit{æ}, \textit{Æ}, +\textit{œ}, \textit{Œ}.} + +\trans{Latin}{letters.noj}{Replaces \textit{j}, \textit{J} with +\textit{i}, \textit{I}.} + +\trans{Latin}{letters.uv}{Replaces \textit{v}, \textit{U} with +\textit{u}, \textit{V}.} \trans{Serbian}{transliteration.gajica}{(Note |serbian| with |ini| files refers to the Cyrillic script, which is here the target.) The standard system devised by Ljudevit Gaj.} +\trans{Arabic, Persian}{kashida.plain}{Experimental. A very simple and +basic transform for ‘plain’ Arabic fonts, which attempts to distribute +the tatwil as evenly as possible (starting at the end of the line). See +the news for version 3.59.} + \vspace{2mm}\hrule\nobreak \endgroup -\Describe{\babelposthyphenation}{\marg{hyphenrules-name}% +\Describe{\babelposthyphenation}{\oarg{options}\marg{hyphenrules-name}% \marg{lua-pattern}\marg{replacement}} \New{3.37-3.39} \textit{With \luatex{}} it is possible to define @@ -3202,6 +3228,18 @@ to \textit{ύ}, so that the diaeresis is removed. This feature is activated with the first |\babelposthyphenation| or |\babelprehyphenation|. +\New{3.67} With the optional argument you can associate a user defined +transform to an attribute, so that it’s active only when it’s set +(currently its attribute value is ignored). With this mechanism +transforms can be set or unset even in the middle of paragraphs, and +applied to single words. To define, set and unset the attribute, the +LaTeX kernel provides the macros |\newattribute|, |\setattribute| and +|\unsetattribute|. The following example shows how to use it, provided +an attribute named |\latinnoj| has been declared: +\begin{verbatim} + \babelprehyphenation[attribute=\latinnoj]{latin}{ J }{ string = I } +\end{verbatim} + See the \href{https://latex3.github.io/babel/guides/% non-standard-hyphenation-with-luatex.html}{\babel\ site} for a more @@ -3215,7 +3253,7 @@ applied, so you must take discretionaries into account). You are limited to substitutions as done by \textsf{lua}, although a future implementation may alternatively accept \textsf{lpeg}. -\Describe{\babelprehyphenation}{\marg{locale-name}% +\Describe{\babelprehyphenation}{\oarg{options}\marg{locale-name}% \marg{lua-pattern}\marg{replacement}} \New{3.44-3-52} It is similar to the latter, but (as its name implies) @@ -3226,6 +3264,8 @@ search patterns |=| has no special meaning, while \verb+|+ stands for an ordinary space; (3) in the replacement, discretionaries are not accepted. +See the description above for the optional argument. + This feature is activated with the first |\babelposthyphenation| or |\babelprehyphenation|. @@ -4867,6 +4907,21 @@ This macro is not intended to fix wrong mappings done by Unicode (which are the default in both \xetex{} and \luatex{}) -- if an assignment is wrong, fix it directly. +\subsection{Executing code based on the selector} + +\Describe{\IfBabelSelectorTF}{\marg{selectors}\marg{true}\marg{false}} + +\New{3.67} Sometimes a different setup is desired depending on the +selector used. Values allowed in \m{selectors} are |select|, |other|, +|foreign|, |other*| (and also |foreign*| for the tentative starred +version), and it can consist of a comma-separated list. For example: +\begin{verbatim} +\IfBabelSelectorTF{other, other*}{A}{B} +\end{verbatim} +is true with these two environment selectors. + +Its natural place of use is in hooks or in |\extras|\m{language}. + \section{Changes} \subsection{Changes in \babel\ version 3.9} @@ -5063,8 +5118,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<> -%<> +%<> +%<> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -6312,7 +6367,10 @@ help from Bernd Raichle, for which I am grateful. \newif\ifbbl@bcpallowed \bbl@bcpallowedfalse \def\select@language#1{% from set@, babel@aux + \ifx\bbl@selectorname\@empty + \def\bbl@selectorname{select}% % set hymap + \fi \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi % set name \edef\languagename{#1}% @@ -6453,7 +6511,8 @@ help from Bernd Raichle, for which I am grateful. \else \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax - \fi} + \fi + \let\bbl@selectorname\@empty} % \end{macrocode} % % \begin{environment}{otherlanguage} @@ -6468,6 +6527,7 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \long\def\otherlanguage#1{% + \def\bbl@selectorname{other}% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi \csname selectlanguage \endcsname{#1}% \ignorespaces} @@ -6493,6 +6553,7 @@ help from Bernd Raichle, for which I am grateful. \expandafter\def\csname otherlanguage*\endcsname{% \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}} \def\bbl@otherlanguage@s[#1]#2{% + \def\bbl@selectorname{other*}% \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi \def\bbl@select@opts{#1}% \foreign@language{#2}} @@ -6556,6 +6617,7 @@ help from Bernd Raichle, for which I am grateful. \@ifstar\bbl@foreign@s\bbl@foreign@x} \providecommand\bbl@foreign@x[3][]{% \begingroup + \def\bbl@selectorname{foreign}% \def\bbl@select@opts{#1}% \let\BabelText\@firstofone \bbl@beforeforeign @@ -6566,6 +6628,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \def\bbl@selectorname{foreign*}% \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% @@ -6612,7 +6675,20 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@switch\expandafter{\languagename}}} % \end{macrocode} % -% \end{macro} +% \end{macro} +% +% The following macro executes conditionally some code based on the +% selector being used. +% +% \begin{macrocode} +\def\IfBabelSelectorTF#1{% + \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} % % \begin{macro}{\bbl@patterns} % @@ -6781,7 +6857,6 @@ help from Bernd Raichle, for which I am grateful. \let\uselocale\setlocale \let\locale\setlocale \let\selectlocale\setlocale -\let\localename\setlocale \let\textlocale\setlocale \let\textlanguage\setlocale \let\languagetext\setlocale @@ -10680,14 +10755,15 @@ help from Bernd Raichle, for which I am grateful. \bbl@transforms\babelprehyphenation} \@namedef{bbl@inikv@transforms.posthyphenation}{% \bbl@transforms\babelposthyphenation} -\def\bbl@transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}} +\def\bbl@transforms@aux#1#2#3#4,#5\relax{% + #1[#2]{#3}{#4}{#5}} \begingroup % A hack. TODO. Don't require an specific order \catcode`\%=12 \catcode`\&=14 \gdef\bbl@transforms#1#2#3{&% \ifx\bbl@KVP@transforms\@nil\else \directlua{ - str = [==[#2]==] + local str = [==[#2]==] str = str:gsub('%.%d+%.%d+$', '') tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) }&% @@ -10695,10 +10771,23 @@ help from Bernd Raichle, for which I am grateful. \ifin@ \in@{.0$}{#2$}&% \ifin@ - \g@addto@macro\bbl@release@transforms{&% - \relax\bbl@transforms@aux#1{\languagename}{#3}}&% + \directlua{ + local str = string.match([[\bbl@KVP@transforms]], + '%(([^%(]-)%)[^%)]-\babeltempa') + if str == nil then + tex.print([[\def\string\babeltempb{}]]) + else + tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) + end + } + \toks@{#3}&% + \bbl@exp{&% + \\\g@addto@macro\\\bbl@release@transforms{&% + \relax &% Closes previous \bbl@transforms@aux + \\\bbl@transforms@aux + \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% \else - \g@addto@macro\bbl@release@transforms{, {#3}}&% + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi \fi} @@ -14212,13 +14301,21 @@ end \catcode`\~=12 \catcode`\%=12 \catcode`\&=14 -\gdef\babelposthyphenation#1#2#3{&% - \bbl@activateposthyphen +\gdef\babelprehyphenation{&% + \@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}} +\gdef\babelposthyphenation{&% + \@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}} +\gdef\bbl@settransform#1[#2]#3#4#5{&% + \ifcase#1 + \bbl@activateprehyphen + \else + \bbl@activateposthyphen + \fi \begingroup \def\babeltempa{\bbl@add@list\babeltempb}&% \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% + \def\bbl@tempa{#5}&% + \bbl@replace\bbl@tempa{,}{ ,}&% TODO. Ugly trick to preserve {} \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% \bbl@ifsamestring{##1}{remove}&% {\bbl@add@list\babeltempb{nil}}&% @@ -14226,82 +14323,68 @@ end local rep = [=[##1]=] rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + if #1 == 0 then + rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'space = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + 'spacefactor = {' .. '%2, %3, %4' .. '}') + rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) + else + rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) + end tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) }}}&% + \let\bbl@kv@attribute\relax + \let\bbl@kv@label\relax + \bbl@forkv{#2}{\bbl@csarg\edef{kv@##1}{##2}}&% + \ifx\bbl@kv@attribute\relax\else + \edef\bbl@kv@attribute{\expandafter\bbl@stripslash\bbl@kv@attribute}&% + \fi \directlua{ - local lbkr = Babel.linebreaking.replacements[1] + local lbkr = Babel.linebreaking.replacements[#1] local u = unicode.utf8 - local id = \the\csname l@#1\endcsname + local id, attr, label + if #1 == 0 then + id = \the\csname bbl@id@@#3\endcsname\space + else + id = \the\csname l@#3\endcsname\space + end + \ifx\bbl@kv@attribute\relax + attr = -1 + \else + attr = luatexbase.registernumber'\bbl@kv@attribute' + \fi + \ifx\bbl@kv@label\relax\else &% Same refs: + label = [==[\bbl@kv@label]==] + \fi &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') + local patt = string.gsub([==[#4]==], '%s', '') + if #1 == 0 then + patt = string.gsub(patt, '|', ' ') + end if not u.find(patt, '()', nil, true) then patt = '()' .. patt .. '()' end - patt = string.gsub(patt, '%(%)%^', '^()') - patt = string.gsub(patt, '%$%(%)', '()$') - patt = u.gsub(patt, '{(.)}', + if #1 == 1 then + patt = string.gsub(patt, '%(%)%^', '^()') + patt = string.gsub(patt, '%$%(%)', '()$') + end + patt = u.gsub(patt, '{(.)}', function (n) return '%' .. (tonumber(n) and (tonumber(n)+1) or n) end) patt = u.gsub(patt, '{(%x%x%x%x+)}', function (n) return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') - end) + end) lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) + table.insert(lbkr[id], + { label=label, attr=attr, pattern=patt, replace={\babeltempb} }) }&% \endgroup} -% TODO. Copypaste pattern. -\gdef\babelprehyphenation#1#2#3{&% - \bbl@activateprehyphen - \begingroup - \def\babeltempa{\bbl@add@list\babeltempb}&% - \let\babeltempb\@empty - \def\bbl@tempa{#3}&% TODO. Ugly trick to preserve {}: - \bbl@replace\bbl@tempa{,}{ ,}&% - \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&% - \bbl@ifsamestring{##1}{remove}&% - {\bbl@add@list\babeltempb{nil}}&% - {\directlua{ - local rep = [=[##1]=] - rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') - rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') - rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) - rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'space = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', - 'spacefactor = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) - tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) - }}}&% - \directlua{ - local lbkr = Babel.linebreaking.replacements[0] - local u = unicode.utf8 - local id = \the\csname bbl@id@@#1\endcsname - &% Convert pattern: - local patt = string.gsub([==[#2]==], '%s', '') - local patt = string.gsub(patt, '|', ' ') - if not u.find(patt, '()', nil, true) then - patt = '()' .. patt .. '()' - end - &% patt = string.gsub(patt, '%(%)%^', '^()') - &% patt = string.gsub(patt, '([^%%])%$%(%)', '%1()$') - patt = u.gsub(patt, '{(.)}', - function (n) - return '%' .. (tonumber(n) and (tonumber(n)+1) or n) - end) - patt = u.gsub(patt, '{(%x%x%x%x+)}', - function (n) - return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1') - end) - lbkr[id] = lbkr[id] or {} - table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) - }&% - \endgroup} \endgroup \def\bbl@activateposthyphen{% \let\bbl@activateposthyphen\relax @@ -14867,6 +14950,7 @@ function Babel.hyphenate_replace(head, mode) for k=1, #lbkr[lang] do local p = lbkr[lang][k].pattern local r = lbkr[lang][k].replace + local attr = lbkr[lang][k].attr or -1 if Babel.debug then print('*****', p, mode) @@ -14911,8 +14995,15 @@ function Babel.hyphenate_replace(head, mode) local sc = first-1 -- Used below, too local data_nodes = {} + local enabled = true for q = 1, last-first+1 do data_nodes[q] = w_nodes[sc+q] + if enabled + and attr > -1 + and not node.has_attribute(data_nodes[q], attr) + then + enabled = false + end end -- This loop traverses the matched substring and takes the @@ -14956,7 +15047,7 @@ function Babel.hyphenate_replace(head, mode) step = crep.step or 0 end - if crep and next(crep) == nil then -- = {} + if (not enabled) or (crep and next(crep) == nil) then -- = {} last_match = save_last -- Optimization goto next diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 387ab64241..1be32b20ba 100644 --- a/macros/latex/required/babel/base/babel.ins +++ b/macros/latex/required/babel/base/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{2021/11/08} +\def\filedate{2021/11/29} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf index 9d0a7963cf..bf2f6910ca 100644 Binary files a/macros/latex/required/babel/base/babel.pdf and b/macros/latex/required/babel/base/babel.pdf differ diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index 5936dfafa1..0b0d1c2af7 100644 --- a/macros/latex/required/babel/base/bbcompat.dtx +++ b/macros/latex/required/babel/base/bbcompat.dtx @@ -30,7 +30,7 @@ % % \iffalse %<*dtx> -\ProvidesFile{bbcompat.dtx}[2021/11/08 v3.66] +\ProvidesFile{bbcompat.dtx}[2021/11/29 v3.67] % % %% File 'bbcompat.dtx' -- cgit v1.2.3