[NTG-context] Re: listings.sty

Hans Hagen ntg-context@ntg.nl
Mon Jun 28 15:39:35 CEST 2004

Peter Münster wrote:

>On Mon, 28 Jun 2004, Hans Hagen wrote:
>>what is listings.sty providing? 
>Hello Hans,
>here some features of listings.sty:
>- support for a lot of languages (for example C)
>- easy to add further languages
>- line breaking (see my email from 19. June mentioning \lstinline)
>- line numbering
>- different options for column alignment
>- escaping to TeX
>- layout elements (frames, spacing, background, captions, etc)
>- indexing
>- floating listings
>- special treatment of comments
>- a lot more...
>I don't know about all the \definetyping features (only those, that are
>documented), perhaps the capabilities of ConTeXt are already sufficient. On
>the other side, listings.sty is a very great package and mostly written in
>Plain TeX. So perhaps it's worth the effort. I don't know...
A verbatim environment is tricky because one has to play with catcodes and the endcondition. There are also some spacing issues when used in combination with other macro package features. Another complication is that active characters are used for other features as well. I had put it on my todo list to reimplement some of the context verbatim features using etex (more robust and faster). 

When cooking up a new environment, it's best to separate functionality and use built in support when possible. For instance, line numbering, layout elements, floating listings are kind of independent of such a mechanisms.  

If some features are missing in the current verbatim environment (one of the older parts of context) i can add them if needed. On the other hand,  it does not hurt to have multiple alternatives. 

One potential problem with third party modules is that they set tex variables without context knowing about it. Also, redefining low level context macros is asking for problems, so if some special kind of support is needed for a user module, better ask me so that i can provide that low level feature in the kernel. Third party modules start with t-*    


                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl

More information about the ntg-context mailing list