Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the package algorithm2e. I have a document with several algorithms. I use the float position option [ht], but all my algorithms are positioned at the end of the chapter; none at the position or on the next page. I tried the package float as suggested in this post Floating an algorithm?. But the algorithms looked very different and wrong after that. Does anyone have an idea how I position my algorithms at 'here' or the top of the next page?

share|improve this question
    
For any kind of float, using an optional argument that does not include p vastly increases the chance of floats going to the end of document. Perhaps [!htp] will do what you want. –  David Carlisle Nov 25 '12 at 19:30
    
Ok they are not at the end anymore, but also not really flaoted. There is no text around them on some pages. Is that not possible? –  Jana Nov 25 '12 at 19:38
    
well that's a float page (p) whether the floats fit on text pages depends what else is there and you haven't shown. But if they are large (say more than half a page) it gets hard to fit them in if there are other unbreakable objects such as section heads or images. the ! says to ignore all stylistic constraints like number of floats allowed per page so latex will fit them if it thinks they physically fit without leaving the page breaks unacceptably bad. –  David Carlisle Nov 25 '12 at 19:43
add comment

1 Answer

up vote 3 down vote accepted

For any kind of float, using an optional argument that does not include p vastly increases the chance of floats going to the end of document. Perhaps [!htp] will do what you want.

Here ! says LaTeX should ignore most of the stylistic constraints such as the proportion of the page allowed for floats or the number of floats per page and so it will place the floats if the page breaks are not unacceptably bad.

Note [!htp] disallows bottom floats you could also use [!ht] which would disallow page floats but whenever you shorten the optional argument in this way you remove some possibilities for float positioning so make it more likely the float can not be positioned at all in which case it will be held up until end of document.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.