Herbert Voss wrote:
> 
> Helge Hafting wrote:
> 
> > Herbert Voss wrote:
> > [...]
> >
> >>>have written some latex macros to
> >>>get the kind of listings I want, but \marginpar fails
> >>>inside a float.  Is there another way of achieving something similiar?
> >>>
> >>do you really need the floats? Or is it only the caption
> >>which is important for you? If yes, than try the nonfloat
> >>package, or controll the figure/algorithm counter by yourself.
> >>
> >
> > I need floats because the listings tend to be half a page or so,
> > causing lots of early page breaks if I use minipages.  I don't
> > want to break the page in the middle of code either.  That gets
> > awkward because I use two columns.
> 
> why do you use minipages, when you insert only listings?
> you can try

I don't use minipages now, that was something I tried before
I tried floats. Minipages merely were a way of avoiding
page breaks in the listing.

What I want:
I list two programs (different languages) side by side,
without page breaks.  Page breaks makes the code harder
to follow, and the programs are short enough.  Also, breaking
the page with multiple columns lets one program use both
columns on the first page, and that isn't what I want at all.

'Using the "multicols" and "listings" packages do this very well.
Also, I don't want pages with lots of empty space at the
end, so I stick the multicolumn listing in an algorithm float.
That cause it to float to the next page when necessary, and 
my pages fill nicely with text.

The problem is to also get the margin note, as the current
margin note implementation don't work from inside a float.
(No need for such a limitation, but I guess nobody needed
it at the time...)

The book layout was decided at a time I didn't know this
limitation.  I guess it can be changed, but getting it right
is even better.  The decision was to put figure numbers
in the margin. Similiar for algorithm numbers.

> http://www.lyx.org/help/floats/nonFloat.php3
This seems to allow page breaking which isn't what I want.
I rather need to prevent it, and have the listing move
to the next page when necessary, which is what floats do.
> 
> or package listings http://www.lyx.org/help/listings/listings.php3
I use listings (v 0.21).
> in both cases margins should be possible

Yes, I do get margin notes beside a listing, but then the
listing might break across a page.  I want to avoid that
to make the code easier to follow.  And the twocolumn listing
don't break in a useable way anyway.  In that case I want
to break both columns so one language stays in column 1
and the other in column 2.  I can do that by breaking
up long code manually and insert it in two separate floats.
None of my code examples so far need that though.

Thank you for your help so far.  Seems like this is unusual,
so I have to write my own float-marginnote or give it up.

I'll try \put'ting something sufficiently outside a picture
and try to hit the margin that way.  I guess information
about odd/even pages and current margin sizes exists
and can be extracted somehow.  That ought to give a useable
position.  There's nothing else in the margin next to
a float anyway.

Helge Hafting

Reply via email to