Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2005-01-03 Thread Maurice Diamantini
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2005-01-03 Thread Maurice Diamantini
Le 26 déc. 04, à 21:57, h h extern a écrit :
Christmas present ...
Thank you Hans for this present !!
I just had to search the key to open this present,
as I used an old ConTeXt version
So I'm trying to switch to the texlive-2004 distribution
(choosing the GUTenberg installation set)
After some setup (m-bib has changed, ...)
I could try your code and...
*** it does exactly what I need ! ***
Thank you very much !
Just a question.
As you keep calling this environment \startline I suppose
it is intended to be a standard option for \startline
(which is a great news as I think it is quite usefull for
numerous situations)
But as the new version of context is not yet in the texlive-2004
(or as texlive-2005 is not yet out ;-)
Would it not be a better idea to provide another environnement name
to avoid conflict with the future standard startline environment?
I tried to rename startlines to startLines with other hack,
but it doesn't seem to be suffisant (but I didn't expect to!).
Any way thank you for the solution !
\unprotect
\setuplines[\c!space=\v!default]
\def\startlines
  {\@@rgbefore
   \whitespace
  %\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak
   \begingroup
   \def\@@rgstepyes{\parindent\zeropoint}%
   \def\@@rgstepno {\parindent\zeropoint}%
   \edef\@@rgparindent{\the\parindent}%
   \globallet\@@rglinesteptoggle\!!plusone
   \processaction
 [\@@rgindenting]
 [  \v!yes=\def\@@rgstepyes{\parindent\@@rgparindent}%
\def\@@rgstepno {\parindent\@@rgparindent},
\v!odd=\def\@@rgstepyes{\parindent\zeropoint}%
\def\@@rgstepno {\parindent\@@rgparindent},
   \v!even=\def\@@rgstepno {\parindent\zeropoint}%
\def\@@rgstepyes{\parindent\@@rgparindent}]%
   \typesettinglinestrue
   \setupwhitespace[\v!none]%
   \obeylines
   \let\checkindentation\relax
   \@@rgstepno
   \ignorespaces
   \gdef\afterfirstobeyedline % tzt two pass, net als opsomming
 {\gdef\afterfirstobeyedline
{\nobreak
 \global\let\afterfirstobeyedline\relax}}%
   \def\obeyedline
 {\par
  \let\checkindentation\relax % else problems with odd/even
  \afterfirstobeyedline
  \ifdim\lastskip\zeropoint
\globallet\@@rglinesteptoggle\!!zerocount
  \else
\doglobal\increment\@@rglinesteptoggle
  \fi
  \ifodd\@@rglinesteptoggle\relax
\@@rgstepyes
  \else
\@@rgstepno
  \fi
  \futurelet\next\dobetweenthelines}%
\processaction
  [\@@rgspace]
  [ \v!on=\obeyspaces
   \def\obeyedspace
 
{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}},
   \v!yes=\obeyspaces
   \def\obeyedspace
 {\mathortext\normalspace{\dontleavehmode\normalspace}}]%
   \GotoPar}

\protect
\starttext
\startlines
test
  test
test $a = 10$
\stoplines
\setuplines[space=on]
\startlines
test
  test
test $a = 10$
\stoplines
\setuplines[space=yes]
\startlines
test
  test
test $a = 10$
\stoplines
test
  test
test $a = 10$
\stoptext

==
Maurice Diamantini wrote:
 Well I agree that it's no more typing any more!
 So a special option for \setuplines would be more appropriate?

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2005-01-03 Thread Hans Hagen
Maurice Diamantini wrote:
Le 26 déc. 04, à 21:57, h h extern a écrit :
Christmas present ...


Would it not be a better idea to provide another environnement name
to avoid conflict with the future standard startline environment?
I tried to rename startlines to startLines with other hack,
but it doesn't seem to be suffisant (but I didn't expect to!).
no, just the same command, but with an option:
\setuplines[space=on]
if there is real demand for it i can always make a
\definelines[lines]
\definelines[Lines][space=on]
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
-
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2004-12-27 Thread h h extern
Christmas present ...
\unprotect
\setuplines[\c!space=\v!default]
\def\startlines
  {\@@rgbefore
   \whitespace
  %\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak
   \begingroup
   \def\@@rgstepyes{\parindent\zeropoint}%
   \def\@@rgstepno {\parindent\zeropoint}%
   \edef\@@rgparindent{\the\parindent}%
   \globallet\@@rglinesteptoggle\!!plusone
   \processaction
 [\@@rgindenting]
 [  \v!yes=\def\@@rgstepyes{\parindent\@@rgparindent}%
\def\@@rgstepno {\parindent\@@rgparindent},
\v!odd=\def\@@rgstepyes{\parindent\zeropoint}%
\def\@@rgstepno {\parindent\@@rgparindent},
   \v!even=\def\@@rgstepno {\parindent\zeropoint}%
\def\@@rgstepyes{\parindent\@@rgparindent}]%
   \typesettinglinestrue
   \setupwhitespace[\v!none]%
   \obeylines
   \let\checkindentation\relax
   \@@rgstepno
   \ignorespaces
   \gdef\afterfirstobeyedline % tzt two pass, net als opsomming
 {\gdef\afterfirstobeyedline
{\nobreak
 \global\let\afterfirstobeyedline\relax}}%
   \def\obeyedline
 {\par
  \let\checkindentation\relax % else problems with odd/even
  \afterfirstobeyedline
  \ifdim\lastskip\zeropoint
\globallet\@@rglinesteptoggle\!!zerocount
  \else
\doglobal\increment\@@rglinesteptoggle
  \fi
  \ifodd\@@rglinesteptoggle\relax
\@@rgstepyes
  \else
\@@rgstepno
  \fi
  \futurelet\next\dobetweenthelines}%
\processaction
  [\@@rgspace]
  [ \v!on=\obeyspaces
   \def\obeyedspace
 {\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}},
   \v!yes=\obeyspaces
   \def\obeyedspace
 {\mathortext\normalspace{\dontleavehmode\normalspace}}]%
   \GotoPar}
