ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Side figure bug in mkiv?
Date: Fri, 19 Jul 2019 09:29:05 +1200	[thread overview]
Message-ID: <5f072ffb-29af-d46d-5c15-c275e3347513@gmail.com> (raw)
In-Reply-To: <CAN8fp9VoKZOmf1xb7_SVbB-Nm3XQyA24CX4YKw7Qs5iuNiwJyg@mail.gmail.com>

On 19/07/19 3:18 AM, Duncan Hothersall wrote:
> I think I have identified a bug in the side figure mechanism which is demonstrated by the minimal example below. The {\bf …} construct causes the para in which it appears to stop behaving properly with the side figure, and the text overflows. The preceding and following paras which don't have {\bf …} do behave properly.
> 
> I wondered if emphasis like \bf should be done differently (with a start/stop mechanism?) in mkiv, but I found nothing to suggest it.
> 
> \starttext
> Blah blah.
> \placefigure[right,none]{}{\externalfigure[cow][width=0.30\makeupwidth]}
> Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah.
> {\bf Blah blah} blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
> Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
> \stoptext

Your formatting obscures the problem because compiling this example
works fine.  I think you are starting a new paragraph before {\bf ...}.
That is a well-known problem and there are posts about it on the mailing
list every once in a while.  The sidefigure mechanism uses \parshape to
make the paragraph flow around the figure.  The \parshape primitive only
applies to a single paragraph, so ConTeXt communicates the current
\parshape settings to the next paragraph using \everypar.  However, when
a new paragraph starts in a group, i.e.

    blah blah blah ...
    
    {\bf Blah blah} blah ...

TeX inserts the \everypar tokens inside that group because only the
first letter starts the paragraph.  That is to say is effectively looks
like this

    \everypar inserted inside the group
    ~~~~~|
         v
    {\bf \the\everypar Blah blah} blah ...
                                ^
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
    Setting of \everypar are discarded again when leaving the group and
    \parshape is lost.

You have to explicitly start a new paragraph before opening a group.
The easiest way to do this is

    \dontleavehmode{\bf Blah blah} blah ...

Now the \everypar tokens are inserted directly after \dontleavehmode
outside the group and the problem goes away.

For what it's worth, the MKIV way to switch to bold face is \bold{text}
instead of {\bf text} but it also doesn't fix your problem because
neither of the two start a new paragraph before the first letter and
therefore \the\everypar is still inside a group.

Cheers, Henri

> 
> Thanks for any help.
> 
> Duncan
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-07-18 21:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 15:18 Duncan Hothersall
2019-07-18 21:29 ` Henri Menke [this message]
2019-07-18 21:36   ` Duncan Hothersall
2019-07-18 23:02     ` Henri Menke
2019-07-19 11:52   ` Wolfgang Schuster
2019-07-19 14:06     ` Alan Braslau
2019-07-19 18:51       ` Wolfgang Schuster

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=5f072ffb-29af-d46d-5c15-c275e3347513@gmail.com \
    --to=henrimenke@gmail.com \
    --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).