I am trying to style the name and text of captions so that the name ("Figure", "Table" etc) is in bold, and the title text (eg "A picture of a cat.") is in italics.Following the memoir manual I use:
\captiontitlefont{\small\itshape}
\captionnamefont{\small\bfseries}
So the following works, using memoir (produced by lyx):
%% LyX 2.0.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[11pt,a4paper,oneside,english,oldfontcommands,justified,a4paper]{memoir}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\captiontitlefont{\small\itshape}
\captionnamefont{\small\bfseries}
\makeatother
\usepackage{babel}
\begin{document}
\begin{figure}
\caption{A picture of a cat.}
However, as soon as I add a subfigure, the caption is no longer styled. This does not work:
%% LyX 2.0.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[11pt,a4paper,oneside,english,oldfontcommands,justified,a4paper]{memoir}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\captiontitlefont{\small\itshape}
\captionnamefont{\small\bfseries}
\@ifundefined{showcaptionsetup}{}{%
\PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother
\usepackage{babel}
\begin{document}
\begin{figure}
\subfloat[My first cat.]{
}\caption{A picture of some cats.}
\end{figure}
\end{document}
I've also tried using:
\renewcommand{\fnum@figure}[1]{\textbf{\figurename~\thefigure} : }
but again this doesn't work when the subfig package is loaded.
(I am writing in French, using babel which also styles things ie putting FIGURE in uppercase, but that seems to be a separate issue).
How can I style my captions when using subfigures?
Best Answer
You can use the
caption
package along withsubfig
package. I have modified your code like below:I have also put the FIGURE in SC letters.