\protect
\starttext
\startlines
test
  test
test $a = 10$
\stoplines
\setuplines[space=on]
\startlines
test
  test
test $a = 10$
\stoplines
\setuplines[space=yes]
\startlines
test
  test
test $a = 10$
\stoplines
test
  test
test $a = 10$
\stoptext

==
John Culleton wrote:
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)
In plain TeX you have a command \obeyspaces (apart from \obeylines).
Nevertheless, whitespaces at the beginning of line are ignored when
using \obeyspaces, so you additionally need to write an escaped
whitespace '\ ' or \strut at the beginning of line (I guess there's a
more efficient solution for that, but I'm no expert).
But if you really only need whitespace at the beginning of line,
probably make something like:
\def\tab{\strut\hbox to 3em{}} % or any other size instead 3em
instead of using \obeyspaces and simply put \tab where you need a
certain amount of white space.
Mojca
Using eplain.tex you can say:
\verbatim
|endverbatim
(note bar instead of backslash.)
If you need a vertical bar in the verbatim text then just double it. 

Anything in between including blank spaces and lines is printed verbatim.
Context used to complain about one non-critical statement in the eplain file.  
Actually it complains about the following statement but you can easily spot 
the troublemaker. Delete it and eplain works fine with Context.  Latest 
versions of eplain may already have the fix, haven't tested them.  


--
-
  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
-
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2004-12-25 Thread John Culleton
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)

 In plain TeX you have a command \obeyspaces (apart from \obeylines).
 Nevertheless, whitespaces at the beginning of line are ignored when
 using \obeyspaces, so you additionally need to write an escaped
 whitespace '\ ' or \strut at the beginning of line (I guess there's a
 more efficient solution for that, but I'm no expert).

 But if you really only need whitespace at the beginning of line,
 probably make something like:
  \def\tab{\strut\hbox to 3em{}} % or any other size instead 3em
 instead of using \obeyspaces and simply put \tab where you need a
 certain amount of white space.

 Mojca

Using eplain.tex you can say:
\verbatim

|endverbatim
(note bar instead of backslash.)

If you need a vertical bar in the verbatim text then just double it. 

Anything in between including blank spaces and lines is printed verbatim.
Context used to complain about one non-critical statement in the eplain file.  
Actually it complains about the following statement but you can easily spot 
the troublemaker. Delete it and eplain works fine with Context.  Latest 
versions of eplain may already have the fix, haven't tested them.  

-- 
John Culleton

Short list of publishing/marketing books:
http://wexfordpress.com/tex/shortlist.pdf
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2004-12-24 Thread Maurice Diamantini
A solution of my probleme could be reformule to :
   How can I configure the \setuptyping environment to
   be able to keep the normal feature of special TeX caracters
   like:
   - \
   - { and } and [ and ]
   - $
Well I agree that it's no more typing any more!
So a special option for \setuplines would be more appropriate?
Le 24 déc. 04, à 09:07, Maurice Diamantini a écrit :
Bonjour à tous,
I'm trying to white some algorithms in natural language
(versus pseudo-computing langage)
I need to keep some typing for write space
(i.e. indentation of text) while being able to white
TeX commands (with \xxx{yyy}) and math (like $y_u(t)$)
In fact I'd like some LaTeX algorithms style like feature.
I could do some recursive \startitemize...\stopitemize...
but it is two much verbose, so I thought looking at the
ConTeXt typing system
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)
Thank you for any help!
-- Maurice Diamantini
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] algorithms style : need \starttyping with TeX and math feature

2004-12-24 Thread Mojca Miklavec
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)
In plain TeX you have a command \obeyspaces (apart from \obeylines). 
Nevertheless, whitespaces at the beginning of line are ignored when 
using \obeyspaces, so you additionally need to write an escaped 
whitespace '\ ' or \strut at the beginning of line (I guess there's a 
more efficient solution for that, but I'm no expert).

But if you really only need whitespace at the beginning of line, 
probably make something like:
\def\tab{\strut\hbox to 3em{}} % or any other size instead 3em
instead of using \obeyspaces and simply put \tab where you need a 
certain amount of white space.

Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context