Re: [NTG-context] new upload

2021-05-31 Thread Aditya Mahajan
On Mon, 31 May 2021, Hans Hagen wrote:

> On 5/31/2021 6:50 PM, Aditya Mahajan wrote:
> > On Mon, 31 May 2021, Hans Hagen wrote:
> > 
> > > Hi,
> > > 
> > > I uploaded a new lmtx version. This time a new mechanism.
> > 
> > This is very interesting...I haven't played around with it, but is it the
> > case that \markanchor does not do alignment and so can completely replace
> > the old \hpos{...} class of macros?
> > 
> > This also gives many interesting possibilities for math  drawing "boxes"
> > in matrices (e.g.,
> > https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements)
> > or even the nath style `\wall` macro (see pg 11 of
> > https://texdoc.org/serve/nathguide.pdf/0) ... Of course, I mean this in
> > terms of the visual effect and not the interface.
> Like this ... I'll think about taking some size into account (a bit like hpos
> does).

Yes! If we can take size of cell into account, it will be perfect. 

We can also think of a wrapper so that an explicit \framed is not needed. 

Aditya
___
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
___


Re: [NTG-context] new upload

2021-05-31 Thread Hans Hagen

On 5/31/2021 6:50 PM, Aditya Mahajan wrote:

On Mon, 31 May 2021, Hans Hagen wrote:


Hi,

I uploaded a new lmtx version. This time a new mechanism.


This is very interesting...I haven't played around with it, but is it the case 
that \markanchor does not do alignment and so can completely replace the old 
\hpos{...} class of macros?

This also gives many interesting possibilities for math  drawing "boxes" in 
matrices (e.g., 
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements) or even 
the nath style `\wall` macro (see pg 11 of https://texdoc.org/serve/nathguide.pdf/0) ... 
Of course, I mean this in terms of the visual effect and not the interface.
Like this ... I'll think about taking some size into account (a bit like 
hpos does).


\starttext

