From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87674 Path: news.gmane.org!not-for-mail From: Rik Kabel Newsgroups: gmane.comp.tex.context Subject: Re: Margin heading problem, was Re: sections Date: Mon, 02 Jun 2014 19:16:06 -0400 Message-ID: <538D05B6.5070907@rik.users.panix.com> References: <538BD6F3.1030907@rik.users.panix.com> <538C3148.1020509@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0404896722==" X-Trace: ger.gmane.org 1401750998 18198 80.91.229.3 (2 Jun 2014 23:16:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2014 23:16:38 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Jun 03 01:16:33 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WrbSx-0006YG-TI for gctc-ntg-context-518@m.gmane.org; Tue, 03 Jun 2014 01:16:31 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 99DC210222 for ; Tue, 3 Jun 2014 01:16:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id y15g9RnXi7hh for ; Tue, 3 Jun 2014 01:16:31 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4FB7110225 for ; Tue, 3 Jun 2014 01:16:25 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2D84D101E3 for ; Tue, 3 Jun 2014 01:16:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id es20rFZuq9HZ for ; Tue, 3 Jun 2014 01:16:19 +0200 (CEST) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 6105A101E2 for ; Tue, 3 Jun 2014 01:16:14 +0200 (CEST) Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s52NGB4G024207 for ; Tue, 3 Jun 2014 01:16:12 +0200 Original-Received: from [192.168.201.179] (cpe-67-240-55-150.nycap.res.rr.com [67.240.55.150]) by mailbackend.panix.com (Postfix) with ESMTP id E5EC7357CD for ; Mon, 2 Jun 2014 19:16:10 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <538C3148.1020509@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=166.84.1.89; country=US; region=New York; city=Richmond Hill; latitude=40.7005; longitude=-73.8345; http://maps.google.com/maps?q=40.7005,-73.8345&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TM9zgctE - 91730e861cfd - 20140603 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:87674 Archived-At: This is a multi-part message in MIME format. --===============0404896722== Content-Type: multipart/alternative; boundary="------------030003090203080909070808" This is a multi-part message in MIME format. --------------030003090203080909070808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2014-06-02 04:09, Hans Hagen wrote: > On 6/2/2014 3:44 AM, Rik Kabel wrote: >> On 2014-06-01 12:52, Hans Hagen wrote: >>> On 6/1/2014 5:40 PM, Rik wrote: >>> >>>> Is this also the cause of problems I noted with heading placed into >>>> the >>>> margin, as in the example below? >>> >>> no, unrelated, try this: >>> >>> \setuphead >>> [section] >>> [after={\strut\blank[-2*line,samepage,disable]}, >>> command=\SectionCommand, >>> distance=0pt] >>> >>> \define[2]\SectionCommand{\inleft{XXXXXX}} >> >> That was fine until it ran into \setupwhitespace with a non-zero value. >> Fiddling with the after key \blank does not appear to help. >> >> \define[2]\MarginHead{\inmargin{#1\\#2}} >> \setuphead [section] >> [command=\MarginHead, >> distance=0pt, >> after={\strut\blank[-2*line,samepage,disable]}] >> %% With no \setupwhitespace, or any \setupwhitespace setting that >> %% results in zero interparagraph whitespace, all is well. >> %setupwhitespace [none]% okay >> %setupwhitespace [fix]% okay >> %% With non-zero interparagraph whitespace, the heading separates >> %% from the text >> \setupwhitespace [line]% bad >> \starttext >> \startchapter[title={Weisman}] >> \input weisman\par >> \input weisman >> \startsection[title={Thuan}] >> \input thuan\par >> \input thuan >> \stopsection >> \stopchapter >> \stoptext > > you can always skip back whitespace or add 'nowhite' Well, nowhite is a start, but the solution is still a way off. Meanwhile, the following works for non-grid layouts with reasonable values for \setupwhitespace, although perhaps somebody can come up with a more eloquent way to write it: \newdimen\SectionHeadSkip \SectionHeadSkip\dimexpr-2\lineheight-\parskip\relax \setuphead [section] [command=\SectionCommand, distance=0pt, after={\strut\blank[\the\SectionHeadSkip,samepage,disable,nowhite]}, ] \define[2]\SectionCommand {\inmargin{#1 -- #2}} When enabling grid layouts, the number of lines needs to be adjusted. Floats that appear as the first thing after a heading may present problems, especially with larger values for \setupwhitespace. (The default, with no location= specified, is pretty good, but when location={left,force} or such, there is often an unwanted offset from the header. and page breaks still appear between the heading and figure at times, despite the samepage setting for \blank.) So, this is quite fragile. It requires careful checking of every heading, and manual tuning when one breaks. Not a desirable solution, but at least it is possible. -- Rik Kabel --------------030003090203080909070808 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 2014-06-02 04:09, Hans Hagen wrote:
On 6/2/2014 3:44 AM, Rik Kabel wrote:
On 2014-06-01 12:52, Hans Hagen wrote:
On 6/1/2014 5:40 PM, Rik wrote:

Is this also the cause of problems I noted with heading placed into the
margin, as in the example below?

no, unrelated, try this:

\setuphead
  [section]
  [after={\strut\blank[-2*line,samepage,disable]},
   command=\SectionCommand,
   distance=0pt]

\define[2]\SectionCommand{\inleft{XXXXXX}}

That was fine until it ran into \setupwhitespace with a non-zero value.
Fiddling with the after key \blank does not appear to help.

    \define[2]\MarginHead{\inmargin{#1\\#2}}
    \setuphead    [section]
                   [command=\MarginHead,
                    distance=0pt,
                    after={\strut\blank[-2*line,samepage,disable]}]
    %% With no \setupwhitespace, or any \setupwhitespace setting that
    %%   results in zero interparagraph whitespace, all is well.
    %setupwhitespace      [none]%    okay
    %setupwhitespace      [fix]%     okay
    %% With non-zero interparagraph whitespace, the heading separates
    %%   from the text
    \setupwhitespace      [line]%    bad
    \starttext
    \startchapter[title={Weisman}]
      \input weisman\par
      \input weisman
    \startsection[title={Thuan}]
      \input thuan\par
      \input thuan
    \stopsection
    \stopchapter
    \stoptext

you can always skip back whitespace or add 'nowhite'

Well, nowhite is a start, but the solution is still a way off. Meanwhile, the following works for non-grid layouts with reasonable values for \setupwhitespace, although perhaps somebody can come up with a more eloquent way to write it:
\newdimen\SectionHeadSkip
\SectionHeadSkip\dimexpr-2\lineheight-\parskip\relax
\setuphead
  [section]
  [command=\SectionCommand,
   distance=0pt,
   after={\strut\blank[\the\SectionHeadSkip,samepage,disable,nowhite]},
  ]
 \define[2]\SectionCommand
   {\inmargin{#1 – #2}}

When enabling grid layouts, the number of lines needs to be adjusted.

Floats that appear as the first thing after a heading may present problems, especially with larger values for \setupwhitespace. (The default, with no location= specified, is pretty good, but when location={left,force} or such, there is often an unwanted offset from the header. and page breaks still appear between the heading and figure at times, despite the samepage setting for \blank.)

So, this is quite fragile. It requires careful checking of every heading, and manual tuning when one breaks. Not a desirable solution, but at least it is possible.

--
Rik Kabel
--------------030003090203080909070808-- --===============0404896722== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0404896722==--