ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Maurice Diamantini <Maurice.Diamantini@ensta.fr>
Cc: Maurice Diamantini <Maurice.Diamantini@ensta.fr>
Subject: Re: algorithms style : need \starttyping with TeX and math feature
Date: Mon, 3 Jan 2005 15:52:01 +0100	[thread overview]
Message-ID: <067F33B3-5D97-11D9-B03E-000A9595B57C@ensta.fr> (raw)
In-Reply-To: <200412251403.10518.john@wexfordpress.com>


Le 25 déc. 04, à 20:03, John Culleton a écrit :

> On Friday 24 December 2004 09:23, Mojca Miklavec wrote:
>> Maurice Diamantini wrote:
>>> Well I agree that it's no more "typing" any more!
>>> So a special option for \setuplines would be more appropriate?
>>
>> Exactly, \starttyping does exactly that what you don't want: it 
>> disables
>> math and expansion of TeX commands.
>>
>>> Also, perhaps my request is simply an option of \startlines
>>> which keep not only the lines break, but also the first
>>> spaces of each line (in a verbatim font fors these space)

Happy new year !
Thanks to Mojca and John, I use \startlines for the
algorithms environment.

In the "Algo" environment, I defined some short names command
to help dealing with indent spacing (\0, \1, ..., \5)
and with itemize like indent (i.e. space with the
same length as "- "

Here is the environment I defined. It could be better
(to keep the use of it event simpler)
But as the "père Noël" Hans give me a "Christmas present"
(see next post) It is no more usefull!

     \definestartstop[Algo][
        before={
             \start
             \tx
             \def\H{\phantom{- }}% H for Hyphen (espace correspondant à 
"- "
             \def\0{\hskip0em}  % indent 0
             \def\1{\hskip2em}  % indent 1
             \def\2{\hskip4em}  % indent 2
             \def\3{\hskip6em}  % indent 3
             \def\4{\hskip8em}  % indent 5
             \def\5{\hskip10em} % indent 6
             \setupinterlinespace[small]
             \startframedtext[
                  width=\makeupwidth,
                  framecolor=blue,
             ]
             \startlines
        },
        after={
             \stoplines
             \stopframedtext
             \stop
        },
     ]

Just a "french like" algorithm

\startAlgo
\0  Entrée :
\1   - nom de l'instance à traiter (e.g. ucp8, ...)
\1   - LDS\_Limit Nombre maximum de discordances (e.g. 1 pour LDS\_1, 
...)
\0  Sortie :
\1   - affichage des meilleures solutions primale et duale
\0  Algorithme :
\1   - initialisation :
\2      - LDS\_Counter := 0 (nombre de discordances courantes)
\2      - lecture de l'instance
\2      - propagation initiale
\1   - relaxation lagrangienne principale avec primalisations interne
\1\H   $\Rightarrow$  on connait bestDualValue,  bestPrimalValue et les 
coûts réduits
\1   - explorer le noeud racine (i.e. toutes les variables étant libres)
\1   - afficher les résultats
\stopAlgo

Thanks you very much !

Maurice

      parent reply	other threads:[~2005-01-03 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24  8:07 Maurice Diamantini
2004-12-24  8:48 ` Maurice Diamantini
2004-12-24 14:23 ` Mojca Miklavec
2004-12-25 19:03   ` John Culleton
2004-12-26 20:57     ` h h extern
2005-01-03 15:13       ` Maurice Diamantini
2005-01-03 17:02         ` Hans Hagen
2005-01-03 14:52     ` Maurice Diamantini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=067F33B3-5D97-11D9-B03E-000A9595B57C@ensta.fr \
    --to=maurice.diamantini@ensta.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).