2

Consider the following document:

\documentclass{article}
\usepackage{subcaption}
\usepackage{float}
\begin{document}
\begin{figure}[H]
  \caption{A caption.}
\end{figure}
Some text after the figure.
\end{document}

Until recently, this compiled fine on my Devuan Beowulf (~= Debian Buster) system. Then after an apt-get dist upgrade a month and a half ago, it stopped compiling, complaining about the H placement:

 LaTeX Error: Unknown float option `H'.

However, on my laptop, with Ubuntu 18.04.3 (Bionic) - it continues to work.

Why could this be happening? And - how can I circumvent this?

Notes:

Effect of source tweaking

  • If I remove the \usepackage{subcaption} - it works.
  • If I move the \usepackage{subcaption} after the float - it still doesn't work.
  • If I replace [H] with [h] - it works.

TeXLive versions

  • New broken system: 2018.20190227-2
  • Working laptop system: 2017.20180305-1

Full log:

Latexmk: This is Latexmk, John Collins, 18 June 2019, version: 4.65.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex --shell-escape  -recorder  "a.tex" -file-line-error -synctex=1'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
 \write18 enabled.
entering extended mode
(./a.tex
LaTeX2e <2018-12-01>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/caption/subcaption.sty
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/float/float.sty) (./a.aux)

! LaTeX Error: Unknown float option `H'.

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

l.5 \begin{figure}[H]

? 
  • 2
    you probably need to update the float package on the system where it doesn't work. (It works in a fully updated texlive 2018 and in texlive 2019) – David Carlisle Oct 4 at 11:12
  • It also works in Texlive shipped with Debian buster. Might it be that you haven't upgraded all texlive related packages during the upgrade? – Sergei Golovan Oct 4 at 11:41
  • @DavidCarlisle: I just did that, and it still doesn't work. – einpoklum - reinstate Monica Oct 4 at 12:01
  • You are using a local (possibly changed) copy of float.sty. Try removing that. Well, you were, now you edited it out... – LaTeXer Oct 4 at 12:01
  • 1
    if you put \tracingmacros1 as the first line of the test file above you should get a 3Mb log file which you could zip up and send to me (google my name for a gmail address) (oh or pastebin is OK) – David Carlisle Oct 4 at 12:39
3

tl;dr : Your distro packaged a bad version of caption.sty.

This is due to your machine using a particularly inopportune version of the Debian SID texlive-latex-recommended package. A bug in caption.sty resulted in this failure; while it was promptly fixed, the texlive-latex-recommended package picked up the buggy caption.sty.

If you download an up-to-date versions of the the subcaption package, and place it your local texmf tree - the document should compile fine.

Also - check your /etc/apt/sources.list. There was a known glitch in some scenarios of upgrading to Devuan Beowulf which put APT lines for the Devuan Unstable repositories (ceres rather than beowulf) in the APT sources.


Thanks @DavidCarlisle for pointing me in that direction and @PhelypeOleinik for pinpointing the exact bug.

  • It was a bug in caption.sty. Your version had \def\@xfloat#1[#2]{\caption@ORI@xfloat{#1}[{#2}]\caption@settype{#1}}, while the new has \def\@xfloat#1[#2]{\caption@ORI@xfloat{#1}[#2]\caption@settype{#1}}. This made the \@ifnextchar test see the extra { instead of H when looking for it. – Phelype Oleinik Oct 4 at 13:37
  • 2
    More on that: The bug was reported here, and it apparently lasted one single day on CTAN. Your debian packaging chose the wrong day to update its version :-) – Phelype Oleinik Oct 4 at 13:39
  • Installing the “vanilla TUG” TeX Live is a one-time-a-year burden. It allows you to update packages without waiting for Debian do it; and you'll have the last stable version of TeX Live. – egreg Oct 4 at 14:22
  • @egreg: Is that what I get if I simply download TeXLive directly? Or is there some "annual TUG distro"? – einpoklum - reinstate Monica Oct 4 at 17:20
  • @einpoklum TeX Live is released once a year. Packaged versions provided by GNU/Linux distributions may (and usually do) lag behind. – egreg Oct 4 at 17:29

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.