Re: [NTG-context] Listings

2008-10-03 Thread Peter Münster
On Thu, Oct 02 2008, Mohamed Bana wrote:

 Maybe someone should ask the authors of listings.sty if they're are 
 willing to port it to ConTeXt.  Here's the relevant link; 
 http://www.ctan.org/tex-archive/macros/latex/contrib/listings/

I've done that in the old days of MKII: there was too much work because of
quite a lot of LaTeX commands and the motivation was not big enough.

Now we have MKIV, that gives us a lot more possibilities and the approaches
are completely different from those in listings.sty.

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-10-03 Thread Mojca Miklavec
On Fri, Oct 3, 2008 at 7:49 AM, Peter Münster wrote:
 On Thu, Oct 02 2008, Mohamed Bana wrote:

 Maybe someone should ask the authors of listings.sty if they're are
 willing to port it to ConTeXt.  Here's the relevant link;
 http://www.ctan.org/tex-archive/macros/latex/contrib/listings/

 I've done that in the old days of MKII: there was too much work because of
 quite a lot of LaTeX commands and the motivation was not big enough.

 Now we have MKIV, that gives us a lot more possibilities and the approaches
 are completely different from those in listings.sty.

And there is also the vim module. Not quite as effective as built-in
highlighting support, but it gives you access to a wide range of
programming languages almost for free.

Mojca
___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings (was: Experience on writing a thesis with MKIV)

2008-10-02 Thread Chen Shen
Hi all,

Here is a simplistic C syntax highlighter. I hope I've extracted
comments/strings/numerics (more or less) correctly.

shenchen


On Wed, Oct 1, 2008 at 11:44 AM, Chen Shen [EMAIL PROTECTED] wrote:
 Hi,

 Thanks for the pointers. It seems that the syntax-highlighter only
 need supply function buffers.visualizers.mp.flush_line_(), which
 returns a buffer containing the typesetting commands. Will try playing
 with it.

 At the moment, I am looking for the feature with
 \setuptyping[option=commands]. I saw \mksetupcommandsintype defined,
 and buffers.visualizers.enableescape = true set in core-ver.mkiv,
 but it isn't handled in the default visualizer.

 ---
 \starttext
 \setuptyping[option=commands]
 \starttyping
 abc abc /sl abc /BTEX{\sl abc}/ETEX
 \stoptyping
 \stoptext
 ---

 regards,
 shenchen

 On Wed, Oct 1, 2008 at 1:15 AM, Wolfgang Schuster
 [EMAIL PROTECTED] wrote:

 Am 30.09.2008 um 18:37 schrieb Chen Shen:

 Hi Wolfgang,

 I guess you are referring to mkii features. It seems that formatting
 in verbatim doesn't work in mkiv yet, or did I miss out something?
 None of the wiki verbatim examples worked for me.

 Syntax hyghlighting is implemented in different ways for MkII
 and MkIV, MkII use TeX code while MkIV use Lua code to show
 the keywords etc.

 Hans added only files for TeX, MetaPost and Lua in MkIV but
 you could write files for more languages, you find the rules in
 the verb-*.lua files.

 Regards,
 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://tex.aanhet.net
 archive  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___




verb-cpp.lua
Description: Binary data


t1.tex
Description: TeX document
___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-10-02 Thread Mohamed Bana
Wolfgang Schuster wrote:
 
 \setupcolors[state=start]
 
 \definetyping[JAVA][option=JV]
 
 \setuptyping
[JAVA]
[numbering=line]
 
 \starttext
 
 \startJAVA
 
 \stopJAVA
 
 \stoptext
 
 or
 
 same preamble as above plus
 
 \definefloat[listing][listings]
 
 \starttext
 
 \placelisting
 [split]
 [lst:freeformlogfile]
 {Log File}
 {\startJAVA
  ...
  \stopJAVA}
 
 \stoptext
 
 Wolfgang
 

Maybe someone should ask the authors of listings.sty if they're are 
willing to port it to ConTeXt.  Here's the relevant link; 
http://www.ctan.org/tex-archive/macros/latex/contrib/listings/

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings (was: Experience on writing a thesis with MKIV)

2008-09-30 Thread Chen Shen
Hi Wolfgang,

