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]

? 
einpoklum
  • 12,311

1 Answers1

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.

einpoklum
  • 12,311
  • 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 04 '19 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 04 '19 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 04 '19 at 14:22
  • @egreg: Is that what I get if I simply download TeXLive directly? Or is there some "annual TUG distro"? – einpoklum Oct 04 '19 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 04 '19 at 17:29