Missing hyphenation patterns are not detected when babel loads the language from its .ini file (\babelprovide, provide=*)
@cderv がすでに取り組んでいます。
2026年10月16日 から。
評価
調査の方向性
Start with check_babel() and detect_hyphen() in R/latex.R, then compare their handling of the reported .log lines with the existing \@nopatterns warning. Reproduce the supplied \babelprovide example without hyphen-spanish installed and inspect the log; done means detecting the missing patterns and identifying the correct package to install. Open linked pull requests and related issues show this work is already under way.
索引モデルが issue の本文から書いたものです。
説明
When babel loads a language from its .ini file instead of an .ldf file, missing hyphenation patterns produce no warning at all. The document compiles with the patterns of the current language (usually English), and check_babel() has nothing to match.
Tested with TinyTeX (TeX Live 2026, babel v26.13) without hyphen-spanish installed, and the functions from main run on the resulting .log.
\documentclass{article}
\usepackage[english]{babel}
\babelprovide[import]{spanish}
\begin{document}
\foreignlanguage{spanish}{Hola}
\end{document}
This compiles (exit 0) with pdflatex, xelatex and lualatex. The only trace in the log is an Info line:
Package babel Info: Importing data for 'spanish'
(babel) from babel-es.ini. Reported on input line 3.
Package babel Info: Hyphen rules for 'spanish' set to \l@english
(babel) (\language0). Reported on input line 3.
The same happens without any \babelprovide in the document, using the provide=* option:
\documentclass[spanish]{article}
\usepackage[provide=*]{babel}
\begin{document}
Hola
\end{document}
For both logs, check_babel() returns FALSE and detect_hyphen() returns nothing.
https://github.com/rstudio/tinytex/blob/872c51e3e40b6b37a156c89cd5f4b15d200c773f/R/latex.R#L427-L431
This is how babel works on purpose. When a language is set up from its .ini file, babel looks for patterns with the hyphenrules key, then with the hyphenrules value of the .ini file, and if none is found it uses the current \language (from \bbl@provide@hyphens in babel.sty v26.13):
\bbl@ifunset{l@#1}%
{\ifnum\@tempcnta=\m@ne
\bbl@carg\adddialect{l@#1}\language
\else
\bbl@carg\adddialect{l@#1}\@tempcnta
\fi}%
\adddialect writes the Hyphen rules for ... set to ... Info line, and nothing else. The .ldf files use \@nopatterns instead, which gives the No hyphenation patterns were preloaded warning that check_babel() already handles.
We can't just match Hyphen rules for 'X' set to \l@english, because the same Info line is in every log for the dialects defined in english.ldf:
Package babel Info: Hyphen rules for 'canadian' set to \l@english
(babel) (\language0). Reported on input line 102.
Package babel Info: Hyphen rules for 'australian' set to \l@ukenglish
(babel) (\language6). Reported on input line 105.
The fallback line comes right after the Importing ... data for 'X' from babel-<code>.ini line for the same language, while the dialect lines don't. We could use this pair to detect the missing patterns, but the pair is also there when the patterns are found under another name. With \usepackage[english]{babel} and \babelprovide[import]{<name>}, and only hyphen-english, hyphen-french and hyphen-german installed:
Package babel Info: Importing data for 'canadianfrench'
(babel) from babel-fr-CA.ini. Reported on input line 3.
Package babel Info: Hyphen rules for 'canadianfrench' set to \l@french
(babel) (\language8). Reported on input line 3.
Package babel Info: Importing data for 'austrian'
(babel) from babel-de-AT.ini. Reported on input line 3.
Package babel Info: Hyphen rules for 'austrian' set to \l@ngerman-x-2024-02-28
(babel) (\language5). Reported on input line 3.
Package babel Info: Importing data for 'mexican'
(babel) from babel-es-MX.ini. Reported on input line 3.
Package babel Info: Hyphen rules for 'mexican' set to \l@english
(babel) (\language0). Reported on input line 3.
Only the last one is missing patterns (hyphen-spanish). So two questions remain I think:
- How to tell the fallback from a found pattern ? The target being the current
\language(here\l@english, the main language) seems the only difference in the log. - Which package to install ? The name is a babel locale name (
mexican), not a name fromlanguage.dat, sohyphen_pkgs()and the map from #517 would givehyphen-mexican, which doesn't exist. Thehyphenrulesvalue in the.inifiles could be a better source for this map.
Quarto also has a check for Hyphen rules for 'X' set to \l@nil (added for quarto-dev/quarto-cli#8684) that tinytex doesn't have, and it does not catch the case above. It would be good to have one detection in both.
Related: #516, #517, #518
- 主要言語
- R
- スター
- 1.2k
- フォーク
- 128
- 平均マージ
- 1時間 44分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rstudio/tinytex のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
[FR] Add `cancel` package to TinyTeX bundle再び着手できるかも @cderv が 290 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
rstudio/tinytex の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
philchalmers/mirt#287 ·
-
querySqlToAndromeda(appendToTable = TRUE) errors with "This ResultSet is closed" after appendingオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OHDSI/DatabaseConnector#346 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100