2

Not really a problem, but I noticed this when pruning stuff from a document preamble to find a problem I was having. I've found the problem but also something a bit weird

Just the act of importing the package algorithm is changing the position of floats (I've tested tables and figures)

\documentclass[]{article}

\usepackage{algorithm}

\begin{document}
    \begin{table}[H]
        \caption{I'm here}
    \end{table}
\end{document}

If I comment the \usepackage{algorithm} line, the caption moves from the top of the page to the middle

Would there be conflicts between definitions or something? Is it normal/acceptable for this to happen?

I've tested this with pdflatex and xelatex and it behaves the same way

1
  • Without algorithm (or some other package such as float, which I think algorithm loads internally) you don't have access to the H placement specifier which removes flotation. From LaTeX2015 on your code without loading algorithm throws an error. Aug 27, 2015 at 20:14

1 Answer 1

2

algorithm uses the float package which defines a H float specifier. Without loading algorithm, your

\begin{table}[H]
  ...
\end{table}

actually produces an error stating "Unknown float option H".

LaTeX does recover from this error though and then defaults to something different, which changes the display to a page-of-floats-like layout (which has the float centred vertically).

4
  • The error only appears using the kernel's 2015 version. Before, there was no error and not even a warning which is why the OP was surprised. Aug 27, 2015 at 20:19
  • Yes, I'm not seeing any errors or warnings. Should I update LaTeX?
    – gsmafra
    Aug 27, 2015 at 20:20
  • @gsmafra: It's good to live in the present. Either way, the output differs based on the (non-)existing of the float specifier H. The most recent release of LaTeX includes (by default) fixltx2e, which updated \@xfloat - a macro responsible for throwing errors based on unknown float options (in addition to other things as well).
    – Werner
    Aug 27, 2015 at 20:25
  • Python 3 was released in 2008 and people still use 2.7 to avoid compatibility issues. It could be a dumb comparison, I don't really know what changes from one version to another in LaTeX
    – gsmafra
    Aug 27, 2015 at 20:33

You must log in to answer this question.

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