Re: [NTG-context] A ConTeXt Guide in Italian

2018-12-02 Thread Wolfgang Schuster

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
___

Re: [NTG-context] A ConTeXt Guide in Italian

2018-11-22 Thread Wolfgang Schuster



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

___
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] A ConTeXt Guide in Italian

2018-11-21 Thread Wolfgang Schuster


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
___
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] A ConTeXt Guide in Italian

2018-11-21 Thread Tommaso Gordini
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
___
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
___