In a two column mode, \begin{algorithm} spans over a single column, while \begin{algorithm*} spans over the entire page.

But what if I want it to span a fixed size, e.g., 0.5\linewidth?

I am specifically interested in the algorithm environment, since (unlike figure or table) it has headers and footers (horizontal lines) that span over the float area. I was able to limit the content of the float (e.g., using a minipage), but not the float itself.

For instance, if \begin{algorithm*} is used, we get: wrong output What I am trying to get, is a narrower algorithm, where all the space in the middle is gone (the lines should be half their current length, say). The algorithm should still be placed at the top, centered, and the rest of the text follow in two-column like in the example.

The closest I was able to get close was by using \onecolumn+fullwidth[width=0.5\linewidth]+\twocolumn but this forced the float on its own page; also the centering was terrible to handle. Would be very happy to learn how to get the desired output.

  • 1
    Your question is not very clear (an example would help) but a float can only be the width of a column or the width of the page, you can not span 1 and a half columns. – David Carlisle May 25 '19 at 18:31
  • @DavidCarlisle I hope this is more clear now – Ran G. May 25 '19 at 19:30
  • 1
    you could put the algorithm in a minipage that is less than full width and centre it or place it flush left or whatever, if you provided an example someone would suggest changes. – David Carlisle May 25 '19 at 19:37
  • Assuming you are using the algorithms package, algorithm is a float, but algorithmic is not. See also tex.stackexchange.com/questions/394825/… – John Kormylo May 26 '19 at 0:49
  • @john I think that re-defining the algorithm float should work. I'll give it a try. (the algorithmic inside is irrelevant--this is what i called the content; my problem is with the float, as said above) – Ran G. May 26 '19 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.