Changes

Jump to navigation Jump to search
814 bytes added ,  13:30, 12 May 2007
= A different approach to formatting and code colorization =
Supposing that:
b) you have a large project involving many code snippet to be inserted and colorized
you can go for another, less elegant, way to format your verbatim text, which can include all the discussed ConTeXt benefitbenefits.
It is not difficult at all to write a little parser which takes as it input your source file and gives in output a .tex file containing the code plus the opportune commands for colorization. You can then include the resulting file in the global ConTeXt document file.
</texcode>
also, the global ConTeXt file example.tex requires color definition, which are created following SuperCollider colorization schemeand have to be inserted in the global ConTeXt file:
<texcode>
\input example
</texcode>
 
<context>
\starttext
%% SC colors %%
\definecolor [SCwhite] [r=1.0, g=1.0, b=1.0]
\definecolor [SCblack] [r=0.0, g=0.0, b=0.0]
\definecolor [SCblue] [r=0.0, g=0.0, b=0.75]
\definecolor [SCred] [r=0.75, g=0.0, b=0.0]
 
\definecolor [SCgrey] [r=0.376, g=0.376, b=0.376]
\definecolor [SCgreen] [r=0.0, g=0.45, b=0.0]
\defineframedtext
[framedSC]
[framecolor=cirmaBlue,
strut=yes,
offset=2mm,
width=local,
align=right]
 
\definetyping[SC][option=commands,
tab=2,numbering=line,
before={\startframedSC},
after={\stopframedSC}]
 
\startSC
/BTEX{\color[SCred] //// an example starting with a comment}/ETEX
/BTEX{\color[SCgrey] "this is a string"}/ETEX .postln ;
\stopSC
 
\stoptext
</context>
89

edits

Navigation menu