2

I'm trying to switch my document from using the float and subfig packages to using subcaption. The thing is, I want to have \begin{figure}[H], which I had before; but now I get:

! LaTeX Error: Unknown float option `H'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.844 \begin{figure}[H]

What should I do? If I can't make this option available to me, can I achieve the same effect some other way (e.g. wrapping the float in a minipage? Something less ugly?)

  • the H option is defined by the float package, if you stop using that package, stop using H – David Carlisle Jul 16 '17 at 22:22
  • @DavidCarlisle: See edit... – einpoklum Jul 16 '17 at 22:27
  • you could just use a minipage (since H more or less just makes the figure a minipage and not a float) but can you not use the float package in conjunction with subcaption? – David Carlisle Jul 16 '17 at 23:04
  • @DavidCarlisle: If I try to, I get the dreaded ` LaTeX Error: Command \float@end already defined.` error. – einpoklum Jul 16 '17 at 23:09
  • as always, if you want help with an error post an example that makes it:-) (too late to look tonight but someone can) – David Carlisle Jul 16 '17 at 23:12
3

Actually, the float package is compatible with subcaption. You just need to make sure and \usepackage{float} in the right place - namely, before \usepackage{hyperref} --- as otherwise you get an error.

When you do that, your \begin{figure}[H]'s will be positioned like they used to with no complaints.

Thanks @DavidCarlisle.

  • Even with float before hyperref, I get the error. The only solution for me was to remove subcaption. – Martin Monperrus Oct 4 '19 at 6:47
  • Same experience here on the newest versions of texlive. What have you replaced subcaption with @MartinMonperrus ? – Andrzej Wąsowski Oct 21 '19 at 7:42

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.