I guess you are referring to mkii features. It seems that formatting
in verbatim doesn't work in mkiv yet, or did I miss out something?
None of the wiki verbatim examples worked for me.

regards,
shenchen

On Mon, Sep 29, 2008 at 2:16 AM, Wolfgang Schuster
[EMAIL PROTECTED] wrote:

 \setupcolors[state=start]

 \definetyping[JAVA][option=JV]

 \setuptyping
   [JAVA]
   [numbering=line]

 \starttext

 \startJAVA
 ...
 \stopJAVA

 \stoptext

 or

 same preamble as above plus

 \definefloat[listing][listings]

 \starttext

 \placelisting
[split]
[lst:freeformlogfile]
{Log File}
{\startJAVA
 ...
 \stopJAVA}

 \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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings (was: Experience on writing a thesis with MKIV)

2008-09-30 Thread Wolfgang Schuster

Am 30.09.2008 um 18:37 schrieb Chen Shen:

 Hi Wolfgang,

 I guess you are referring to mkii features. It seems that formatting
 in verbatim doesn't work in mkiv yet, or did I miss out something?
 None of the wiki verbatim examples worked for me.

Syntax hyghlighting is implemented in different ways for MkII
and MkIV, MkII use TeX code while MkIV use Lua code to show
the keywords etc.

Hans added only files for TeX, MetaPost and Lua in MkIV but
you could write files for more languages, you find the rules in
the verb-*.lua files.

Regards,
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-09-30 Thread Hans Hagen
Chen Shen wrote:
 Hi Wolfgang,
 
 I guess you are referring to mkii features. It seems that formatting
 in verbatim doesn't work in mkiv yet, or did I miss out something?
 None of the wiki verbatim examples worked for me.

it's on the todo ... only tex and mp should work


-
   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
-
___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings (was: Experience on writing a thesis with MKIV)

2008-09-30 Thread Chen Shen
Hi,

Thanks for the pointers. It seems that the syntax-highlighter only
need supply function buffers.visualizers.mp.flush_line_(), which
returns a buffer containing the typesetting commands. Will try playing
with it.

At the moment, I am looking for the feature with
\setuptyping[option=commands]. I saw \mksetupcommandsintype defined,
and buffers.visualizers.enableescape = true set in core-ver.mkiv,
but it isn't handled in the default visualizer.

---
\starttext
\setuptyping[option=commands]
\starttyping
abc abc /sl abc /BTEX{\sl abc}/ETEX
\stoptyping
\stoptext
---

regards,
shenchen

On Wed, Oct 1, 2008 at 1:15 AM, Wolfgang Schuster
[EMAIL PROTECTED] wrote:

 Am 30.09.2008 um 18:37 schrieb Chen Shen:

 Hi Wolfgang,

 I guess you are referring to mkii features. It seems that formatting
 in verbatim doesn't work in mkiv yet, or did I miss out something?
 None of the wiki verbatim examples worked for me.

 Syntax hyghlighting is implemented in different ways for MkII
 and MkIV, MkII use TeX code while MkIV use Lua code to show
 the keywords etc.

 Hans added only files for TeX, MetaPost and Lua in MkIV but
 you could write files for more languages, you find the rules in
 the verb-*.lua files.

 Regards,
 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://tex.aanhet.net
 archive  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Listings (was: Experience on writing a thesis with MKIV)

2008-09-28 Thread Wolfgang Schuster

