On 4/7/2016 8:28 AM, Zhichu Chen wrote:
If I understand correctly, the "continue=yes" key prevents a new page
generated by a lower-level structure, e.g., section, following a
higher-level structure, e.g., chapter.

Then why the checking is so complex in strc-sec.mkiv:
==================================
\def\strc_sectioning_handle_page_nop
   {\edef\p_continue{\headparameter\c!continue}%
    \ifx\p_continue\v!yes
      \ifnum\previoussectioncountervalue=\zerocount
        \strc_sectioning_check_layout
      \else\ifnum\currentsectioncountervalue>\zerocount
        \strc_sectioning_check_layout
      \fi\fi
    \else
      \strc_sectioning_check_layout
    \fi}
==================================

I temporarily changed the definition to:
==================================
\newcount\previousheadlevel
\previousheadlevel\plusone
\def\strc_sectioning_handle_page_nop
   {\edef\p_continue{\headparameter\c!continue}%
    \ifx\p_continue\v!yes
      \ifnum\currentheadlevel>\previousheadlevel\else
        \strc_sectioning_check_layout
      \fi
    \else
      \strc_sectioning_check_layout
    \fi
    \previousheadlevel\currentheadlevel}
==================================

Seems fine.

\def\currentsectioncountervalue {\clf_depthnumber\numexpr\thenamedheadlevel\currenthead\relax}
%def\previoussectioncountervalue{\clf_depthnumber\numexpr\thenamedheadlevel\currenthead+\minusone\relax}
\def\previoussectioncountervalue{\clf_depthnumber\numexpr\thenamedheadlevel\previoushead\relax}

\let\previoushead\empty

\def\strc_sectioning_handle_page_nop
  {\edef\p_continue{\headparameter\c!continue}%
   \ifx\p_continue\v!yes
     \ifx\currenthead\previoushead % not really needed
        \strc_sectioning_check_layout
     \else\ifnum\previoussectioncountervalue=\zerocount
        \strc_sectioning_check_layout
     \else\ifnum\currentsectioncountervalue>\zerocount
        \strc_sectioning_check_layout
     \fi\fi\fi
   \else
     \strc_sectioning_check_layout
   \fi
   \globallet\previoushead\currenthead}

\def\strc_sectioning_handle_page_yes
  {\ifconditional\c_strc_sectioning_ignore_page
     \setfalse\c_strc_sectioning_ignore_page
   \else
     % beware, these numbers are not yet know here
     \strc_sectioning_handle_page_nop
     \edef\p_aligntitle{\headparameter\c!aligntitle}%
     \ifx\p_aligntitle\v!float
         \ifconditional\c_strc_sectioning_auto_break
           \vspacing[\v!samepage-\currentheadlevel]%
         \fi
         \headparameter\c!before\relax
         \indent
     \else
         \page_otr_command_flush_side_floats
         \ifconditional\c_strc_sectioning_auto_break
           \vspacing[\v!samepage-\currentheadlevel]%
         \fi
         \headparameter\c!before\relax
     \fi
     \global\c_strc_sectioning_preceding_level\currentheadlevel
   \fi
   \globallet\previoushead\currenthead}

but it really needs testing with other cases


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to