From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: unwanted head behavior
Date: Thu, 7 Apr 2016 12:31:38 +0200 [thread overview]
Message-ID: <5706370A.4080108@wxs.nl> (raw)
In-Reply-To: <5705FE13.9070703@sinap.ac.cn>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2016-04-07 10:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <57032823.9020809@sinap.ac.cn>
2016-04-05 5:19 ` Zhichu Chen
2016-04-07 3:42 ` Zhichu Chen
2016-04-07 8:05 ` Hans Hagen
2016-04-07 6:28 ` Zhichu Chen
2016-04-07 8:03 ` Hans Hagen
2016-04-07 10:31 ` Hans Hagen [this message]
2016-04-09 13:02 ` Zhichu Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5706370A.4080108@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).