Well, you define less levels than you need.

 

Try this :

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\definesectionlevels

   [default]

   [

    %chapter, % uncomment this line to make it work

   section, subsection, subsubsection, subsubsubsection, subsubsubsubsection]

 

\starttext

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

Interestingly, this will also work, although (if I’m counting correctly) there are still only 5 levels defined, but 6 are used (just like above):

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

\definesectionlevels

   [default]

   [

    %chapter, % uncomment this line to make it work

   section, subsection, subsubsection, subsubsubsection, subsubsubsubsection]

 

\starttext

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

%\startsectionlevel

%\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stoptext

 

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Von: Sylvain Hubert <champignoom@gmail.com>
Gesendet: Dienstag, 28. Mai 2024 10:48
An: mailing list for ConTeXt users <ntg-context@ntg.nl>
Betreff: [NTG-context] lua error in `strc-lev.lua`

 

ConTeXt LMTX version: 2024.05.27 18:16

 

Reproducible example:

 

\definesectionlevels

   [default]

   [section, subsection, subsubsection, subsubsubsection, subsubsubsubsection]

 

\starttext

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\startsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stopsectionlevel

\stoptext

 

lua error       > lua error on line 19 in file ./input.tex:

registered function call [969]: ...mtx/tex/texmf-context/tex/context/base/mkiv/strc-lev.lua:75: attempt to index a nil value (field '?')
stack traceback:
        ...mtx/tex/texmf-context/tex/context/base/mkiv/strc-lev.lua:75: in function <...mtx/tex/texmf-context/tex/context/base/mkiv/strc-lev.lua:66>
        (...tail calls...)