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

  • 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. – Gonzalo Medina Aug 27 '15 at 20:14
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).

  • 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. – Gonzalo Medina Aug 27 '15 at 20:19
  • Yes, I'm not seeing any errors or warnings. Should I update LaTeX? – gsmafra Aug 27 '15 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 '15 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 '15 at 20:33

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.