ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Side-by-side environment
@ 2021-05-31  7:52 Tommaso Gordini
  2021-05-31  9:06 ` Werner Hennrich
  0 siblings, 1 reply; 2+ messages in thread
From: Tommaso Gordini @ 2021-05-31  7:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1173 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 5346 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Side-by-side environment
  2021-05-31  7:52 Side-by-side environment Tommaso Gordini
@ 2021-05-31  9:06 ` Werner Hennrich
  0 siblings, 0 replies; 2+ messages in thread
From: Werner Hennrich @ 2021-05-31  9:06 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2305 bytes --]

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
<https://www.pragma-ade.com/general/manuals/xtables-mkiv.pdf> and play
around,
for the full list of options refer to the commands reference
<http://www.pragma-ade.com/general/qrcs/setup-en.pdf>.

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



[-- Attachment #1.2: Type: text/html, Size: 9633 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-31  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  7:52 Side-by-side environment Tommaso Gordini
2021-05-31  9:06 ` Werner Hennrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).