Re: [NTG-context] Algorithmic, Floats and line numbers.

2016-10-27 Thread Wolfgang Schuster

Mohammad Hossein Bateni 
27. Oktober 2016 um 17:59
How does one reset the counter then?  Normally one would like it to 
start from 1 within each algorithmic block.  But definelabel seems to 
have bytext and bysection options only.



You can use \resetcounter[algorithmicline] to reset the counter value.

Wolfgang
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Algorithmic, Floats and line numbers.

2016-10-27 Thread Mohammad Hossein Bateni
How does one reset the counter then?  Normally one would like it to start
from 1 within each algorithmic block.  But definelabel seems to have bytext
and bysection options only.

On Wed, Oct 26, 2016 at 2:00 PM, Wolfgang Schuster <
schuster.wolfg...@gmail.com> wrote:

> Javier M Mora 
> 24. Oktober 2016 um 14:37
> Hi, I'm trying to use Algorithmic module with floating and line numbering.
>
> In the first attempt, I get the "code" with lines numbered. But isn't
> floating.
>
> In the second one, line numbers disappear inside the floating block.
>
>
> Two questions:
>
> * How can I get line numbers inside floating block?
>
> You can’t use them in floats unless you add a frame around the content,
> e.g.
>
> \startplacealgorithm
> \startframedtext
> \startlinenumbering
> ...
> \stoplinenumbering
> \stopframedtext
> \stopplacealgorithm
>
> * In algorithms, I think it has more sense to number only "logical" lines.
> The second state is so long that wraps into another line. Is it possible to
> number only logical lines?
>
> Not with linenumbering, what you need is counter which is inserted at the
> begin of each line.
>
> \definelabel[algorithmicline][text=,alternative=inleft]
>
> \definelines[algorithmic][command=\algorithmicline]
>
> \setuplayout[width=4cm]
>
> \showframe[text][text]
>
> \starttext
>
> \startalgorithmic
> text
> text text text text text text text text text text text text
> text
> \stopalgorithmic
>
> \stoptext
>
> Wolfgang
>
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> 
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Algorithmic, Floats and line numbers.

2016-10-26 Thread Wolfgang Schuster

Javier M Mora 
24. Oktober 2016 um 14:37
Hi, I'm trying to use Algorithmic module with floating and line 
numbering.


In the first attempt, I get the "code" with lines numbered. But isn't 
floating.


In the second one, line numbers disappear inside the floating block.


Two questions:

* How can I get line numbers inside floating block?

You can’t use them in floats unless you add a frame around the content, e.g.

\startplacealgorithm
\startframedtext
\startlinenumbering
...
\stoplinenumbering
\stopframedtext
\stopplacealgorithm
* In algorithms, I think it has more sense to number only "logical" 
lines. The second state is so long that wraps into another line. Is it 
possible to number only logical lines?
Not with linenumbering, what you need is counter which is inserted at 
the begin of each line.


\definelabel[algorithmicline][text=,alternative=inleft]

\definelines[algorithmic][command=\algorithmicline]

\setuplayout[width=4cm]

\showframe[text][text]

\starttext

\startalgorithmic
text
text text text text text text text text text text text text
text
\stopalgorithmic

\stoptext

Wolfgang
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Algorithmic, Floats and line numbers.

2016-10-24 Thread Javier M Mora

Hi, I'm trying to use Algorithmic module with floating and line numbering.

In the first attempt, I get the "code" with lines numbered. But isn't 
floating.


In the second one, line numbers disappear inside the floating block.


Two questions:

* How can I get line numbers inside floating block?

* In algorithms, I think it has more sense to number only "logical" 
lines. The second state is so long that wraps into another line. Is it 
possible to number only logical lines?



This is my little test file:

\starttext

\usemodule[algorithmic]

%% First Attempt
\startalgorithmic[numbering=yes]
  \STATE a = 2
  \STATE this line is really very large. Very very very very very very 
very very very very very large

  \STATE this is the real third state.
\stopalgorithmic

\definefloat[algorithm][algorithms]
\setupfloat[algorithm][
  background=color,
  backgroundcolor=gray,
]

%% Second Attempt
\startplacealgorithm[title={Floating algorithm}]
  \startalgorithmic[numbering=yes]
\STATE a = 2
\STATE this line is really very large. Very very very very very very
very very very very very large
\STATE this is the real third state.
  \stopalgorithmic
\stopplacealgorithm

\stoptext


Thanks.

jmmora.
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___