Re: Ineraction between \startframedtext and \startcolumns?

Jim <[email protected]>
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Responses to both Wolfgang and Aditya (thanks to both of you).

For people hoping to learn things from reading this: my immediate problem
is solved, but there is one oddity left over (which I don't need to worry
about right now) and one new oddity.

On Mon, Apr 13, 2026 at 23:24 (+0200), Wolfgang Schuster wrote:

> Am 13.04.2026 um 22:18 schrieb Jim:
>> Hi,

>> I have some small amounts of text inside
>>          \startcolumns ... \stopcolumns
>> where I want the columns to be all on one page.

>> I could use a \testpage (or something similar) in front of it, but that
>> would require me knowing how much space to test for.  I could probably put
>> it in a vbox and test on the height+depth of the box, but I imagine ConTeXt
>> has something that doesn't require that level of trickery.

>> I see an example where someone put similarh material inside a frame, so I tried
>> that.  But in the example below, when I compile it there are three
>> oddities:

>> (1) The frame (which I would eventually make invisible with frame=off)
>> does not include the entire width of the enclosed \startcolumns
>> environment.  (Not a major problem, but a bit mysterious to me.)

> Use

> \startframedtext[width=max]

> or

> \startframedtext[width=tw] % width=\textwidth

> to to change the width of the framedtext block.

Thanks very much.  I'm sort of curious about how it (apparently) picked
about three quarters of the textwidth, but I guess I can ponder that later.

>> (2) In the framed version, the line spacing of the lines on the right match
>> those on the left, whereas in the non-framed example the line spacing
>> on the text on the right is smaller.

>> (3) After the \stopframedtext, the textwidth is too small.


>> Q: Is putting
>>          \startcolumns ... \stopcolumns
>> inside
>>          \startframedtext ... \stopframedtext
>> a "forbidden configuration"?

> Putting columns in a framedtext block (or any other vertical box) is allowed
> but the columns environment switches to a different mode.

OK, that's interesting information.  Thanks.

>> If not, can someone tell me how to make oddities (2) and (3) go away?

>> If so, can someone tell me what the best practices are for keeping short
>> sections of multi-column text together?   (Aside from floating it.)

> If you need two (or more) columns for code snippets and explanations etc.
> you should use a different mechanism, e.g. the paragraphs environments can
> be used for this.

Your suggestion is spot on.  I had tried that the other day, and couldn't
get a vertical rule down the middle (I'm trying to follow something someone
already did).  I now see I made the mistake of saying rule=yes instead of
rule=on.



On Mon, Apr 13, 2026 at 17:26 (-0400), Aditya Mahajan wrote:

> On Mon, 13 Apr 2026, Jim wrote:

<snip>

>> (1) The frame (which I would eventually make invisible with frame=off)
>> does not include the entire width of the enclosed \startcolumns
>> environment.  (Not a major problem, but a bit mysterious to me.)

> The default width of \startframedtext is 0.75\hsize.

I was going to ponder that, but a definitive answer saves time.  Thanks.


> I typically use width=broad to get full width, though any other dimension
> will also work (width=local for nested frames, or \hsize, \localhsize, or
> \textwidth)

Thanks for those, especially width=local.


>> (2) In the framed version, the line spacing of the lines on the right match
>> those on the left, whereas in the non-framed example the line spacing
>> on the text on the right is smaller.

> Add \setupinterlinespace after \switchtobodyfont[small]

Thanks.  Which makes me wonder why it is needed there and not in the first
example.  I guess I can ponder that instead of the frame width.


>> (3) After the \stopframedtext, the textwidth is too small.

> Did not test this.

If you want to see it for yourself, just run the whole MWE I included.


>> Q: Is putting
>>         \startcolumns ... \stopcolumns
>> inside
>>         \startframedtext ... \stopframedtext
>> a "forbidden configuration"?

> In general, yes. \stratcolumns is an "outer" column mode.  For columns
> inside frames etc, it is better to use \startsimplecolumns.

Another thanks for that.  I see nothing about simplecolumns in the wiki, I
guess adding in the three simplecolumns pages and putting them as "see
also" in \startcolumns would be a useful thing.


>> If not, can someone tell me how to make oddities (2) and (3) go away?

> \showgrid
> \starttext

> \startbuffer
> Some text which will get set
> between two lines.  The bottom
> line goes across the page.
> \stopbuffer

> % What I want to see looks like this:
> \startcolumns[n=2,distance=0.75cm,separator=rule]
> \typebuffer
> \column
> \switchtobodyfont[small]
> \getbuffer
> \stopcolumns

> \smallskip\line{\hss M\hss}

> \startframedtext[offset=none,width=broad] %, frame=off]
> \startsimplecolumns[n=2,distance=0.5cm,separator=rule]
> \typebuffer
> \column
> \switchtobodyfont[small]
> \getbuffer
> \stopsimplecolumns
> \stopframedtext

> \smallskip\line{\hss M\hss}

> This is more text to see what happens next.
> This is more text to see what happens next.

Interestingly (to me), wrapping \startsimplecolumns ... \stopsimplecolumns
inside \startnarrower ... \stopnarrower doesn't make the columns any
narrower.  I went to look up options to \startsimplecolumns in the wiki
when I discovered it wasn't there.  :-)


On Mon, Apr 13, 2026 at 17:28 (-0400), Aditya Mahajan wrote:

> On Mon, 13 Apr 2026, Wolfgang Schuster wrote:

>> If you need two (or more) columns for code snippets and explanations etc. you
>> should use a different mechanism, e.g. the paragraphs environments can be
>> used for this.

> In particular, if you don't need automatic column breaking, then
> multi-column is same as a very simple table!

Quite true, and maybe it is really the way to go if I want a bit more
direct control over other formatting aspects.  But for now paragraphs seems
to do the trick.

Cheers.
                                Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.