Am 28.09.2008 um 19:34 schrieb Mohamed Bana:

 Aditya Mahajan wrote:
 Hi everyone,

 I finished my thesis, writing both my thesis and my presentation  
 using
 ConTeXt.

 Aditya

 :).  But there's a still something missing that I need before I even
 thinking of typesetting an msc thesis in ConTeXt.   I'd like to have
 something equivelant to the *listings.sty* package;
 http://thread.gmane.org/gmane.comp.tex.context/15591/focus=15592 or
 http://vega.soi.city.ac.uk/~abbg770/listing-sample.pdf.


 I setup listing first;

 \lstset{breaklines=true,
 showlines=true,   % showing line numbers
 numbers=left, % where to show line numbers
 numberstyle=\tiny\color{gray},
 numbersep=10pt,   %
 stepnumber=1, % how often to show the line number on the left
 language=Java,% specifiy the language
 basicstyle=\ttfamily\small,  % print whole listing small
 keywordstyle=\color{eclipsekeyword}\ttfamily\underbar, % underlined  
 bold
 black keywords
 identifierstyle=,   % nothing happens
 commentstyle=\color{eclipsecomment}, % white comments, if you use
 commentstyle=\color{white},
 stringstyle=\ttfamily,  % typewriter type for strings
 showstringspaces=false,   % no special string spaces
 frame=single,
 backgroundcolor=\color{white},
 tabsize=4,
 showspaces=false,
 showstringspaces=false}   

 \lstset{morecomment=[s][\color{eclipsejavadoc}]{/**}{*/}}


 Includes a file, look at Listing B.2 on the pdf I posted.  This should
 be self explanatory;

 \lstinputlisting[
 caption={SpreadsheetParser.java},
 label=lst:SpreadsheetParser.java]
 {source/SpreadsheetParser.java}



 I can also list inline using the same settings defined in \lstset -  
 but
 it doesn't break across lines.  The choice of charater is arbitrary
 i.e., I could have chosen to use | instead of !;

 \lstinline!matcher(CharSequence input)!



 Similar to preceeding, with line breaking.  Also I can refer to it
 using; \ref{lst:freeformlogfile}

 \begin{lstlisting}[frame=,label={lst:freeformlogfile},caption={Log  
 File}]
 import java.util.Arrays;

 public class ArrayReallocationDemo {

   public static void main(String[] args) {
 int[] data1 = new int[] { 1, 3, 5, 7, 9 };

 printArray(data1);
 int[] data2 = Arrays.copyOf(data1, 6);
 data2[5] = 11;
 printArray(data2);

 int[] data3 = Arrays.copyOfRange(data1, 2, 10);
 printArray(data3);
   }

   // print array elements
   private static void printArray(int[] data) {
 StringBuilder stringBuilder = new StringBuilder([);
 for (int i = 0; i  data.length; i++) {
   stringBuilder.append(data[i]);
   if (i  data.length - 1)
 stringBuilder.append(, );
 }
 stringBuilder.append(]);
 System.out.println(stringBuilder);
   }
 }
 \end{lstlisting}

\setupcolors[state=start]

\definetyping[JAVA][option=JV]

\setuptyping
   [JAVA]
   [numbering=line]

\starttext

\startJAVA
...
\stopJAVA

\stoptext

or

same preamble as above plus

\definefloat[listing][listings]

\starttext

\placelisting
[split]
[lst:freeformlogfile]
{Log File}
{\startJAVA
 ...
 \stopJAVA}

\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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-09-28 Thread Mohamed Bana
Wolfgang Schuster wrote:
 Am 28.09.2008 um 19:34 schrieb Mohamed Bana:
 
 Aditya Mahajan wrote:
 Hi everyone,

 I finished my thesis, writing both my thesis and my presentation  
 using
 ConTeXt.

 Aditya
 :).  But there's a still something missing that I need before I even
 thinking of typesetting an msc thesis in ConTeXt.   I'd like to have
 something equivelant to the *listings.sty* package;
 http://thread.gmane.org/gmane.comp.tex.context/15591/focus=15592 or
 http://vega.soi.city.ac.uk/~abbg770/listing-sample.pdf.


 I setup listing first;

 \lstset{breaklines=true,
 showlines=true,  % showing line numbers
 numbers=left,% where to show line numbers
 numberstyle=\tiny\color{gray},   
 numbersep=10pt,  %
 stepnumber=1,% how often to show the line number on the left
 language=Java,   % specifiy the language
 basicstyle=\ttfamily\small,  % print whole listing small
 keywordstyle=\color{eclipsekeyword}\ttfamily\underbar, % underlined  
 bold
 black keywords
 identifierstyle=,   % nothing happens
 commentstyle=\color{eclipsecomment}, % white comments, if you use
 commentstyle=\color{white},
 stringstyle=\ttfamily,  % typewriter type for strings
 showstringspaces=false,  % no special string spaces
 frame=single,
 backgroundcolor=\color{white},
 tabsize=4,
 showspaces=false,
 showstringspaces=false}  

 \lstset{morecomment=[s][\color{eclipsejavadoc}]{/**}{*/}}


 Includes a file, look at Listing B.2 on the pdf I posted.  This should
 be self explanatory;

 \lstinputlisting[
 caption={SpreadsheetParser.java},
 label=lst:SpreadsheetParser.java]
 {source/SpreadsheetParser.java}



 I can also list inline using the same settings defined in \lstset -  
 but
 it doesn't break across lines.  The choice of charater is arbitrary
 i.e., I could have chosen to use | instead of !;

 \lstinline!matcher(CharSequence input)!



 Similar to preceeding, with line breaking.  Also I can refer to it
 using; \ref{lst:freeformlogfile}

 \begin{lstlisting}[frame=,label={lst:freeformlogfile},caption={Log  
 File}]
 import java.util.Arrays;

 public class ArrayReallocationDemo {

   public static void main(String[] args) {
 int[] data1 = new int[] { 1, 3, 5, 7, 9 };

 printArray(data1);
 int[] data2 = Arrays.copyOf(data1, 6);
 data2[5] = 11;
 printArray(data2);

 int[] data3 = Arrays.copyOfRange(data1, 2, 10);
 printArray(data3);
   }

   // print array elements
   private static void printArray(int[] data) {
 StringBuilder stringBuilder = new StringBuilder([);
 for (int i = 0; i  data.length; i++) {
   stringBuilder.append(data[i]);
   if (i  data.length - 1)
 stringBuilder.append(, );
 }
 stringBuilder.append(]);
 System.out.println(stringBuilder);
   }
 }
 \end{lstlisting}
 
 \setupcolors[state=start]
 
 \definetyping[JAVA][option=JV]
 
 \setuptyping
