Hyphenation detection misses the documented dehyph-exptl usage, and maps Swiss German (1901) to hyphen-swiss
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start in R/latex.R, where check_babel(), detect_hyphen() and hyphen_pkgs() match babel and hyphsubst log messages, and add patterns for the two dehyph-exptl messages quoted in the issue. For the Swiss German case, the fix depends on a maintainer choice: either map swiss to hyphen-german in hyphen_pkgs() (outside the generated R/hyphen.R), or map the full babel-german descriptions. Done means the new log strings are matched in tests, and the maintainer has confirmed which mapping to use.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up to #516 and #517. While porting the same logic to quarto-cli (quarto-dev/quarto-cli#15035), I tested the hyphenation detection against real LaTeX logs and found two cases that don't work.
All tests below use TinyTeX without dehyph-exptl installed, xelatex, and the functions from main (check_babel(), detect_hyphen(), hyphen_pkgs()) run on the resulting .log.
1. The documented ways to use dehyph-exptl are not detected
#517 maps ngerman-x-latest and the other pinned names to dehyph-exptl, but this only works when babel raises You haven't defined the language 'ngerman-x-latest' yet. This happens with \selectlanguage{ngerman-x-latest} or \begin{hyphenrules}{ngerman-x-latest}, which is not how the dehyph-exptl documentation (section 2.2.2 of dehyph-exptl.pdf) says to use these patterns. It documents two ways, and neither is detected.
With babel:
\documentclass{article}
\usepackage[ngerman]{babel}
\babelprovide[hyphenrules=ngerman-x-latest]{ngerman}
\begin{document}
Silbentrennung Donaudampfschifffahrtsgesellschaft.
\end{document}
This compiles, but with the default patterns, and only gives a warning:
Package babel Warning: Requested 'hyphenrules' for 'ngerman' not found:
(babel) ngerman-x-latest.
(babel) Using the default value. Reported on input line 3.
With hyphsubst:
\documentclass{article}
\usepackage[ngerman=ngerman-x-latest]{hyphsubst}
\usepackage[ngerman]{babel}
\begin{document}
Silbentrennung Donaudampfschifffahrtsgesellschaft.
\end{document}
This one fails:
! Package hyphsubst Error: Unknown pattern `ngerman-x-latest'.
For both logs, check_babel() returns FALSE and detect_hyphen() returns nothing, so nothing is installed.
https://github.com/rstudio/tinytex/blob/872c51e3e40b6b37a156c89cd5f4b15d200c773f/R/latex.R#L427-L431
https://github.com/rstudio/tinytex/blob/872c51e3e40b6b37a156c89cd5f4b15d200c773f/R/latex.R#L454-L458
We could match these two messages and pass the name through hyphen_pkgs() like the others. The hyphsubst error is fatal, so it would go with detect_hyphen(). The babel warning doesn't fail the compilation, so it would go with check_babel().
I have not checked yet that installing dehyph-exptl is enough for these documents to then use the patterns (the format needs to be rebuilt with the new language.dat entries).
2. Swiss German with the 1901 spelling gives hyphen-swiss
hyphen_pkgs() keeps only the first word of the language name, for messages like the language `German (current orthography)' .
https://github.com/rstudio/tinytex/blob/872c51e3e40b6b37a156c89cd5f4b15d200c773f/R/latex.R#L434-L447
These descriptions come from babel-german, which passes a description instead of a pattern name to \@nopatterns. All of them start with German, except the ones for Swiss German with the 1901 spelling, in babel-german.def:
\@nopatterns{Swiss Standard German (1901 orthography) and German (1901 orthography)}
...
\@nopatterns{Swiss Standard German (1901 orthography),
falling back to German (1901 orthography)}
So with this warning
Package babel Warning: No hyphenation patterns were preloaded for
(babel) the language 'Swiss Standard German (1901 orthography) and German (1901 orthography)' into the format.
check_babel() tries to install hyphen-swiss, which doesn't exist in TeX Live. The swissgerman patterns are in hyphen-german.
We could map swiss to hyphen-german in hyphen_pkgs(), or map the full babel-german descriptions to their package instead of keeping the first word. The first way is simpler, but swiss is not a name from texlive.tlpdb, so it would need to stay outside the generated R/hyphen.R.
Once this is decided here, I'll follow the same logic in quarto-cli.
- Lingua principale
- R
- Stelle
- 1.2k
- Fork
- 128
- Merge medio
- 1h 44m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rstudio/tinytex
-
Missing hyphenation patterns are not detected when babel loads the language from its .ini file (\babelprovide, provide=*)Forse già presa @cderv l’ha presa 7 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
question
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
[FR] Add `cancel` package to TinyTeX bundleForse di nuovo libera @cderv l’ha presa 290 giorni fa e non c’è nessuna pull request aperta. Aperta
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
Tutte le issue di rstudio/tinytex
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
make sure .Random.seed existsForse già presa @topepo l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
tidymodels/tune#1211 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PecanProject/pecan#4183 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Rate metrics miscompute list and tuple labelsForse già presa @AryanRG l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Trusted-AI/AIF360#582 ·