# [NTG-context] [HELP] colored text marked by a caption and across multipages

Wed Oct 4 12:58:40 CEST 2006

2006/9/29, Wei_Hu at mtk.com.tw <Wei_Hu at mtk.com.tw>:
>
>
> Hi all,
>
> << 1 >>
> First, I want to put source codes into my document.
> I achieve this by using 'verbatim'
>
> \starttyping
> blah blah
> \stoptyping
>
> << 2 >>
> Then I decide to add colors for these source codes, so I use:
>
> \starttyping[option=color,option=commands]
> blah blah
> <</color[red]....>>
> blah blah
> \stoptyping
>
> << 3 >>
> Finally, I want to refer to this block of source codes in the rest
> document, so I use:
>
> \placefloat[here][listing:sample]{Hello world}
> \starttyping[option=color,option=commands]
> blah blah
> <</color[red]....>>
> blah blah
> \stoptyping
>
> and refer to it by \in{}[] and \at{}[].
>
> << 1 >> & << 2 >> & << 3 >> work great, however, if the source codes are
> long enough, and doesn't fit into one page,
> then the bottom of it will not display.
>
> After searching this mailing list, I found some methods: \bTABLE,
> \starttextbackground ..etc...
> But none of them can achieve this facility.
>
> I can accomplish this facility though LaTeX as described in page 2 ~ page
> 3 in the attached file.
> (It uses listings package in LaTeX)
>
> All I want is a colored source codes marked by a caption, and I can refe
> to that source code using \in{}[] or \at{}[] primitives.
> Are there any ways in ConTeXt can achieve this?
>
> Thanks.

You can find a very simple but working example in my attached file.

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ntg.nl/pipermail/ntg-context/attachments/20061004/881419c5/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listing.tex
Type: application/x-tex
Size: 5959 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20061004/881419c5/attachment.tex