3

I would like to make all floats (in particular figures) to be somewhat distinct from the text. For this, I am adding \hrulefill above and below the figure/table. This looks nice when a figure is in the middle of the page, with paragraphs above and below, but less so when the figure is by itself or at the top or bottom of the page.

Is it possible to know where a figure was positioned, such that I can specify

if at top: show bottom rule only
if at bottom: show top rule only
if in middle: show both
if placed on whole page by itself: show none

Is that possible?

1

The standard latex approach to this is not to put the rules in the float but to define \topfigrule and \botfigrule to make horizontal rules. By default these commands do nothing but (for example) \topfigrule is executed after the last float added to the top of a page, before the text.

The latex sources document these as

   \topfigrule     : Command to place rule (or whatever) between floats
                     at top of page and text.  Executed in inner
                     vertical mode right before the \textfloatsep skip
                     separating the floats from the text.  Must occupy
                     zero vertical space.  (See \footnoterule.)
   \botfigrule     : Same as \topfigrule, but put after the
                     \textfloatsep skip separating text from the
                     floats at bottom of page.

Your Answer

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

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