ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andreas Mang <mang@imt.uni-luebeck.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: framed algorithm / float: problems with line break
Date: Mon, 17 Dec 2012 13:14:51 +0100	[thread overview]
Message-ID: <CCEAAD56-2BA4-4E37-8A40-5A966F4A74C3@imt.uni-luebeck.de> (raw)

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	other threads:[~2012-12-17 12:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 12:14 Andreas Mang [this message]
2012-12-18 10:17 ` Wolfgang Schuster
2012-12-18 10:41   ` Andreas Mang

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=CCEAAD56-2BA4-4E37-8A40-5A966F4A74C3@imt.uni-luebeck.de \
    --to=mang@imt.uni-luebeck.de \
    --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).