caption package needs to patch the commands
\@makecaption, the first ones are defined by the LaTeX kernel (but sometimes overwritten by document classes like
revtex4-1), and the latter one is defined by the document class.
Unfortunately there are no guidelines on how to patch internal LaTeX commands, and the concept "LaTeX packages" is only designed for packages which extends LaTeX without patching internal LaTeX code. So packages like
caption cannot be implemented in a clean and compatible way, it's simply an impossible task.
Basically there are four different methods on how to patch existing commands anyway:
- Save the old definition, and make the new definition use the old one, too.
- Patch the command with
\patchcmd (or a different command) offered by the
- Redefine the definition without saving and using the old one. But try to build-in as many definitions offered by document classes and/or other packages as possible.
- Simply redefine the definition without saving and using the old one.
The method chosen deeply affects how compatible is your definition with other packages which either redefines the command, too, or rely on a specific behavior of that command. That's one of the many reasons why there are so many incompatibilities between different LaTeX packages resp. LaTeX document classes and packages.
caption package used to use the method 1 until version 3.0. But since so many document classes and packages re-define
\@caption itself this method has lead to a way which was not maintainable. So starting with version 3.1 the
caption package uses method 3. And to make sure it does not overwrite any functionality it checks if
\@makecaption are known before the redefinition takes place. If it finds an unknown definition it refuses to redefine
\@caption, making sure that the
caption package either works as expected or drops an
incompatible message to the user, falling back to an "compatibility mode" offering only functionality which was already offered by version 1.0 of the package which did not patched
\caption. (And since the
subcaption package relies on the patched versions of
\@caption it refuses to work at all.)
BTW: Luckily most LaTeX packages the
caption package is adapted to are dead/unmaintained, otherwise it would take very much time to keep track of internal changes within these packages. Which basically means packages like
caption could only be realized because most of the other LaTeX packages are already dead!
As consequence any document class (or package which redefines
\@caption) is considered as "incompatible" as long as the
caption package isn't adapted to it.
Now back to your questions:
revtex4-1 class is incompatible with the
subcaption package? Because the
caption package isn't adapted to the revtex4-1 document class yet.
Can this incompatibility be fixed easily? I don't know. For answering this I had to take a closer look at the sources of
However, currently adapting the
caption package to a document class means enhancing the
caption package itself. This will change with the upcoming version 3.4 of the
caption package which will offer a documented interface for these adaptions, so more people (or the author of the document class herself/himself) can offer these adaptions.