# Error using pdfx package with subcaption package (introduced by the chkfloat package)

I am using pdfx with the a-1b option to comply with my university's requirements for PhD thesis.

According to the pdfx package's documentation, this package must be loaded first.

However, this produces the following error when processed by luatex (TL 2018)

! Package caption Error: The subcaption' package does not work correctly (caption) in compatibility mode.

The caption package's documentation strongly discourages (to the point of scaring off the user) the use of compatibility=false option. How can we get around this issue?

### Update:

I have narrowed this down to the chkfloat package. The aforementioned error message shows up only when the package is loaded.

Here is a MWE to reproduce the issue.

\documentclass[british]{article}
\usepackage[a-1b]{pdfx}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[margin=10pt,font=small,labelfont={bf},labelsep=quad]{caption} % for improved layout of figure captions with extra margin, smaller font than text
\usepackage{chkfloat}  % <---- Commenting this out removes all errors. If this line is included, an error '! Package caption Error: The subcaption' package does not work correctly (caption) in compatibility mode.'
\usepackage{subcaption}
\begin{document}
Lorem ipsum.
\end{document}


If the \usepackage{chkfloat} line is commented, the document compiles fine. What might be a good workaround?

• Can you show a minimal example? \documentclass[british]{article} \usepackage[a-1b]{pdfx} \usepackage{babel} \usepackage{csquotes} \usepackage{subcaption} \begin{document} Lorem ipsum. \end{document} compiles without any errors for me with LuaLaTeX. – moewe Aug 29 '18 at 18:02
• @moewe Yes, thank you for the prompt to include a MWE. This was tremendously useful. From my huge preamble, I have bisected and pruned off irrelevant packages, until I narrowed it down to the chkfloat package. I have updated the question with this information and a MWE. Looks like a bug with this package. – Krishna Aug 29 '18 at 19:45
• @Krishna and exactly that is the main advantage of (really minimal) MWEs. The fact that we can only correctly help with one is only a side effect. – Skillmon likes topanswers.xyz Aug 29 '18 at 19:47
• pdfx loads hyperref earlier (which can be a problem as you normally should load hyperref rather late) that's why you get the error when you load pdfx. – Ulrike Fischer Aug 29 '18 at 20:14
• Using compatibility=false would make the caption package work, but this would override the re-definition of \@caption and therefore disable the functionality of the chkfloat package. I could offer a hack to make it work anyway, but I would prefer the proper solution: Adapt the caption package to the chkfloat package. Will do so next Sunday. Please hold the line... gitlab.com/axelsommerfeldt/caption/issues/34 – user2574 Aug 30 '18 at 6:55

I have just adapted the caption package bundle to the chkfloat package:
Submission of a new version of the caption package bundle including this fix is planned for Sunday. Until then, one can get the new files here: https://gitlab.com/axelsommerfeldt/caption/tree/3.3/tex