\startuseMPgraphic{whatever-1}
fill OverlayBox withcolor "lightgray" ;
drawdot anchorxy("one", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("one", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("three", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{whatever-2}
pair a ; a := anchorxy("one", 0, 1) ;
pair b ; b := anchorxy("one", 0, 2) ;
drawarrow
anchorxy("one", 0, 1) { right } ..
anchorxy("one", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { down } ..
anchorxy("two", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { dir 30 } ..
anchorxy("three", 0, 1)
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-1][\useMPgraphic{whatever-1}]
\defineoverlay[whatever-2][\useMPgraphic{whatever-2}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {\startmathmatrix
  \NC \markanchor{two}{0}{1}a \NC b \NC c\NR
  \NC a \NC b \NC c\NR
  \NC a \NC \markanchor{one}{0}{1}b \NC c\NR
  \NC \markanchor{one}{0}{2}a \NC b \NC \markanchor{two}{0}{2}c\NR
  \NC a \NC \markanchor{three}{0}{1}b \NC c\NR
  \stopmathmatrix}

\startuseMPgraphic{whatever-3}
pair a ; a := anchorxy("a", 0, 1) ;
pair b ; b := anchorxy("a", 0, 2) ;
draw boundingbox (a--b)
leftenlarged .25EmWidth
rightenlarged EmWidth
topenlarged StrutHeight
bottomenlarged .5StrutDepth
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-3][\useMPgraphic{whatever-3}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background=whatever-3]
  {\startmathmatrix
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC \markanchor{a}{0}{1}a \NC   b \NC c\NR
  \NC a \NC a \NC \markanchor{a}{0}{2}b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \NC a \NC a \NC   b \NC c\NR
  \stopmathmatrix}

\stoptext

The \markanchor{a}{0}{1 can be wrapped in a simpler one, or we can have 
something \markedanchor{a}{2}{b} but that need a little thinking because 
we don't want to mess too much with math spacing. Actually we can 
consider (in this case) \MC[a,2] or so although these are probabbly not 
features used that often.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] new upload

2021-05-31 Thread Hans Hagen

On 5/31/2021 6:50 PM, Aditya Mahajan wrote:

On Mon, 31 May 2021, Hans Hagen wrote:


Hi,

I uploaded a new lmtx version. This time a new mechanism.


This is very interesting...I haven't played around with it, but is it the case 
that \markanchor does not do alignment and so can completely replace the old 
\hpos{...} class of macros?


as long as you work within a predictable namespace and box/unbox situation


This also gives many interesting possibilities for math  drawing "boxes" in 
matrices (e.g., 
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements) or even 
the nath style `\wall` macro (see pg 11 of https://texdoc.org/serve/nathguide.pdf/0) ... 
Of course, I mean this in terms of the visual effect and not the interface.

ah ... http://www.tug.org/tug2003/preprints/Bilotta/bilotta2.pdf

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] new upload

2021-05-31 Thread Aditya Mahajan
On Mon, 31 May 2021, Hans Hagen wrote:

> Hi,
> 
> I uploaded a new lmtx version. This time a new mechanism.

This is very interesting...I haven't played around with it, but is it the case 
that \markanchor does not do alignment and so can completely replace the old 
\hpos{...} class of macros?

This also gives many interesting possibilities for math  drawing "boxes" in 
matrices (e.g., 
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements)
 or even the nath style `\wall` macro (see pg 11 of 
https://texdoc.org/serve/nathguide.pdf/0) ... Of course, I mean this in terms 
of the visual effect and not the interface. 

Thanks,
Aditya


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


Re: [NTG-context] what happend to \writeline?

2021-05-31 Thread Werner Hennrich

\writeline works well again after the next update to version: 2021.05.31
14:13 -
*and* my xtables patch in cont-loc persisted.

Thank you Hans,
Werner


Am 28.05.21 um 18:19 schrieb Hans Hagen:

On 5/28/2021 6:05 PM, Werner Hennrich wrote:

Hello everyone,

I'm looking into my environment's logging to trace a problem and
realize that \writeline is gone mute -
that is, the output of subsequent logging lines now gets joined up in
the same line, very hard to read...


i'll check it


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


[NTG-context] new upload

2021-05-31 Thread Hans Hagen

Hi,

I uploaded a new lmtx version. This time a new mechanism.

-
From an upcoming details chapter:
-

The mechanism described here is still experimental. Although it could be 
implemented in \MKIV\ it is only available in \LMTX. Already early in 
\MKII\ we had a positioning mechanism available. At that time we had 
\DVI\ output and specials were used to track positions. A script 
calculated the positions that were then fed back into the second run. 
Later Taco wrote \DVIPOS\ which sped up the analysis between runs. When 
\PDFTEX\ showed, an equivalent positioning mechanism was added there. In 
\MKIV\ positioning support was optimized a bit as part of the upgrading 
process but the principles remained the same. The interface to 
positioning comes with a lot of commands and many of them relate to what 
we want to do with \METAFUN. The alternative interface discussed here is 
a bit simpler and has (at least now) less commands and, combined with 
local name spaces, can be easier to use in more local situations. It's 
also integrated in the frequently used \type {\framed} commands and has 
basic support at the \METAFUN\ end. The performance is comparable to the 
regular positioning mechanisms but especially at the \METAPOST\ end has 
less overhead.


-
Here are some examples:
-

\framed [synchronize=yes,align=normal] {%
  test test test 1  \sync{one}{1}test test 2  \crlf
  test test 1   \sync{one}{1}test test test 2 \crlf
  test 1\sync{one}{1}test 2   \crlf
  test test test test 1 \sync{one}{1}test test 2
}

\framed [synchronize=yes,align=normal] {%
one one \sync{a}{1}two \sync{a}{2}three \crlf
one one \sync{a}{1}two two \sync{a}{2}three \crlf
one \sync{a}{1}two \sync{a}{2}three \crlf
one one one \sync{a}{1}two \sync{a}{2}three
}

\framed [synchronize=yes,align=normal] {%
\syncanchor{one}{1}{1}A
\syncanchor{one}{2}{1}BBB
\syncanchor{one}{3}{1}C \crlf
\syncanchor{one}{1}{2}AA
\syncanchor{one}{3}{2}C \crlf
\syncanchor{one}{1}{3}AAA
\syncanchor{one}{2}{3}BB
\syncanchor{one}{3}{3}C
}

\framed [synchronize=yes,align=normal] {%
\alignanchor{one}{1}{1}{l}A
\alignanchor{one}{1}{2}{m}AA
\alignanchor{one}{1}{3}{r}AAA
\syncanchor {one}{1}{4}\crlf
\alignanchor{one}{2}{1}{right}B
\alignanchor{one}{2}{2}{middle}BB
\alignanchor{one}{2}{3}{left}BBB
\syncanchor {one}{2}{4}
}

\startuseMPgraphic{whatever-1}
fill OverlayBox withcolor "lightgray" ;
drawdot anchorxy("one", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("one", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("two", 0, 2)
withpen pencircle scaled 1mm
withcolor "red" ;
drawdot anchorxy("three", 0, 1)
withpen pencircle scaled 1mm
withcolor "red" ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{whatever-2}
pair a ; a := anchorxy("one", 0, 1) ;
pair b ; b := anchorxy("one", 0, 2) ;
drawarrow
anchorxy("one", 0, 1) { right } ..
anchorxy("one", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { down } ..
anchorxy("two", 0, 2)
withcolor "blue" withtransparency (1,.75) ;
drawarrow
anchorxy("two", 0, 1) { dir 30 } ..
anchorxy("three", 0, 1)
withcolor "blue" withtransparency (1,.75) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[whatever-1][\useMPgraphic{whatever-1}]
\defineoverlay[whatever-2][\useMPgraphic{whatever-2}]

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {%
\markanchor{two}{0}{1}{\red\bf foo}%
\markanchor{one}{0}{1} bar rab oof\crlf
foo bar rab oof\crlf
oof rab bar foo\crlf
oof rab \markanchor{two}{0}{2}{\red\bf bar}%
\markanchor{one}{0}{2} foo%
\markanchor{three}{0}{1}%
  }

\framed
  [synchronize=yes,
   align=normal,
   offset=10pt,
   frame=off,
   background={whatever-1,foreground,whatever-2}]
  {%
one one one \syncanchor{a}{1}{1}two two two
\syncanchor{a}{2}{1}three three\par
one \syncanchor{a}{1}{2}two
\syncanchor{a}{2}{2}three\par
one \syncanchor{a}{1}{3}two
\syncanchor{a}{2}{3}three\par
\blank
\markanchor{two}{0}{1}{\red\bf foo}%
\markanchor{one}{0}{1} bar rab oof\crlf
foo bar rab oof\crlf
oof rab bar foo\crlf
oof rab \markanchor{two}{0}{2}{\red\bf bar}%
\markanchor{one}{0}{2} foo%
\markanchor{three}{0}{1}%
\blank
one one \syncanchor{a}{1}{4}two two

Re: [NTG-context] new page before xtable with repeated headers

2021-05-31 Thread Hans Hagen

On 5/31/2021 12:36 PM, Werner Hennrich wrote:

Hello Hans,
loading from cont-loc now works, thank you!

Am 31.05.21 um 11:33 schrieb Hans Hagen:

you can wrap such a patch in:

\ifcsname\??xtableflushsplit\v!repeat\endcsname \else

\fi

to make sure that it's not overloading something built in


if I do this, I get:

suggestion  > use \withcaron instead of \v

and if I use \withcaron, then the wrapper seems to be OK,
but the patch isn't loaded any more.
Wasn't the patch meant to override an already existing\xtableflushsplit 
in this case?

you rforgot the \unprotect .. \protect around that code, so tex sees

  \v!foo -> \v !foo

instead of

  \v!foo

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] new page before xtable with repeated headers

2021-05-31 Thread Werner Hennrich

sorry, not true:

Am 31.05.21 um 12:36 schrieb Werner Hennrich:

but the patch isn't loaded any more.


my

\writestatus\m!system{beware: LOCAL PATCH LOADED FOR xtable}

from inside the \else to \fi is indeed still in my console.

case re safe update closed -
thanks, Werner




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


Re: [NTG-context] new page before xtable with repeated headers

2021-05-31 Thread Werner Hennrich

Hello Hans,
loading from cont-loc now works, thank you!

Am 31.05.21 um 11:33 schrieb Hans Hagen:

you can wrap such a patch in:

\ifcsname\??xtableflushsplit\v!repeat\endcsname \else

\fi

to make sure that it's not overloading something built in


if I do this, I get:

   suggestion  > use \withcaron instead of \v

and if I use \withcaron, then the wrapper seems to be OK,
but the patch isn't loaded any more.
Wasn't the patch meant to override an already existing\xtableflushsplit
in this case?

Thank you,
Werner

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


Re: [NTG-context] new page before xtable with repeated headers

2021-05-31 Thread Hans Hagen

On 5/31/2021 10:50 AM, Werner Hennrich wrote:
I still rely in all my installations on this bit at the bottom to be in 
cont-new.mkxl.

Is there a way to make this patch update-safe?

There are comments 
in ./tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl:


%D This file is loaded at runtime, thereby providing an excellent
place for hacks,
%D patches, extensions and new features. There can be local
overloads in cont-loc
%D (which has always been the case) and experimental code in
cont-exp (which is also
%D so old that I need to remind myself to check it occasionally, so
here is the
%D reminder).

I tried the mentioned local overload methods but didn't get them to work.
Did I mess up somehow or is the comment above outdated?
Are there any better ways - update-safe though?

Thanks a lot, Werner


Am 23.04.21 um 21:28 schrieb Hans Hagen:

You can put this on cont-new.mkxl as test:

\unprotect

\defcsname\??xtableflushsplit\v!repeat\endcsname
  {\doloop
 {\clf_x_table_flush
    method {\v!split}%
    height 
\ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi

  \relax
  \ifcase\c_tabl_x_state
    \exitloop
  \else
    \page
  \fi}}

\protect 
cont-new will be overwritten so when you put a patch in there you need 
to check a next upload if that patch is permanent


you can also put patched in a cont-loc file (make sure that you run 
mtxrun --generate after making one) and out that file in your 
texmf-local tree  (or project tree) as these will not be replaced


you can wrap such a patch in:

\ifcsname\??xtableflushsplit\v!repeat\endcsname \else

\fi

to make sure that it's not overloading something built in

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] Side-by-side environment

2021-05-31 Thread Werner Hennrich

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
___



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


Re: [NTG-context] new page before xtable with repeated headers

2021-05-31 Thread Werner Hennrich

I still rely in all my installations on this bit at the bottom to be in
cont-new.mkxl.
Is there a way to make this patch update-safe?

There are comments
in ./tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl:

   %D This file is loaded at runtime, thereby providing an excellent
   place for hacks,
   %D patches, extensions and new features. There can be local
   overloads in cont-loc
   %D (which has always been the case) and experimental code in
   cont-exp (which is also
   %D so old that I need to remind myself to check it occasionally, so
   here is the
   %D reminder).

I tried the mentioned local overload methods but didn't get them to work.
Did I mess up somehow or is the comment above outdated?
Are there any better ways - update-safe though?

Thanks a lot, Werner


Am 23.04.21 um 21:28 schrieb Hans Hagen:

You can put this on cont-new.mkxl as test:

\unprotect

\defcsname\??xtableflushsplit\v!repeat\endcsname
  {\doloop
 {\clf_x_table_flush
    method {\v!split}%
    height
\ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi
  \relax
  \ifcase\c_tabl_x_state
    \exitloop
  \else
    \page
  \fi}}

\protect



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


[NTG-context] Side-by-side environment

2021-05-31 Thread 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
___