\Ifisdimension and \Ifisglue fail for unitless numbers
KOMA-Script is a bundle of versatile LaTeX classes and packages
Brought to you by:
kohm
When \Ifisglue (of \Ifisdimension) is invoked with a number without a unit (e.g. 42) then it fails with
! Undefined control sequence.
\@nnil ->\@nil
I'm not sure what the result should be (the code looks like pt should be assumed by default, but it would also make sense if TeX's dimension/glue syntax is assumed and a unit is required) but it shouldn't fail.
MWE:
\documentclass{scrbook}
\makeatletter
\Ifisdimension{42}{%
\typeout{42 is a dimension}%
}{%
\typeout{42 is not a dimension}%
}
\Ifisglue{42}{%
\typeout{42 is a glue}%
}{%
\typeout{42 is not a glue}%
}
\makeatother
\stop
Log:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/dev) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./mwe.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-01-12>
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2021/11/13 v3.35 KOMA-Script document class (book)
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrlfile.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrlogo.sty)))
(/usr/local/texlive/2021/texmf-dist/tex/latex/graphics/keyval.sty)))
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2021/texmf-dist/tex/latex/koma-script/typearea.sty))
! Undefined control sequence.
\@nnil ->\@nil
l.3 \Ifisdimension{42}
{%
? X
No pages of output.
Transcript written on mwe.log.
The last lines after adding \tracingall show
~....\scr@TestDimensionAssignTillNil #1\@nil ->\begingroup \afterassignment \sc
r@AfterEndGroupIfArgIsRelaxTillptNnil \@tempdima =#1pt\@nnil
#1<-42
{\begingroup}
{entering semi simple group (level 1) at line 4}
{\afterassignment}
{\dimen46}
~..\@nnil ->\@nil
{undefined}
! Undefined control sequence.
\@nnil ->\@nil
l.4 \Ifisdimension{42}
{%
The documentation says:
a missing unit is the same as an unknown unit.
Last edit: Markus Kohm 2022-05-16
Fixed by clarification in the documentation. See [r3782].
Related
Commit: [r3782]