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
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
participants (2)
-
Tommaso Gordini
-
Wolfgang Schuster