From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/59196 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Algorithmic (was: stelinterliniein) Date: Mon, 31 May 2010 15:53:22 +0200 Message-ID: <4C03BF52.2010808@googlemail.com> References: <4C024FD5.9050303@gmail.com> <4C025CD1.3090604@googlemail.com> <4C026070.5060008@gmail.com> <4C0265DB.3070107@googlemail.com> <4C026906.4060407@gmail.com> <4C026BA3.8060605@googlemail.com> <4C02962C.3040107@gmail.com> <4C02A17E.90700@googlemail.com> <4C03BCBE.2050704@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090205070302000301070503" X-Trace: dough.gmane.org 1275314016 14538 80.91.229.12 (31 May 2010 13:53:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 May 2010 13:53:36 +0000 (UTC) Cc: ntg-context@ntg.nl To: Vyatcheslav Yatskovsky Original-X-From: ntg-context-bounces@ntg.nl Mon May 31 15:53:34 2010 connect(): No such file or directory Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ5Qr-0005q2-IW for gctc-ntg-context-518@m.gmane.org; Mon, 31 May 2010 15:53:33 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 21E4DC9CB5; Mon, 31 May 2010 15:53:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3maenQy9hFIz; Mon, 31 May 2010 15:53:28 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D637BC9C99; Mon, 31 May 2010 15:53:28 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 93283C9C97 for ; Mon, 31 May 2010 15:53:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dT1KFCo8dL9y for ; Mon, 31 May 2010 15:53:25 +0200 (CEST) Original-Received: from mail-fx0-f41.google.com (mail-fx0-f41.google.com [209.85.161.41]) by balder.ntg.nl (Postfix) with ESMTP id 2E509C9C99 for ; Mon, 31 May 2010 15:53:25 +0200 (CEST) Original-Received: by fxm20 with SMTP id 20so286426fxm.14 for ; Mon, 31 May 2010 06:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=mBQzJ3s8HpZf68RJQJ+hz2oTJOw9MYEKONHqAkcXxAQ=; b=KfYI25v8oU5gTnbajYHgNqYaNf4iwS7aVYC0pT8sCp3wP/M8a2XcxMS/bbkd0U0aFg JxstBsu5ODB+0s6DfT0Rq1vDxZb5vp4of5oQuZDokESe+tztlZorYFxOkY24y3yODcnL P8VzMH+m2SDcdJy25zQcNkvsrBl9tOufdASmo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=TjtDD9QC9C+08cEVNmQedgh64c2IsHxf2qJrS2sO9iTbEVagiTfgswWLYi5rA6PKqx XkD2CD8bloi6finOeOCzNKnz9yq3S7d8EpOdg64U7PfvIGwlrE3gfe5h1s2timO0UhRu IEbz3krweQjFLfJJSWTKXz/DTph864kzJrLgU= Original-Received: by 10.223.99.212 with SMTP id v20mr5531280fan.44.1275314004947; Mon, 31 May 2010 06:53:24 -0700 (PDT) Original-Received: from rover.fritz.box (dslb-094-217-204-112.pools.arcor-ip.net [94.217.204.112]) by mx.google.com with ESMTPS id u12sm40485524fah.4.2010.05.31.06.53.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 06:53:24 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 In-Reply-To: <4C03BCBE.2050704@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:59196 Archived-At: This is a multi-part message in MIME format. --------------090205070302000301070503 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Am 31.05.10 15:42, schrieb Vyatcheslav Yatskovsky: > Hi, Wolfgang > > I would be nice to see what your Algorithms package can do ;) > > I mean example PDF. Attached is my test file where I used examples from the algorithmic package for LaTeX. Wolfgang --------------090205070302000301070503 Content-Type: application/x-tex; name="algorithmic-test.tex" Content-Disposition: attachment; filename="algorithmic-test.tex" Content-Transfer-Encoding: quoted-printable \usemodule[algorithmic] \enableregime[utf] \showframe \starttext \subject{The {\it if-then-else} Statement} \startalgorithmic \IF{some condition is true} \STATE do some processing \ELSIF{some other condition is true} \STATE do some different processing \ELSIF{some even more bizarre condition is met} \STATE do something else \ELSE \STATE do the default actions \ENDIF \stopalgorithmic \subject{The {\it for} Loop} \startalgorithmic \FOR{$i=3D0$ to $10$} \STATE carry out some processing \ENDFOR \stopalgorithmic \startalgorithmic \FORALL{$i$ such that $0\leq i\leq 10$} \STATE carry out some processing \ENDFOR \stopalgorithmic \subject{The {\it while} Loop} \startalgorithmic \WHILE{some condition holds} \STATE carry out some processing \ENDWHILE \stopalgorithmic \subject{The {\it repeat-until} Loop} \startalgorithmic \REPEAT \STATE carry out some processing \UNTIL{some condition is met} \stopalgorithmic \subject{The In=EF=AC=81nite Loop} \startalgorithmic \LOOP \STATE this processing will be repeated forever \ENDLOOP \stopalgorithmic \subject{The Precondition} \startalgorithmic \REQUIRE $x \neq 0$ and $n \geq 0$ \stopalgorithmic \subject{The Postcondition} \startalgorithmic \ENSURE $x \neq 0$ and $n \geq 0$ \stopalgorithmic \subject{Returning Values} \startalgorithmic \RETURN $(x+y)/2$ \stopalgorithmic \startalgorithmic \IF{$n$ is odd} \RETURN \TRUE \ELSE \RETURN \FALSE \ENDIF \stopalgorithmic \subject{Printing Messages} \startalgorithmic \PRINT {\tt =E2=80=98=E2=80=98Hello, World!=E2=80=99=E2=80=99} \stopalgorithmic \subject{Comments} \startalgorithmic \STATE do something \COMMENT{this is a comment} \stopalgorithmic \subject{An Example} \startbuffer \startalgorithmic[numbering=3Dline] \REQUIRE $n \geq 0 \vee x \neq 0$ \ENSURE $y =3D x^n$ \STATE $y \leftarrow 1$ \IF{$n < 0$} \STATE $X \leftarrow 1 / x$ \STATE $N \leftarrow -n$ \ELSE \STATE $X \leftarrow x$ \STATE $N \leftarrow n$ \ENDIF \WHILE{$N \neq 0$} \IF{$N$ is even} \STATE $X \leftarrow X \times X$ \STATE $N \leftarrow N / 2$ \ELSE \STATE $y \leftarrow y \times X$ \STATE $N \leftarrow N - 1$ \ENDIF \ENDWHILE \stopalgorithmic \stopbuffer \typebuffer \getbuffer \stoptext --------------090205070302000301070503 Content-Type: application/x-tex; name="t-algorithmic.tex" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="t-algorithmic.tex" %D \module %D [ file=t-algorithmic, %D version=2009.04.21, %D title=\CONTEXT\ User Module, %D subtitle=Algorithms, %D author=Wolfgang Schuster, %D date=\currentdate, %D copyright=Wolfgang Schuster, %D email=schuster.wolfgang@googlemail.com, %D license=Public Domain] \writestatus{loading}{Context User Module / Algorithms} \unprotect \def\????al{@@@@al} % ALgorithmic \def\startalgorithmic {\bgroup \dosingleempty\dostartalgorithmic} \def\dostartalgorithmic[#1]% {\iffirstargument \setupalgorithmic[#1]% \fi \def\algorithmiccommands##1% {\uppercase{\expandafter\let\csname##1\expandafter\endcsname}\csname algorithmic!##1\endcsname}% \processcommacommand[\algorithmic!list!commands]\algorithmiccommands \@@@@albefore \setupwhitespace[\v!none]% \doadaptleftskip\@@@@almargin \doif\@@@@alnumbering\v!line {\setuplinenumbering [\c!start=\@@@@alstart, \c!stop=\@@@@alstop, \c!step=\@@@@alstep]% \startlinenumbering}} \def\stopalgorithmic {\par \doif\@@@@alnumbering\v!line\stoplinenumbering \@@@@alafter \egroup} \def\setupalgorithmic {\dodoubleargument\getparameters[\????al]} % Commands \def\algorithmic!list!commands {state,if,else,elsif,endif,for,forall,endfor,while,endwhile,repeat,% until,loop,endloop,require,ensure,return,true,false,print,comment} \def\startsubalgorithmic {\par\doadaptleftskip\@@@@alwidth} \def\stopsubalgorithmic {\par\doadaptleftskip{-\@@@@alwidth}} \def\algorithmic!state {\par} \def\algorithmic!if #1{\par\algorithmicif\ #1 \algorithmicthen\startsubalgorithmic} \def\algorithmic!else {\stopsubalgorithmic\algorithmicelse\startsubalgorithmic} \def\algorithmic!elsif #1{\stopsubalgorithmic\algorithmicelsif\ #1 \algorithmicthen\startsubalgorithmic} \def\algorithmic!endif {\stopsubalgorithmic\algorithmicendif} \def\algorithmic!for #1{\par\algorithmicfor\ #1 \algorithmicdo\startsubalgorithmic} \def\algorithmic!forall#1{\par\algorithmicforall\ #1 \algorithmicdo\startsubalgorithmic} \def\algorithmic!endfor {\stopsubalgorithmic\algorithmicendfor} \def\algorithmic!while #1{\par\algorithmicwhile\ #1 \algorithmicdo\startsubalgorithmic} \def\algorithmic!endwhile{\stopsubalgorithmic\algorithmicendwhile} \def\algorithmic!repeat {\par\algorithmicrepeat\startsubalgorithmic} \def\algorithmic!until #1{\stopsubalgorithmic\algorithmicuntil\ #1} \def\algorithmic!loop {\par\algorithmicloop\startsubalgorithmic} \def\algorithmic!endloop {\stopsubalgorithmic\algorithmicendloop} \def\algorithmic!require {\par\algorithmicrequire\space} \def\algorithmic!ensure {\par\algorithmicensure\space} \def\algorithmic!return {\par\algorithmicreturn\space} \def\algorithmic!true {\algorithmictrue} \def\algorithmic!false {\algorithmicfalse} \def\algorithmic!print {\par\algorithmicprint\space} \def\algorithmic!comment {\algorithmiccomment} % I should make this multilingual \def\algorithmicrequire {{\bf Require:}} \def\algorithmicensure {{\bf Ensure:}} \def\algorithmiccomment#1{\{#1\}} \def\algorithmicend {{\bf end}} \def\algorithmicif {{\bf if}} \def\algorithmicthen {{\bf then}} \def\algorithmicelse {{\bf else}} \def\algorithmicelsif {\algorithmicelse\ \algorithmicif} \def\algorithmicendif {\algorithmicend\ \algorithmicif} \def\algorithmicfor {{\bf for}} \def\algorithmicforall {{\bf for all}} \def\algorithmicdo {{\bf do}} \def\algorithmicendfor {\algorithmicend\ \algorithmicfor} \def\algorithmicwhile {{\bf while}} \def\algorithmicendwhile {\algorithmicend\ \algorithmicwhile} \def\algorithmicloop {{\bf loop}} \def\algorithmicendloop {\algorithmicend\ \algorithmicloop} \def\algorithmicrepeat {{\bf repeat}} \def\algorithmicuntil {{\bf until}} \def\algorithmicprint {{\bf print}} \def\algorithmicreturn {{\bf return}} \def\algorithmictrue {{\bf true}} \def\algorithmicfalse {{\bf false}} % Default values \setupalgorithmic [\c!numbering=\v!no, \c!start=1, \c!stop=, \c!step=1, \c!width=1em, \c!margin=1em, \c!before=\blank, \c!after=\blank] \protect \endinput --------------090205070302000301070503 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --------------090205070302000301070503--