I know that I can Remove colon in the caption of a figure if the caption is empty when I simply use the caption
package. But let's say I am using a journal-specific class (e.g. elsarticle
) that has it's own definition of caption layout. So adding the caption
package gives me an unsupported document class (or package) warning.
So the question it – can I remove the colon from the caption of a figure if the caption is empty WITHOUT using the caption
package?
Best Answer
A preliminary remark: If a journal you're submitting an article to requires you to use the
elsarticle
document class, it may be a poor idea to modify the caption style defined by the class. Your journal's style guidelines probably also state something to the effect that every float should have a (nonempty) caption, in which case some kind of separator (such as a colon) between the float's number and caption is generally needed.Here's the definition of the
\@makecaption
command contained in the fileelsarticle.cls
The two arguments of the
\@makecaption
macro are[Float] <num>
and the caption's text, respectively. [Float] can be "Figure", "Table", or the name of any other floating environment recognized by LaTeX.There are two ways to suppress the insertion of a colon following the float's name and number.
Method 1 : Remove the colon globally because the mandatory arguments (the stuff inside curly braces) of all
\caption
commands will always be empty. To achieve this, you could load theetoolbox
package and issue the following commands:Method 2: Remove the colon whenever (and only if) the mandatory argument of the
\caption
command is empty. In this case, you may want to employ the following redefinition of the\@makecaption
command: