[Tex/LaTex] \spacedlowsmallcaps in caption label

captionsformatting

How i can make the labelfont also in \spacedlowsmallcaps in addition to sans serif and small ?

\documentclass{article}

            \usepackage{microtype}
            \usepackage{caption}

            \microtypesetup{expansion=false}%

            \DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\scshape\MakeTextLowercase{#1}}}%

            \renewcommand{\sfdefault}{iwona}


\captionsetup{%
             format=hang,%
             labelfont={small,sf},%
             font={small,sf},%
             width={.8\textwidth}%
             }

\captionsetup[table]{skip=\medskipamount}

\begin{document}

\begin{table}
\caption{Test}
\end{table}

\end{document}

\subfloat command

\DeclareCaptionLabelFormat{mysublabel}{\small\sffamily\bothIfSecond{\spacedlowsmallcaps{#1}}{~}\spacedlowsmallcaps{(#2)}}

\captionsetup[subfloat]{%
                       labelformat=mysublabel,%
                       labelsep=space,%
                       listofformat=subparens,%
                       font={small,sf},%
                   }

Best Answer

You can declare your own labelformat. The caption package provides \DeclareCaptionLabelFormat for that. It takes two arguments, the name and the code. Inside the code argument you can use #1 for the caption name (like “Figure” or “Table”) and #2 for the number. To get the right formatting even if one of these is not provided the caption package also defines \bothIfFirst and \bothIfSecond which typeset both their arguments if the respective argument is given and non if not. This might be important if the subcaption package is used. For details please refer to the package documentation.

\documentclass{article}

\usepackage{microtype}
\usepackage{caption}
\usepackage{textcase}

\microtypesetup{expansion=false}%

\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\scshape\MakeTextLowercase{#1}}}%

\renewcommand{\sfdefault}{iwona}

\DeclareCaptionLabelFormat{mycaption}{%
  \bothIfFirst{\spacedlowsmallcaps{#1}}{~}\spacedlowsmallcaps{#2}}

\captionsetup{%
             format=hang,%
             % labelfont={small,sf},% not necessary since `font' applies to both label and text
             labelformat=mycaption,
             font={small,sf},%
             width={.8\textwidth}%
             }

\captionsetup[table]{skip=\medskipamount}

\begin{document}

\begin{table}
\caption{Test}
\end{table}

\end{document}