From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/17977 Path: main.gmane.org!not-for-mail From: h h extern Newsgroups: gmane.comp.tex.context Subject: Re: Using LateX packages Date: Tue, 25 Jan 2005 17:48:29 +0100 Message-ID: <41F6785D.4020008@wxs.nl> References: <41F64F12.8060903@web.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1106728503 27816 80.91.229.6 (26 Jan 2005 08:35:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Jan 2005 08:35:03 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 26 09:34:58 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ctidd-0000Lg-00 for ; Wed, 26 Jan 2005 09:34:57 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id ABB3A127A1; Wed, 26 Jan 2005 09:34:57 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06688-01; Wed, 26 Jan 2005 09:34:57 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 20BCA1279C; Wed, 26 Jan 2005 09:33:08 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A5C831279C for ; Wed, 26 Jan 2005 09:33:06 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06546-01 for ; Wed, 26 Jan 2005 09:33:06 +0100 (CET) Original-Received: from mailrelay02.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 12CC71276C for ; Wed, 26 Jan 2005 09:33:06 +0100 (CET) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id j0Q8X4Bx001998 for ; Wed, 26 Jan 2005 09:33:04 +0100 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id BBF1A1A215; Wed, 26 Jan 2005 09:25:38 +0100 (CET) Original-Received: from [10.100.1.191] (unknown [10.100.1.191]) by server-1.pragma-net.nl (Postfix) with ESMTP id AC63D1A210 for ; Wed, 26 Jan 2005 08:25:34 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <41F64F12.8060903@web.de> X-Virus-Scanned: ClamAV 0.80/540/Tue Oct 19 14:59:23 2004 clamav-milter version 0.80j on mailrelay02 X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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: by amavisd-new at ntg.nl Xref: main.gmane.org gmane.comp.tex.context:17977 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:17977 Holger Peters wrote: > Hi, > > I want to use a LaTeX Package (clrscode), or at least I want to port it > to Context. > > http://www.cs.dartmouth.edu/~thc/clrscode/ hm, not complex but mostly calls to latex font switches ans such > Is there some way to use LaTex Packages (I guess not). so you need to rewrite it > Is there documentation about writing ConTeXt modules? (I didn't find any). - try to use high level constructs (or ask me to provide them -) - only use low level macroe documented in syst-*.tex and supp-*.tex (the ones mentioned in \macros, not the \dododo things) - think fresh, forget about how other packages do it, think about what *you* want / need - user modules are prefixed with t- (m- x- p- and s- are reserved for core modules and styles) Now, about your code beautifier. Since you end up with additional markup anyway, why not go XML. You can then embed that in you tex document as usual (and have the full power of context available) but also use the code in webpages. To give you an idea: \starttext \long\def\startcode#1\stopcode {\begingroup \startXMLmapping[code]% \enableXML\scantokens{#1}% \stopXMLmapping \endgroup} \newcount\codedepth \newdimen\codeindent \codeindent=1em \def\incrementcodedepth {\advance\codedepth\plusone \ifnum\codedepth>\plusone \advance\leftskip\codeindent \fi \relax} \def\decrementcodedepth {\ifnum\codedepth>\plusone \advance\leftskip-\codeindent \fi \advance\codedepth\minusone \relax} \defineregister[function][functions] \setupregister[function][expansion=yes] \startXMLmapping[code] \defineXMLsingular [if] {\endgraf{\bf if}\incrementcodedepth} \defineXMLsingular [then] {{\bf then}\endgraf\incrementcodedepth} \defineXMLsingular [else] {\endgraf\decrementcodedepth{\bf else}\endgraf\incrementcodedepth} \defineXMLsingular [end] {\endgraf{\bf end}\decrementcodedepth\endgraf} \defineXMLsingular [int] {{\bf int}\space\ignorespaces} \defineXMLsingular [bool] {{\bf bool}\space\ignorespaces} \defineXMLsingular [var] [id='x'] {{\tf \XMLop{id}}} \defineXMLenvironment [function] [id=unknown] {\endgraf\function{\XMLop{id}}{\bf function}\space{\sl\XMLop{id}}\space} {\endgraf\incrementcodedepth} \defineXMLenvironment [return] {{\bf return}\space} {\endgraf} \defineXMLenvironment [c] {\bgroup\setups{code:comment}\type{//* }\ignorespaces} {\removeunwantedspaces\type{ *//}\egroup\endgraf} \stopXMLmapping \startsetups [code:comment] \defineXMLsingular [var] [id='x'] {{\bs \XMLop{id}}} \stopsetups \startcode ( i; j) (i<10) Let's add some comment here. Well, means nothing to me. := 3 This is a funny language, a kind of mixture. := 1 a \stopcode \blank[3*big]\placeregister[function][criterium=all] \stoptext If there is interest in such a module, i can write the auxiliary macros needed for it and others can define the languages. Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------