Aditya Mahajan
4. August 2015 02:08
On Mon, 3 Aug 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:


I am not sure when the subformula numbering broke, but I can confirm that it is not working with the latest beta.
You have to make three changes in strc-mat.mkiv to fix subformula numbering.

The first change is necessary to show the even when there isn’t a argument for \startsubformulas.

The second change is necessary to prevent context from reseting the mode for subnumbers
at the end of each formula.

The changes in \stopsubfomulas is necessary because of the test in \everyresetformulas.


\def\strc_formulas_number_indeed
  {\ifconditional\c_strc_formulas_handle_number
     \hbox\bgroup
       % main counter
       \ifconditional\c_strc_formulas_inside_formulas_sub
         % nothing
       \else
         \ifcase\c_strc_formulas_number_mode
           \ifcase\c_strc_formulas_place_number_mode
             \strc_formulas_handle_numbering
           \or
             \strc_formulas_handle_numbering
           \or
             % nothing
           \or
             \strc_formulas_handle_numbering
           \fi
         \or
           \strc_formulas_handle_numbering
         \or
           % nothing
         \or
           \strc_formulas_handle_numbering
         \fi
       \fi
       % subcounter
       \ifconditional\c_strc_formulas_inside_formulas_sub
         \ifcase\c_strc_formulas_sub_number_mode
-          % nothing
+          \strc_formulas_handle_sub_numbering
         \or
           \strc_formulas_handle_sub_numbering
         \or
           % nothing
         \or
           \strc_formulas_handle_sub_numbering
         \fi
       \fi
      \strc_formulas_reference_trace
     \egroup
   \fi}

\appendtoks
    \c_strc_formulas_place_number_mode \zerocount
    \c_strc_formulas_number_mode       \zerocount
-   \c_strc_formulas_sub_number_mode   \zerocount
+   \ifconditional\c_strc_formulas_inside_formulas_sub \else
+       \c_strc_formulas_sub_number_mode\zerocount
+   \fi
    \c_strc_formulas_nested_number_mode\zerocount
\to \everyresetformulas

\unexpanded\def\stopsubformulas
  {\nonoindentation
   \useindentnextparameter\subformulaparameter
-  \the\everyresetformulas % to be checked
   \global\setfalse\c_strc_formulas_inside_formulas_sub
+  \the\everyresetformulas % to be checked
   \dorechecknextindentation} % here ?


%%%% begin example
\usemodule[visual]

\starttext

\placeformula
\startformula
\fakeformula
\stopformula

%\startsubformulas[+]       % These two options for \subformulas
%\startsubformulas[mylabel] % enable subnumbers for the formulas
\startsubformulas

    \placeformula
    \startformula
    \fakeformula
    \stopformula

    \placeformula
    \startformula
    \fakeformula
    \stopformula

\stopsubformulas

\stoptext
%%%% end example


Wolfgang