[JAVA]
[numbering=line]
 
 \starttext
 
 \startJAVA
 ...
 \stopJAVA
 
 \stoptext
 
 or
 
 same preamble as above plus
 
 \definefloat[listing][listings]
 
 \starttext
 
 \placelisting
 [split]
 [lst:freeformlogfile]
 {Log File}
 {\startJAVA
  ...
  \stopJAVA}
 
 \stoptext
 
 Wolfgang
 

Thanks Wolfgang.

Source; http://pastebin.com/m40986857
Pdf; http://filebin.ca/kceezh/listing.pdf or http://filebin.ca/kceezh

I've still got some issues with it :(.  I think I'll just wait till 
verbatim supports improves.

1.  Lines protude into the margin and sometime even go past the end of 
the page.
2.  Why doesn't it show the line numbers for the empty lines?
3.  Is there a way to supress the 'there is nothing to split' warning?

Mohamed

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-09-28 Thread Wolfgang Schuster

Am 28.09.2008 um 22:42 schrieb Mohamed Bana:

 Wolfgang Schuster wrote:
 Am 28.09.2008 um 19:34 schrieb Mohamed Bana:

 Aditya Mahajan wrote:
 Hi everyone,

 I finished my thesis, writing both my thesis and my presentation
 using
 ConTeXt.

 Aditya
 :).  But there's a still something missing that I need before I even
 thinking of typesetting an msc thesis in ConTeXt.   I'd like to have
 something equivelant to the *listings.sty* package;
 http://thread.gmane.org/gmane.comp.tex.context/15591/focus=15592 or
 http://vega.soi.city.ac.uk/~abbg770/listing-sample.pdf.


 I setup listing first;

 \lstset{breaklines=true,
 showlines=true, % showing line numbers
 numbers=left,   % where to show line numbers
 numberstyle=\tiny\color{gray},  
 numbersep=10pt, %
 stepnumber=1,   % how often to show the line number on the left
 language=Java,  % specifiy the language
 basicstyle=\ttfamily\small,  % print whole listing small
 keywordstyle=\color{eclipsekeyword}\ttfamily\underbar, % underlined
 bold
 black keywords
 identifierstyle=,   % nothing happens
 commentstyle=\color{eclipsecomment}, % white comments, if you use
 commentstyle=\color{white},
 stringstyle=\ttfamily,  % typewriter type for strings
 showstringspaces=false, % no special string spaces
 frame=single,
 backgroundcolor=\color{white},
 tabsize=4,
 showspaces=false,
 showstringspaces=false} 

 \lstset{morecomment=[s][\color{eclipsejavadoc}]{/**}{*/}}


 Includes a file, look at Listing B.2 on the pdf I posted.  This  
 should
 be self explanatory;

 \lstinputlisting[
 caption={SpreadsheetParser.java},
 label=lst:SpreadsheetParser.java]
 {source/SpreadsheetParser.java}



 I can also list inline using the same settings defined in \lstset -
 but
 it doesn't break across lines.  The choice of charater is arbitrary
 i.e., I could have chosen to use | instead of !;

 \lstinline!matcher(CharSequence input)!



 Similar to preceeding, with line breaking.  Also I can refer to it
 using; \ref{lst:freeformlogfile}

 \begin{lstlisting}[frame=,label={lst:freeformlogfile},caption={Log
 File}]
 import java.util.Arrays;

 public class ArrayReallocationDemo {

  public static void main(String[] args) {
int[] data1 = new int[] { 1, 3, 5, 7, 9 };

printArray(data1);
int[] data2 = Arrays.copyOf(data1, 6);
data2[5] = 11;
printArray(data2);

int[] data3 = Arrays.copyOfRange(data1, 2, 10);
printArray(data3);
  }

  // print array elements
  private static void printArray(int[] data) {
StringBuilder stringBuilder = new StringBuilder([);
for (int i = 0; i  data.length; i++) {
  stringBuilder.append(data[i]);
  if (i  data.length - 1)
stringBuilder.append(, );
}
stringBuilder.append(]);
System.out.println(stringBuilder);
  }
 }
 \end{lstlisting}

 \setupcolors[state=start]

 \definetyping[JAVA][option=JV]

 \setuptyping
   [JAVA]
   [numbering=line]

 \starttext

 \startJAVA
 ...
 \stopJAVA

 \stoptext

 or

 same preamble as above plus

 \definefloat[listing][listings]

 \starttext

 \placelisting
