0

I have 66 algorithms in a paper to typeset, of varying sizes up to about a page, and with varying ratios of text:figure. They will be completely incomprehensible if they are not in order, and reasonably close to the body text that explains what they do and why. However, because there are so many, they jump around a lot in the typesetting.

I would like to define an environment that will not float at all, and will put the figure exactly where I tell it, no matter how much white space it needs to add. In a final draft, I will manually shuffle them around if need be. Is there any way to do this?

  • 2
    Environments defined with \newenvironment don't float per default. It seems to me that in your code the algorithms are placed inside boxes that float. Can't you just not do that and take them out of these floating boxes? – Jasper Habicht Jul 15 '22 at 11:33
  • 1
    you can use the H float type to get non-floating floats. But normally you get better results if you let them float but adjust the float parameters, see https://tex.stackexchange.com/a/39020/2388 – Ulrike Fischer Jul 15 '22 at 11:49
  • latex never floats anything by default, only if you put it in an environment that does nothig but specify a float. A tabular ever floats, a table enviroment floats whatever it has in its content. You have not given any information about which markup you are using, but presumably you have put your algorithms in a float. – David Carlisle Jul 15 '22 at 14:51
  • Try the tcolorbox listing environment: it was designed for your use-case. – Cicada Jul 15 '22 at 15:17
  • Cross-references (\label{}, \ref{}, \pageref{}) and numbered captions mainly exist to not need to place tables and figures just where they are explained in text, and it is a good compromise to maintain a logical read flow and a good document layout, that is very normal in most good books, On the other hand, if you allow the maximal flexibility in floats options (e.g., [htbp!]) you probably will obtain fewer and shorter jumps. – Fran Jul 15 '22 at 16:37
  • Top comment had it: there was a float I hadn't noticed in the definition of the new environment! [H] and [htbp!] weren't enough. While at some later draft it might be more clear to have things float, it's nightmarish to try to edit a document where figures are 40+ pages away from where they are referenced. – Sam Jaques Jul 20 '22 at 13:21

0 Answers0