add tag
3 years ago निरंजन

I want to use a floating entity as in some material which can be printed with positioning parameters irrespective of where it appears in the code, I know the float package, but the approach it uses is a bit over the top for me as I don’t want the counting mechanism, \listof{x} command, generating auxiliary files and so on. Is there any standard LaTeX method for developing such custom floats and positioning them? If there isn’t any, what could be the lightest way of developing such a float which essentially does nothing but positioning of material? Note that I don’t want to tinker with table and figure. I want to keep it separate.

Top Answer
3 years ago Joseph Wright

You just have to follow the model in e.g. article.cls for figures or tables:

Note that this is basically what float does, it just makes it easier to set up. Notice we do need to set up various things to make sure that mechanisms still work: we have for example to have a file extension for recording the new float type, even if you don’t want to use it.

3 years
Joseph Wright replying to Skillmon — Monday, 7th Nov 2022 14:13

One to ask Frank 😉

an hour
Skillmon — Monday, 7th Nov 2022 12:44

@Joseph is it possible that the handling fo the type changed? I was somewhat sure that it was a bitmask, and the current source2e states the following at the start of ltfloat.dtx:

Each ⟨type⟩ has associated a positive ⟨type number⟩, which is a power of two. E.g.,
figures might be have type number 1, tables type number 2, programs type number 4, etc.

And this type number is used to determine floats which should not “overtake” earlier floats (if they have the same type number). But I thought this was compared on a bit-basis, but it seems it isn’t, as for 3 your schemes don’t collide (so might overtake) figures or tables…

7 hours
निरंजन replying to Joseph Wright — Monday, 7th Nov 2022 05:56

Okay. If you say this is the same thing that package float does, then I would simply load it, but of course thanks for showing the detailed bare bone example for my question.

5 days
Skillmon — Wednesday, 2nd Nov 2022 08:49

(it’s a bitmask, if you want it collision free from table – 2 – and figure – 1 – you must not set any bit set by them, hence 4)

Skillmon — Wednesday, 2nd Nov 2022 08:43

@Joseph, re: your answer, your \ftype@scheme should be 4, not 3.

18 hours
Joseph Wright replying to निरंजन — Tuesday, 1st Nov 2022 14:33

The float mechanism is non-trivial: I really don’t think you are making life easier by re-coding from scratch to avoid needing things like \ext@<type> to exist

निरंजन — Tuesday, 1st Nov 2022 14:27

@Joseph, thanks a lot for the answer. I am assuming the mechanism you are referring to is the pair of \@float and \end@float (correct me if I am wrong). I saw that these two also have some definition in source2e which I found a bit difficult to understand, but I was thinking can the code for these two be copied to a new mechanism which requires lesser things and just floats the given material without asking for the caption-line, the counter, the file extension and so on?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.