[split]
[lst:freeformlogfile]
{Log File}
{\startJAVA
 ...
 \stopJAVA}

 \stoptext

 Wolfgang


 Thanks Wolfgang.

 Source; http://pastebin.com/m40986857
 Pdf; http://filebin.ca/kceezh/listing.pdf or http://filebin.ca/kceezh

 I've still got some issues with it :(.  I think I'll just wait till
 verbatim supports improves.

 1.  Lines protude into the margin and sometime even go past the end of
 the page.

\setuptyping
[JAVA]
[numbering=line,
 lines=yes]

\setuplinenumbering[location=text]

 2.  Why doesn't it show the line numbers for the empty lines?

Could be a MkII bug because it works with MkIV but here appears
a new problem, location=text for line numbering is not working.

Test file for Hans:

% engine=luatex

\setuplinenumbering[location=text]

\showframe

\starttext

\startlinenumbering
A line of text with the line number.
\stoplinenumbering

\stoptext


 3.  Is there a way to supress the 'there is nothing to split' warning?

It's a bug, I will look for a solution (the caption has to be fixed  
too).

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Listings

2008-09-28 Thread Wolfgang Schuster

Am 28.09.2008 um 23:23 schrieb Wolfgang Schuster:


 Am 28.09.2008 um 22:42 schrieb Mohamed Bana:

 Wolfgang Schuster wrote:
 Am 28.09.2008 um 19:34 schrieb Mohamed Bana:

 Aditya Mahajan wrote:
 Hi everyone,

 I finished my thesis, writing both my thesis and my presentation
 using
 ConTeXt.

 Aditya
 :).  But there's a still something missing that I need before I  
 even
 thinking of typesetting an msc thesis in ConTeXt.   I'd like to  
 have
 something equivelant to the *listings.sty* package;
 http://thread.gmane.org/gmane.comp.tex.context/15591/focus=15592 or
 http://vega.soi.city.ac.uk/~abbg770/listing-sample.pdf.


 I setup listing first;

 \lstset{breaklines=true,
 showlines=true,% showing line numbers
 numbers=left,  % where to show line numbers
 numberstyle=\tiny\color{gray}, 
 numbersep=10pt,%
 stepnumber=1,  % how often to show the line number on the left
 language=Java, % specifiy the language
 basicstyle=\ttfamily\small,  % print whole listing small
 keywordstyle=\color{eclipsekeyword}\ttfamily\underbar, % underlined
 bold
 black keywords
 identifierstyle=,   % nothing happens
 commentstyle=\color{eclipsecomment}, % white comments, if you use
 commentstyle=\color{white},
 stringstyle=\ttfamily,  % typewriter type for strings
 showstringspaces=false,% no special string spaces
 frame=single,
 backgroundcolor=\color{white},
 tabsize=4,
 showspaces=false,
 showstringspaces=false}

 \lstset{morecomment=[s][\color{eclipsejavadoc}]{/**}{*/}}


 Includes a file, look at Listing B.2 on the pdf I posted.  This  
 should
 be self explanatory;

 \lstinputlisting[
 caption={SpreadsheetParser.java},
 label=lst:SpreadsheetParser.java]
 {source/SpreadsheetParser.java}



 I can also list inline using the same settings defined in \lstset -
 but
 it doesn't break across lines.  The choice of charater is arbitrary
 i.e., I could have chosen to use | instead of !;

 \lstinline!matcher(CharSequence input)!



 Similar to preceeding, with line breaking.  Also I can refer to it
 using; \ref{lst:freeformlogfile}

 \begin{lstlisting}[frame=,label={lst:freeformlogfile},caption={Log
 File}]
 import java.util.Arrays;

 public class ArrayReallocationDemo {

 public static void main(String[] args) {
   int[] data1 = new int[] { 1, 3, 5, 7, 9 };

   printArray(data1);
   int[] data2 = Arrays.copyOf(data1, 6);
   data2[5] = 11;
   printArray(data2);

   int[] data3 = Arrays.copyOfRange(data1, 2, 10);
   printArray(data3);
 }

 // print array elements
 private static void printArray(int[] data) {
   StringBuilder stringBuilder = new StringBuilder([);
   for (int i = 0; i  data.length; i++) {
 stringBuilder.append(data[i]);
 if (i  data.length - 1)
   stringBuilder.append(, );
   }
   stringBuilder.append(]);
   System.out.println(stringBuilder);
 }
 }
 \end{lstlisting}

 \setupcolors[state=start]

 \definetyping[JAVA][option=JV]

 \setuptyping
  [JAVA]
  [numbering=line]

 \starttext

 \startJAVA
 ...
 \stopJAVA

 \stoptext

 or

 same preamble as above plus

 \definefloat[listing][listings]

 \starttext

 \placelisting
   [split]
   [lst:freeformlogfile]
   {Log File}
   {\startJAVA
...
\stopJAVA}

 \stoptext

 Wolfgang


 Thanks Wolfgang.

 Source; http://pastebin.com/m40986857
 Pdf; http://filebin.ca/kceezh/listing.pdf or http://filebin.ca/kceezh

 I've still got some issues with it :(.  I think I'll just wait till
 verbatim supports improves.

 1.  Lines protude into the margin and sometime even go past the end  
 of
 the page.

 \setuptyping
   [JAVA]
   [numbering=line,
lines=yes]

 \setuplinenumbering[location=text]

 2.  Why doesn't it show the line numbers for the empty lines?

 Could be a MkII bug because it works with MkIV but here appears
 a new problem, location=text for line numbering is not working.

 Test file for Hans:

 % engine=luatex

 \setuplinenumbering[location=text]

 \showframe

 \starttext

 \startlinenumbering
 A line of text with the line number.
 \stoplinenumbering

 \stoptext


 3.  Is there a way to supress the 'there is nothing to split'  
 warning?

 It's a bug, I will look for a solution (the caption has to be fixed  
 too).

Here is a quick and dirty solution, alisghtly modified version of
something I wrote two years ago [1]. The code is not ready for
documents because the spacing between the lines is wrong.

\unprotect

\def\dododostarttyping[#1]%
   {\typingparameter\c!before
\ifinsidesplitfloat
  \setbox\tablecontentbox\vbox\bgroup % added
\fi
\startpacked % includes \bgroup
\dosetuptypelinenumbering{#1}%
\initializetyping
\startverbatimcolor
\expanded{\mktypeblockverbatim{\s!start\currenttyping}{\s!stop 
\currenttyping}}}

\def\dostoptyping#1% hm, currenttyping
   {\stopverbatimcolor
\stoppacked  % includes \egroup
\ifinsidesplitfloat
  \egroup % added
  \dosplitverbatimbox\tablecontentbox
\fi