3

I would like to use different text frames that are able to break across pages. Based on the answer to a qestion about framed text and page boundaries, I'm using textbackground to do this. However, I'm having trouble interpreting how textbackground behaves when it's nested.

Example:

\definetextbackground
  [BoxA]
  [leftoffset=1cm,
   rightoffset=1cm,
   topoffset=1cm,
   bottomoffset=1cm,
   location=paragraph,
   background=color,
   backgroundcolor=yellow]

\definetextbackground
  [BoxB]
  [leftoffset=2cm,
   rightoffset=1cm,
   topoffset=1cm,
   bottomoffset=1cm,
   location=paragraph,
   background=color,
   backgroundcolor=red]

\starttext

\startBoxA
BoxA independent does what I expect
\stopBoxA

\startBoxB
BoxB independent does what I expect
\stopBoxB

\startBoxA
\startBoxB
BoxB within BoxA does not do what I expect
\stopBoxB
\stopBoxA

\stoptext

nested textbackground

I would have expected the nested example to have a red paragraph block within a yellow paragraph block, but respecting the specified offsets, or perhaps only the red block to show up.

What's happening here and is there a way for both offsets to add up together to generate a block of yellow, with a padded block of red inside?

expected nested textbackground

closed as unclear what you're asking by Henri Menke, Stefan Pinnow, Andrew Swann, Bobyandbob, Phelype Oleinik Apr 14 '18 at 13:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Looks like you cannot have two nested boxes both anchored at paragraph. On the other hand I wouldn't know what to expect in that case. Your expectation is most likely wrong. Better ask the Metafun experts on the mailing list: ntg-context@ntg.nl – Henri Menke Oct 18 '17 at 7:21

Browse other questions tagged or ask your own question.