[NTG-context] Reference prefix for sections is ignored

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Thu May 12 21:55:51 CEST 2022


Hi,

the automatic reference prefix for section etc. with the setup

     \setuphead[chapter][referenceprefix=+]

doesn't work anymore (broken since a while).


The following patch for strc-sec.mkxl fixes the missing prefix:

%%%% begin fix
\def\strc_sectioning_set_reference_prefix
   {\ifempty\currentstructurereferenceprefix
      % nothing
\orelse\ifx\currentstructurereferenceprefix\m_strc_references_prefix_yes
-    \global\advance\prefixcounter \plusone % temp here
-    \setupglobalreferenceprefix[\the\prefixcounter]%
+    \ifempty\currentstructurereference
+      \global\advance\prefixcounter \plusone % temp here
+      \setupglobalreferenceprefix[\the\prefixcounter]%
+    \else
+      \setupglobalreferenceprefix[\currentstructurereference]%
+    \fi
\orelse\ifx\currentstructurereferenceprefix\m_strc_references_prefix_nop
      \setupglobalreferenceprefix[]%
    \else
      \setupglobalreferenceprefix[\currentstructurereferenceprefix]%
    \fi
    \glet\currentstructurereferenceprefix\referenceprefix}
%%%% end fix


When I apply the changes above the following document shows the correct 
references in the output.

%%%% begin example
\setuphead[chapter][referenceprefix=+]

\starttext

\chapter[one]{First chapter}

\section[alpha]{First section}

See \in{Section}[alpha].

See \in{Section}[two:beta].

\chapter[two]{Second chapter}

\section[beta]{Second section}

See \in{Section}[one:alpha].

See \in{Section}[beta].

\stoptext
%%%% end example

Wolfgang



More information about the ntg-context mailing list