2

The LaTeX document (documentclass:article) is having sections and subsections. The figures are to be placed to appear in the desired subsection only. I am using

\usepackage[section]{placeins} 

It forces to appear figures in the respective section. I want something like

\usepackage[subsection]{placeins} 

which will force LaTeX to place images in subsection rather than in section. How could this be done?

5
  • How about option [H] for the intended figure(s)?
    – user78499
    Commented Oct 23, 2017 at 2:47
  • It doesn't work...even with or without placeins
    – user61681
    Commented Oct 23, 2017 at 2:48
  • It doesn't work?! Easy to say when there is no MWE!
    – user78499
    Commented Oct 23, 2017 at 2:48
  • YOU decide where the figures are placed. You can let LaTeX make the decision where to place a figure, which seems not to be what you want
    – Johannes_B
    Commented Oct 23, 2017 at 4:57
  • @user61681 [H] need the float package. Anyway, we aware that force float positions too much could have sides effects in the layout worse that left a figure out of the subsection where it is referenced.
    – Fran
    Commented Oct 23, 2017 at 8:20

1 Answer 1

6

The following is what worked for me.

  \usepackage{placeins}
    ...
    \begin{figure}
    ...
    \end{figure}
    \FloatBarrier

The command Floatbarrier is to be included after end{figure} This forced every image to appear in the respective subsection. I know it is not in the spirit of LaTeX to use this. However it might be requirement sometimes...

1
  • This causes an almost undebuggable Output routine didn't use all of \box255 error for my simple use-case :(
    – Anti Earth
    Commented Jan 29, 2022 at 4:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .