Hello Tommy,
xtable is quite versatile and can do a lot of things -
place your cells next to each other by putting them into the same row.

If you haven't yet, this might be a good moment to skim through the xtables manual and play around,
for the full list of options refer to the commands reference.

All the best!
Werner



Am 31.05.21 um 09:52 schrieb Tommaso Gordini:
Hello everybody.

Some time ago, Wolfgang helped me write an environment to have code above and typeset output below.
I'll glue you a MWE below.

\mainlanguage [it]

\setupbodyfont [modern]


\defineuserdata 

  [example] 

  [alternative=example]


\defineuserdataalternative 

  [example] 

  [renderingsetup=userdata:example]


\startsetups [userdata:example]

  \blank

  \startembeddedxtable [width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]

    \startxrow [corner=03,align=normal]

      \startxcell

        \typebuffer [userdata] [option=tex]

      \stopxcell

    \stopxrow

    \startxrow [corner=01,align=normal]

      \startxcell

        \getuserdata

      \stopxcell

    \stopxrow

  \stopembeddedxtable

  \blank

\stopsetups


\starttext


\startuserdata [example]

\starttext

  C’era una volta un re\dots

\stoptext

\stopuserdata


\stoptext


Now, the question: Can the code to be improved? How can I modify the code to have the example typeset to the right of the box? I would like the box to be 0.5\textwidth wide.

Thanks in advance
Tommy

___________________________________________________________________________________
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
___________________________________________________________________________________