The following MWE:
\documentclass[11pt]{memoir}
\usepackage{caption}
\captionsetup[table]{
listformat=empty,
tablename=Table,
justification=justified,
labelsep=quad,
position=above,
skip=\onelineskip,
width=\linewidth,
labelfont={small},
font={small}
}
\begin{document}
\begin{table}
\caption{A table.}
\end{table}
\end{document}
generates the error message ! Package caption Error: Can be used only in preamble
. If I comment the \captionsetup
command, there is no such error message. I know the class memoir
provides its own tools for captions, but I'd rather use the package caption
for them. Anyone could possibly shed some light on this issue?
EDIT: As soon as I comment the key tablename
, the problem disappears. But even though it works, I wouldn't call it precisely a satisfactory solution.
Best Answer
Edit: Thanks to Gonzalo Medina, I think I have an explanation.
:)
tablename
andfigurename
are indeed valid entries for\captionsetup
, as long as you are using it without the optional argument. The idea:\captionsetup
without the optional argument works globally, so it makes sense to set bothfigure
andtable
names viafigurename
andtablename
respectivelly.The following code works:
We are setting the caption layout globally.
Now, when we provide the optional argument, we are limiting our scope to the float we are setting up. Say, if we use
\captionsetup[table]{...}
, we are configuring the captions within thetable
scope, so there's no point of usingtablename
, but onlyname
.We can use the
name
key instead oftablename
, since we are configuringtable
:If we want to use
tablename
instead, we must use\captionsetup
without the optional argument:Just for reference, another way to rename the table name is with
\renewcommand{\tablename}{Table}
. However, as AstroPig mentioned in the comments, it doesn't work if we usebabel
with thefrench
language.