
Hi, LuaTeX team, I'm writing this email to append the complete steps about how I found the problem mentioned in the forwarded email. I want to take a number after a macro and use the content after number. For example, scale the baseline skip and then output the later content: \begingroup\endlinechar=-1 \newcount\scalecount \long\gdef\scaleBase{ \afterassignment\scaleBaseWithFactor \scalecount= } \long\gdef\scaleBaseWithFactor#1{{ \divide\baselineskip by 1000 \multiply\baselineskip by \scalecount #1 }} \endgroup \scaleBase1200 {line1\par line2\par line3} \bye This will show a much baseline skip between line1 and line2. I want to take \magstep values as parameter. But \scaleBase\magstep1{line1\par line2\par line3} did not work as expected. I found this is because \magstep add a \relax at the end to split itself from possible next number: $ luatex This is LuaTeX, Version 1.22.0 (TeX Live 2026/dev/Arch Linux) restricted system commands enabled. **\relax *\show\magstep
\magstep=macro: #1->\ifcase #1 \@m \or 1200\or 1440\or 1728\or 2074\or 2488\fi \relax . <*> \show\magstep
? So I add more 1 macro to strip \relax: \begingroup\endlinechar=-1 \newcount\scalecount \long\gdef\scaleBase#1{ %>>>>>>>>> \ifx#1\magstep \afterassignment\scaleBaseWithmagstep \else %<<<<<<<<< \afterassignment\scaleBaseWithFactor \fi%<<<<<<<<< \scalecount=#1 } %>>>>>>>>> \long\gdef\scaleBaseWithmagstep#1\relax#2{ \scaleBaseWithFactor{#2} } %<<<<<<<<< \long\gdef\scaleBaseWithFactor#1{{ \divide\baselineskip by 1000 \multiply\baselineskip by \scalecount #1 }} \endgroup \scaleBase\magstep1%<<<<<<<<< {line1\par line2\par line3} \bye This works fine for \magstep except \magstep0. \scaleBase\magstep0 make a warning: (\end occurred inside a group at level 1) in the log. In other more complecated cases, it report (\end occurred when \ifcase but not inside a group. So I checked the place sending \magstep. I checked this by \show#1 in \scaleBaseWithmagstep: \begingroup\endlinechar=-1 \newcount\scalecount \long\gdef\scaleBase#1{ \ifx#1\magstep \afterassignment\scaleBaseWithmagstep \else \afterassignment\scaleBaseWithFactor \fi \scalecount=#1 } \long\gdef\scaleBaseWithmagstep#1\relax#2{ \show#1%<<<<<<<<< \scaleBaseWithFactor{#2} } \long\gdef\scaleBaseWithFactor#1{{ \divide\baselineskip by 1000 \multiply\baselineskip by \scalecount #1 }} \endgroup \scaleBase\magstep1 {line1\par line2\par line3} \bye And then \scaleBase\magstep1 will \show the definition of \scaleBaseWithFactor, which may mean there is nothing before \relax, just strip \relax as expected. While \scaleBase\magstep0 report: :!f=tmp sh -c 'luatex $f.tex' This is LuaTeX, Version 1.22.0 (TeX Live 2026/dev/Arch Linux) restricted system commands enabled. (./tmp.tex
\or=\or. <argument> \or 1200\or 1440\or 1728\or 2074\or 2488\fi \scaleBaseWithmagstep #1\relax #2->\show #1 \scaleBaseWithFactor {#2} l.27 \scaleBase\magstep0{}
apply \or before 1200 to \show.
It seems that:
* For \magstep1
* \afterassignment insert \scaleBaseWithmagstep after the full \ifcase
* For \magstep0
* \afterassignment insert \scaleBaseWithmagstep before the 1st \or.
________________________________
From: li lu
Sent: Sunday, June 8, 2025 3:27 PM
To: dev-luatex@ntg.nl