Dear all,

Quick access: there is no line break in case algorithmic is used together with 
framed as a float.

I'd like to put some pseudocode in my document. I've used the algorithmic 
module. Since I'd like to refer to the algorithm in the text, I've defined a 
float environment. However, putting the pseudocode into my document, I've 
realised that it does not really stand out from the text. My first idea was to 
put some box around it. In the garden I've found some example for using framed 
together with floats:

http://wiki.contextgarden.net/Framed

However, this screws up the line break in the algorithmic environment. I could 
define manually the size of the box, but I think there might be better 
solutions. Any ideas or better ways for achieving this or a similar behaviour?!

Thanks in advance.

Cheers,
Andreas 

ConTeXt  ver: 2012.12.10 23:20 MKIV  fmt: 2012.12.14

%%% MINIMAL EXAMPLE %%%
\usemodule[algorithmic]


\definefloat[algorithm][algorithms] 

\setuplabeltext[de][algorithm=Algorithmus ]

\setupcaption[algorithm][
        headstyle=bold,
        location=top,
        width=0.95\textwidth]


\starttext

\placealgorithm[top][alg:some-algorithm]{Some description of some algorithm.}{
\framed
  [background=color,backgroundcolor=darkblue,
   foreground=color,foregroundcolor=white,width=broad]{
\startalgorithmic
        \STATE choose $\alpha\in(0,1)$
        \WHILE{$\alpha < 100$}
                \STATE $\alpha \leftarrow \alpha + \alpha$
        \ENDWHILE
\stopalgorithmic
}
}

\stoptext
%%% MINIMAL EXAMPLE %%%

___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to