[Tex/LaTex] elsarticle table and figure caption

captionselsarticlefloatslyxtables

I want to change the caption of elsarticle in LyX for table to be

enter image description here

and for figures to be

enter image description here

Mine is the following:

I use the caption package in document preamble

\usepackage[labelfont=bf,labelsep=newline,justification=raggedright,singlelinecheck=false,font=small]{caption}

but I get large word Table in bold

and figure not fig. as required and also after figure there is a new line which is not required

here is mine
enter image description here

and figure is here

enter image description here

Best Answer

You can use \captionsetup to provide different options for table and figure:

\documentclass{elsarticle}
\usepackage[labelfont=bf,justification=raggedright,singlelinecheck=false]{caption}
\captionsetup[figure]{name=Fig. ,labelsep=period}
\captionsetup[table]{labelsep=newline,font=footnotesize}

\begin{document}

\begin{table}[!ht]
\caption{A test table caption}
\end{table}

\begin{figure}[!ht]
\caption{A test figure caption}
\end{figure}

\end{document}

enter image description here

You should take into account the warning you get from using caption with elsarticle class:

Package caption Warning: Unsupported document class (or package) detected, (caption) usage of the caption package is not recommended. See the caption package documentation for explanation.

Related Question