Annoying space before/after the text on headers

Friends, why when \doiftextelse and \startsetups are used (to get the names of chapters, section, etc.) into an environment you get an annoying space before/after the text on headers. But when the same code is applied out of any environment, it just works?

Annoying space before/after the text on headers
Annoying space before/after the text on headers

MWE:

\startsetups[chapterinfo] \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]} \stopsetups \setupheadertexts[{\setup[chapterinfo]}][][][{\setup[chapterinfo]}]  \showframe \setuppagenumbering[alternative=doublesided]  \startsectionblockenvironment[frontpart] \startsetups[chapterinfo] \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]} \stopsetups \setupheadertexts[{\setup[chapterinfo]}][][][{\setup[chapterinfo]}] \stopsectionblockenvironment  \starttext  \startfrontmatter \startchapter[title={Chapter}] \dorecurse{15} {\input knuth} \stopchapter \stopfrontmatter  \startchapter[title={Chapter}] \dorecurse{15} {\input knuth} \stopchapter  \stoptext 

Replay

For some reason, spaces are not ignored when \start...\stopsetups is used inside \start...\stopsectionblockenvironment. If you want to use square brackets with \start...\stopsetups you also have to hide the succeeding space by \startsetups[chapterinfo]%.

\startsetups chapterinfo
  \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]}
\stopsetups
\setupheadertexts[{\setup[chapterinfo]}][][][{\setup[chapterinfo]}]

\showframe
\setuppagenumbering[alternative=doublesided]

\startsectionblockenvironment[frontpart]
  \startsetups chapterinfo
    \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]}% <-- hide this space
  \stopsetups
  \setupheadertexts[{\setup[chapterinfo]}][][][{\setup[chapterinfo]}]
\stopsectionblockenvironment

\starttext

\startfrontmatter
  \startchapter[title={Chapter}]
    \dorecurse{15}{\input knuth}
  \stopchapter
\stopfrontmatter

\startchapter[title={Chapter}]
  \dorecurse{15}{\input knuth}
\stopchapter

\stoptext

Without %

Annoying space before/after the text on headers

With %

Annoying space before/after the text on headers

Alternative

I don't think this is a bug, because setups are meant to be declared on global scope. Therefore I would declare the two setups globally and give them different names, also revealing where they are to be used.

\startsetups chapterinfo:main
  \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]}
\stopsetups

\startsetups chapterinfo:front
  \doiftextelse{\getmarking[chapter]}{\getmarking[chapter]}{\getmarking[chapter]}
\stopsetups

\setupheadertexts[{\setup[chapterinfo:main]}][][][{\setup[chapterinfo:main]}]

\showframe
\setuppagenumbering[alternative=doublesided]

\startsectionblockenvironment[frontpart]
  \setupheadertexts[{\setup[chapterinfo:front]}][][][{\setup[chapterinfo:front]}]
\stopsectionblockenvironment

\starttext

\startfrontmatter
  \startchapter[title={Chapter}]
    \dorecurse{15}{\input knuth}
  \stopchapter
\stopfrontmatter

\startchapter[title={Chapter}]
  \dorecurse{15}{\input knuth}
\stopchapter

\stoptext

Category: context Time: 2016-07-29 Views: 0
Tags: context

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.243 (s). 12 q(s)