latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
123 stars 34 forks source link

TL2024 + latex or pdflatex + norsk = “! Missing number, treated as zero.” #289

Closed AlMa1r closed 3 months ago

AlMa1r commented 3 months ago

Running latex from TeX Live 2024 on

\documentclass{article}
\usepackage[norsk]{babel}
\begin{document}
\end{document}

yields

This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./mwe.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/babel.sty
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/txtbabel.de
f)
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norsk
.ldf
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norwe
gian.ldf
! Missing number, treated as zero.
<to be read again> 
                   \l@norsk 
l.45   \bbl@tempa\l@norsk

? Q
OK, entering \batchmode

on the console. No other warnings or errors are noted. The log file contains

This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=latex 2024.3.14)  15 MAR 2024 01:18
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**mwe
(./mwe.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
)
\c@part=\count188
\c@section=\count189
\c@subsection=\count190
\c@subsubsection=\count191
\c@paragraph=\count192
\c@subparagraph=\count193
\c@figure=\count194
\c@table=\count195
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
)
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/babel.sty
Package: babel 2024/02/07 v24.2 The Babel package
\babel@savecnt=\count196
\U@D=\dimen141
\l@unhyphenated=\language5

(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/txtbabel.de
f)
\bbl@readstream=\read2
\bbl@dirlevel=\count197

