Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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},%
                   }
share|improve this question

1 Answer 1

up vote 6 down vote accepted

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}
share|improve this answer
    
thanks but this cancel the numeration, how can I fix that? –  FormlessCloud Aug 29 '12 at 21:07
    
@FormlessCloud see my edited answer –  cgnieder Aug 29 '12 at 21:27
    
good ! could you check my updated question with the settings of the subfloat command, if that settings are correct? –  FormlessCloud Sep 1 '12 at 18:47
    
I'm unsure about your use of \bothIfSecond. Do you really want to use argument #1 only if argument #2 is used? Shouldn't that be \bothIfFirst? Other than that it looks ok to me. –  cgnieder Sep 2 '12 at 19:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.