0

I'm trying to use the subcaption package with an old Elsevier template, but I get the following error

(caption)                standard defaults will be used.
See the caption package documentation for explanation.

) /usr/local/texlive/2020/texmf-dist/tex/latex/caption/subcaption.sty:71: Illegal parameter number in definition of @tempa. <to be read again> 1 l.71 ...achCaptionType{\DeclareCaptionSubType{#1}}

The code is very simple at this stage as it doesn't have any packages:

\documentclass[book,numbers]{elsbook-A07b}
\usepackage{caption}
\usepackage{subcaption}

I have absolutely no idea what's causing the error as I've worked with the subcaption package for years without problem. I can't really include an MWE since that would include the whole template. I also know I shouldn't mess with the subcaption.sty file. I am wondering whether there's anything I can try to get rid of this error?

aaragon
  • 3,041
  • could you add more code? I cant guess how are you using the subcaption. – scd Oct 09 '20 at 10:43
  • 1
    You shouldn't use caption with Elsevier classes: this is the meaning of the warning that's partially visible at the top. The people at Elsevier don't want that users fiddle with their preferred style. This said, you can use subfig for subfloats, loading it with \usepackage[caption=false]{subfig}. Check its documentation for the syntax. – egreg Oct 09 '20 at 10:43
  • @egreg if I remove the caption package I get the same error, I guess perhaps because subcaption loads caption correct? What would you use instead of subcaption? I know it's supposed to be the best package for subfigures. – aaragon Oct 09 '20 at 10:45
  • 1
    @aaragon subcaption is indeed based on caption, so loading only the former is the same as loading both. Neither should be used with that class. On the other hand, nobody can test for possible workarounds, because the class is not avaliable. – egreg Oct 09 '20 at 10:46
  • @SergioCavero I don't think I'm allowed to share the file elsbook-A07b.cls. Any my code is as small as I wrote at this point (just adding the package). – aaragon Oct 09 '20 at 10:49
  • @egreg I've seen all over the internet the subfig package is not good. Apparently the package doesn't work with hyperref see here. What is your take on that? – aaragon Oct 09 '20 at 11:01
  • Ask the people at Elsevier. – egreg Oct 09 '20 at 11:27
  • Yeah, just did. I’ll post something here if useful for others. – aaragon Oct 09 '20 at 11:27
  • You could try asking the maintainer of the subcaption package, too. –  Oct 09 '20 at 13:10

0 Answers0