ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A ConTeXt Guide in Italian
@ 2018-11-21 21:30 Tommaso Gordini
  2018-11-21 21:58 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Tommaso Gordini @ 2018-11-21 21:30 UTC (permalink / raw)
  To: ntg-context


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

Hello everyone!
This is my first message here.

I'm trying to write a ConTeXt guide in Italian.

The LaTeX *tcolorbox* package defines an environment dedicated to LaTeX
examples: above (or on the left) the source is written, and below (or on
the right) the typeset result.

Is there something similar for ConTeXt? Does it make sense, in your
opinion, to showing examples of source code with the related outputs in
this way?

Thanks in advance for any advice on this aspect of the guide and for any
suggestions.

Tommy

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

[-- Attachment #2: Type: text/plain, Size: 492 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] 4+ messages in thread

* Re: A ConTeXt Guide in Italian
  2018-11-21 21:30 A ConTeXt Guide in Italian Tommaso Gordini
@ 2018-11-21 21:58 ` Wolfgang Schuster
       [not found]   ` <CA+b=C5VDh67mPDtHoruh_Jg9+NW4qOPZH21PGK4i2wK5PnG58w@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2018-11-21 21:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Tommaso Gordini


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


Tommaso Gordini schrieb am 21.11.18 um 22:30:
> Hello everyone!
> This is my first message here.
>
> I'm trying to write a ConTeXt guide in Italian.
>
> The LaTeX *tcolorbox* package defines an environment dedicated to 
> LaTeX examples: above (or on the left) the source is written, and 
> below (or on the right) the typeset result.
>
> Is there something similar for ConTeXt? Does it make sense, in your 
> opinion, to showing examples of source code with the related outputs 
> in this way?

There is no environment which produces the same output as the mentioned 
package
you can use buffers for your examples in the document.


\starttext

\startbuffer
\startframedtext
\samplefile{klein}
\stopframedtext
\stopbuffer

\typebuffer[option=tex]

\getbuffer

\stoptext


You can use this to write your own environment for the examples (or use 
the userdata
environment when you’re lazy :)


\defineuserdata [example] [alternative=example]

\defineuserdataalternative [example] [renderingsetup=userdata:example]

\startsetups [userdata:example]
   \startembeddedxtable 
[width=\textwidth,strut=no,offset=1ex,framecolor=red]
     \startxrow [corner=03]
       \startxcell
         \typebuffer [userdata] [option=tex]
       \stopxcell
     \stopxrow
     \startxrow [corner=01]
       \startxcell
         \getuserdata
       \stopxcell
     \stopxrow
   \stopembeddedxtable
\stopsetups

\starttext

\startuserdata [example]
\startframedtext
\samplefile{klein}
\stopframedtext
\stopuserdata

\stoptext


Wolfgang

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

[-- Attachment #2: Type: text/plain, Size: 492 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] 4+ messages in thread

* Re: A ConTeXt Guide in Italian
       [not found]   ` <CA+b=C5VDh67mPDtHoruh_Jg9+NW4qOPZH21PGK4i2wK5PnG58w@mail.gmail.com>
@ 2018-11-22 16:40     ` Wolfgang Schuster
       [not found]       ` <CA+b=C5VR9QDciNaDZ1KurcGwtg-+LvpdL14jGR7FnzS-TjTgPg@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2018-11-22 16:40 UTC (permalink / raw)
  To: mailing users, Tommaso Gordini


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



Tommaso Gordini schrieb am 22.11.18 um 06:57:
> Thank you, Wolfgang.
>
> I tried to change your solution slightly (the code is pasted below).
>
> Is there any way to have the text of the output justified on the right 
> and on the left? I looked through the command options you used, but I 
> think I did not find anything.
You can change the alignment of the text in the table with the 
align-key, e.g. \startxrow [align=normal].
> One last question: could you have space before and after the frames? 
> Something like that
>
> before = ...
> after = ...

To get a blank line before and after the table you have to add \blank to 
the setups block e.g.

\startsetups [userdata:purecode]
   \blank
   \startembeddedxtable
    ...
   \stopembeddedxtable
   \blank
\stopsetups

Wolfgang


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

[-- Attachment #2: Type: text/plain, Size: 492 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] 4+ messages in thread

* Re: A ConTeXt Guide in Italian
       [not found]         ` <CA+b=C5X0PBjKZuQFP14TFykKcp7j9dwUWddjp7sx7vOX7nLpOA@mail.gmail.com>
@ 2018-12-02 21:52           ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2018-12-02 21:52 UTC (permalink / raw)
  To: Tommaso Gordini, mailing users

Tommaso Gordini schrieb am 27.11.18 um 08:14:
> Wolfgang, your code works very fine for me, and the result is very 
> beautiful, but I have noticed that it does not allow the interruption 
> between two pages.
> 
> I tried to pass the split=yes option to the \startembeddedxtable, 
> \startxrow or\startxcell commands, but nothing happens: where am I wrong?
> Is it possible to get what I want? Often I need to write long codes, 
> with and without output, and a breakable environment would avoid large 
> ugly spaces on the page.

Use the framedtext environment for the content of your examples.

> Below a MWE.
> 
> Thanks in advance
> Tommaso
> 
> \defineuserdata [purecode] [alternative=purecode]
> 
> \defineuserdataalternative [purecode] [renderingsetup=userdata:purecode]
> 
> \startsetups [userdata:purecode]
>    \blank
>    \startembeddedxtable 
> [width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]
>      \startxrow [corner=round,align=normal]
>        \startxcell
>          \typebuffer [userdata] [option=tex]
>        \stopxcell
>      \stopxrow
>    \stopembeddedxtable
>    \blank
> \stopsetups

\startsetups [userdata:purecode]
   \blank
   \startframedtext 
[width=max,offset=1ex,corner=round,framecolor=black,rulethickness=0.5pt]
     \typebuffer [userdata] [option=tex]
   \stopframedtext
   \blank
\stopsetups

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

\startsetups [userdata:example]
   \blank
   \startframedtext 
[width=max,offset=1ex,corner=03,framecolor=black,rulethickness=0.5pt,location=none]
     \typebuffer [userdata] [option=tex]
   \stopframedtext
   \nointerlineskip
   \startframedtext 
[width=max,offset=1ex,corner=01,framecolor=black,rulethickness=0.5pt,location=none]
     \getuserdata
   \stopframedtext
   \blank
\stopsetups

Wolfgang
___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2018-12-02 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 21:30 A ConTeXt Guide in Italian Tommaso Gordini
2018-11-21 21:58 ` Wolfgang Schuster
     [not found]   ` <CA+b=C5VDh67mPDtHoruh_Jg9+NW4qOPZH21PGK4i2wK5PnG58w@mail.gmail.com>
2018-11-22 16:40     ` Wolfgang Schuster
     [not found]       ` <CA+b=C5VR9QDciNaDZ1KurcGwtg-+LvpdL14jGR7FnzS-TjTgPg@mail.gmail.com>
     [not found]         ` <CA+b=C5X0PBjKZuQFP14TFykKcp7j9dwUWddjp7sx7vOX7nLpOA@mail.gmail.com>
2018-12-02 21:52           ` Wolfgang Schuster

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).