From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/44381 Path: news.gmane.org!not-for-mail From: Mohamed Bana Newsgroups: gmane.comp.tex.context Subject: Re: Experience on writing a thesis with MKIV Date: Sun, 28 Sep 2008 18:34:25 +0100 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1222624003 16993 80.91.229.12 (28 Sep 2008 17:46:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Sep 2008 17:46:43 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Sep 28 19:47:41 2008 connect(): Connection refused Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Kk0Mv-0002Iy-J7 for gctc-ntg-context-518@m.gmane.org; Sun, 28 Sep 2008 19:47:41 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C1DF41FDFD; Sun, 28 Sep 2008 19:46:35 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25486-02-4; Sun, 28 Sep 2008 19:45:48 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5589E1FDE6; Sun, 28 Sep 2008 19:45:47 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 685E21FDE0 for ; Sun, 28 Sep 2008 19:45:41 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25486-02-3 for ; Sun, 28 Sep 2008 19:45:06 +0200 (CEST) Original-Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by ronja.ntg.nl (Postfix) with ESMTP id 357851FDE6 for ; Sun, 28 Sep 2008 19:45:06 +0200 (CEST) Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1Kk0KN-0007Cq-4Q for ntg-context@ntg.nl; Sun, 28 Sep 2008 17:45:03 +0000 Original-Received: from 87-194-191-26.bethere.co.uk ([87.194.191.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Sep 2008 17:45:03 +0000 Original-Received: from m.bana.lists by 87-194-191-26.bethere.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Sep 2008 17:45:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 95 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 87-194-191-26.bethere.co.uk User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:44381 Archived-At: 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} Thanks guys ___________________________________________________________________________________ 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 ___________________________________________________________________________________