(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norsk
.ldf
Language: norsk 2024/01/26 v2.0j Norwegian support from the babel system

(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norwe
gian.ldf
Language: norwegian 2024/01/26 v2.0j Norwegian support from the babel system

! Missing number, treated as zero.
<to be read again> 
                   \l@norsk 
l.45   \bbl@tempa\l@norsk

? Q
OK, entering \batchmode...

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.45   \bbl@tempa\l@norsk

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

Package babel Info: Hyphen rules for 'norsk' set to \l@english
(babel)             (\language0). Reported on input line 45.
Package babel Info: Making " an active character on input line 113.
)))
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/locale/no/b
abel-norsk.tex
Package babel Info: Importing font and identification data for norsk
(babel)             from babel-no.ini. Reported on input line 11.
)
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend
-dvips.def
File: l3backend-dvips.def 2024-02-20 L3 backend support: dvips
\l__pdf_internal_box=\box51
\g__pdf_backend_object_int=\count198
\l__pdf_backend_content_box=\box52
\l__pdf_backend_model_box=\box53
\g__pdf_backend_annotation_int=\count199
\g__pdf_backend_link_int=\count266
\g__pdf_backend_link_sf_int=\count267
) (./mwe.aux)
\openout1 = `mwe.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
 [1

] (./mwe.aux)
 ***********
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
 ***********
 ) 
Here is how much of TeX's memory you used:
 1521 strings out of 476077
 28488 string characters out of 5791457
 1926184 words of memory out of 5000000
 23691 multiletter control sequences out of 15000+600000
 558069 words of font info for 36 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 43i,5n,52p,152b,140s stack positions out of 10000i,1000n,20000p,200000b,200000s

Output written on mwe.dvi (1 page, 248 bytes).

The same error message (and slightly deviating printout and log) are generated when pdflatex instead of latex is run. A bug? Any package I might be missing?

jbezos commented 3 months ago

I’ve just installed TeXLive 2024 and there are no errors with pdflatex, xelatex or lualatex. Please, post the log file.

AlMa1r commented 3 months ago

@jbezos Thank you. I've inserted the full output and log into the original post. Try the minimal plain+latex TeX Live 2024 installation and add packages then. (Probably the log or the console should contain a complaint about some missing package, but they don't.)

davidcarlisle commented 3 months ago

Your log shows \l@unhyphenated=\language5 and

! Missing number, treated as zero.
<to be read again> 
                   \l@norsk

whereas mine (with a full tl2024 install) shows no error and

\l@unhyphenated=\language89

so the difference is that I have many more languages installed in particular norsk so I assume

tlmgr install babel-norsk

will fix it at your site although (@jbezos) I guess it could give a higher level missing language error at some point rather than hitting a low level tex missing number.

davidcarlisle commented 3 months ago

actually your log has (/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norsk.ldf so I think babel-norsk is installed but the format has not been rebuilt, in which case

fmtutil-sys --all

should fix things.

u-fischer commented 3 months ago

or the creation of language.dat etc failed, in this case tlmgr generate language and then rebuilding the formats could be needed.

AlMa1r commented 3 months ago

@davidcarlisle @u-fischer Thank you for looking into this. tlmgr install babel-norsk said that the package was installed:

tlmgr: package repository https://ctan.space-pro.be/tex-archive/systems/texlive/tlnet (verified)
tlmgr install: package already present: babel-norsk

Then I ran fmtutil-sys --all. It took some minutes and produced lots of output on the console, but the bug still persisted. As for your last suggestion:

$ tlmgr generate language
To make the newly-generated language.dat.lua take effect, run fmtutil-sys --byhyphen /home/username/usr/local/texlive/2024/texmf-var/tex/generic/config/language.dat.lua.
To make the newly-generated language.dat take effect, run fmtutil-sys --byhyphen /home/username/usr/local/texlive/2024/texmf-var/tex/generic/config/language.dat.
To make the newly-generated language.def take effect, run fmtutil-sys --byhyphen /home/username/usr/local/texlive/2024/texmf-var/tex/generic/config/language.def.

Running these three fmtutil-sys --byhyphen … commands followed by fmtutil-sys --all produced lots of output on the console, but even after them the final result was the same:

$ latex mwe
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./mwe.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/home/username/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/babel.sty
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel/txtbabel.de
f)
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norsk
.ldf
(/home/username/usr/local/texlive/2024/texmf-dist/tex/generic/babel-norsk/norwe
gian.ldf
! Missing number, treated as zero.
<to be read again> 
                   \l@norsk 
l.45   \bbl@tempa\l@norsk

? Q
OK, entering \batchmode

Any other ideas? I could clean up and start from TeX Live 2024 plain+latex again if this helps.

davidcarlisle commented 3 months ago

what does kpsewhich --engine=pdftex pdflatex.fmt show? it should be

/home/username/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt

also as Ulrike says check language'dat which should have a block that looks like

% from hyphen-norwegian:
bokmal loadhyph-nb.tex
=norwegian
=norsk
nynorsk loadhyph-nn.tex

in

/home/username/usr/local/texlive/2024/texmf-var/tex/generic/config/language.dat

AlMa1r commented 3 months ago

@davidcarlisle

$ kpsewhich --engine=pdftex pdflatex.fmt
/home/username/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt
$ cat ~/usr/local/texlive/2024/texmf-var/tex/generic/config/language.dat
% Generated by /home/username/usr/local/texlive/2024/bin/x86_64-linux/tlmgr on Fri Mar 15 10:44:07 2024
% $Id: language.us 68317 2023-09-18 21:21:09Z karl $
% language.us (and the start of language.dat)
% - initial hyphenation patterns.
% Created long ago by Sebastian Rahtz and others.  Public domain.
%
% DO NOT EDIT THIS FILE (language.dat)! It is generated by tlmgr.
%
% To enable or disable languages, there are two options:
% - if the language is provided by a TeX Live package, you can
%   (un)install the corresponding package using tlmgr. Examples:
%     tlmgr install hyphen-french
%     tlmgr remove hyphen-english
% - in any case, you can use local configuration files:
%     TEXMFLOCAL/tex/generic/config/language-local.dat
%     TEXMFLOCAL/tex/generic/config/language-local.dat.lua
%     TEXMFLOCAL/tex/generic/config/language-local.def
%   See the tlmgr documentation (try `man tlmgr' or `texdoc tlmgr'),
%   section "generate" for details.
%
% The preferred comment for actual language lines in language.dat and
% language.us is %!; do not use %! for normal comments.  This
% is to be able to separate textual comments from commented-out language
% in such a way that automatic parsing by programs is possible, so that
% we can present the user with `all possible languages'.
% 
% We must keep english as the default (first) here, and let it refer to
% hyphen.tex (not anything else), and do not change the hyphen.tex file,
% or name some other file hyphen.tex.  In other words, hyphen.tex must
% remain the original file from Knuth, and it must be \language0.  This
% is one important aspect of ensuring that the original, frozen TeX
% always produces the same line and page breaks.
% 
% The babel system allows you to easily change the active language for
% LaTeX. For more information, see the documentation in
% texmf-dist/doc/generic/babel/.  ConTeXt has its own language support too.
% 
english hyphen.tex % do not change!
=usenglish
=USenglish
=american
%
% ushyphmax.tex, on the other hand, includes Gerard Kuiken's additional
% patterns; it is not frozen.  It is provided by the hyphen-english
% package, not listed here.  Also, in hyph-utf8 and current TL, it has
% been renamed to hyph-en-us.tex, along with other *hyph-en-us.* files.
%
% FYI, ushyph.tex is Dr. Kuiken's smaller set of patterns; with today's
% large memories, there is no reason to use it, and we don't list it here.
% ushyph1.tex is another (historical) name for hyphen.tex.
% ushyph2.tex is another (historical) name for ushyph.tex.
% 
% dumylang was invented by Bernard Gaulle for testing, many years ago,
% when portable filenames could be at most eight characters long, hence
% the single m in "dumyhyph.tex". --karl
% 
dumylang    dumyhyph.tex    % for testing a new language.
nohyphenation   zerohyph.tex    % a language with no patterns at all.

% temp until hyph-utf8 is updated, per message from Javier,
% https://tug.org/pipermail/tex-live/2023-September/049478.html
vietnamese zerohyph.tex
hebrew zerohyph.tex
% (end of static file language.us)

Next, I tried out tlmgr install hyphen-norwegian and then ran latex mwe (where mwe.tex contains the source from the original post) again. Now, I got no errors. So probably the original error message should be indeed, well, actionable or at least more informative without incurring the need to invoke the LaTeX gurus such as you or Ulrike here. Or the package babel-norsk should perhaps depend on hyphen-norwegian (or hyphen-norsk if only it existed).

jbezos commented 3 months ago

It’s a bug. If the language is not defined in language.dat it must fallback to \language0. I’ll try to fix in a few days.

FrankMittelbach commented 3 months ago

It’s a bug. If the language is not defined in language.dat it must fallback to \language0. I’ll try to fix in a few days.

Javier, one can argue that this should be done this way as a compatibility setting, but in my opinion it is the wrong fallback and instead it would better fall back to the unhyphened language (whatever number that is 1 perhaps).

jbezos commented 3 months ago

@FrankMittelbach Agreed, but, as you said, it’s for compatibility.

FrankMittelbach commented 3 months ago

well, yes, but I think compatibility to error handling (and a missing language is an error) is of lesser importance to do a good error handling, and in my opinion if I send a document to a different site and that sight is missing the languages the document uses it is better to have no hyphenation than to have wrong hyphenation suddenly.

jbezos commented 3 months ago

🤔 Compatibility has been one of my main concerns, but, to be honest, not so much anymore. Interestingly, this only affects languages in the Latin script, because \language0 only hyphenates words in the ASCII range, so languages in the Cyrillic script (there are about 20 in babel) behave in practice as nohyphenation. The logic for hyphenation rules is hardcoded in the ldf files 🙁, which is an obstacle, but I don't think it’s insurmountable.

davidcarlisle commented 3 months ago

while babel picking up this case better would be good, it seems weird that a user can get in that position, shouldn't at the texlive level tlmgr install babel-whatever also do tlmgr install hyphen-something with a suitable dependency list setup?

jbezos commented 3 months ago

I’ve just submitted a bug fix to CTAN.