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 Thanks for any help. Duncan
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 ___________________________________________________________________________________
On Thu, 18 Jul 2019 at 22:30, Henri Menke
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.
Very many thanks Henri for your patient explanation, and my apologies for inadvertently asking a FAQ. I had thought the effect hasn't happened with the same content in mkii but it must have been a happenstance of different formatting. Thanks again for the clear solution. Duncan
On 19/07/19 9:36 AM, Duncan Hothersall wrote:
On Thu, 18 Jul 2019 at 22:30, Henri Menke
wrote: 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.
Very many thanks Henri for your patient explanation, and my apologies for inadvertently asking a FAQ. I had thought the effect hasn't happened with the same content in mkii but it must have been a happenstance of different formatting.
It is maybe an FAQ but I don't think it has been documented anywhere properly. I added my explanation to the Wiki page about unexpected behaviour. https://wiki.contextgarden.net/Unexpected_behavior#The_.E2.80.9Cparagraph_in... Cheers, Henri
Thanks again for the clear solution.
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 ___________________________________________________________________________________
Henri Menke schrieb am 18.07.2019 um 23:29:
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. The normal switch to use bold style is \bf and \bold{...} (or {\bold ...}) is only a alternative switch which uses \bf to change the font. The same applies to \italic{...}, \mono{...} etc.
Wolfgang
On Fri, 19 Jul 2019 13:52:37 +0200
Wolfgang Schuster
Henri Menke schrieb am 18.07.2019 um 23:29:
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. The normal switch to use bold style is \bf and \bold{...} (or {\bold ...}) is only a alternative switch which uses \bf to change the font. The same applies to \italic{...}, \mono{...} etc.
BUT, \bold{...}, \italic{...} export (to xhtml, etc.) whereas {\bf ...}, {\it ...} do not. Also, \setuphighlight [emphasis] [style=bold] and \emphasis{...} is a *functionally* better way of formatting text. Alan
Alan Braslau schrieb am 19.07.2019 um 16:06:
On Fri, 19 Jul 2019 13:52:37 +0200 Wolfgang Schuster
wrote: Henri Menke schrieb am 18.07.2019 um 23:29:
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. The normal switch to use bold style is \bf and \bold{...} (or {\bold ...}) is only a alternative switch which uses \bf to change the font. The same applies to \italic{...}, \mono{...} etc. BUT, \bold{...}, \italic{...} export (to xhtml, etc.) whereas {\bf ...}, {\it ...} do not. Are you sure? Also, \setuphighlight [emphasis] [style=bold] and \emphasis{...} is a *functionally* better way of formatting text. It depends on the document size, for a simple letter \bf etc. is enough but for a bigger document it make sense.
Wolfgang
participants (4)
-
Alan Braslau
-
Duncan Hothersall
-
Henri Menke
-
Wolfgang Schuster