3

I'm trying to get the subcaptions and captions in sanserif font and Uppercased. According the manual of the caption package this should be possible in the following way.However, this doesnt seem to work. Am I defining something in the wrong way here?

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{caption}
\floatsetup[figure]{subcapbesideposition = top}

\captionsetup{labelfont={sf,up}, labelsep=period, format = plain, singlelinecheck = false, textfont=rm, skip = 2pt}
\captionsetup[subfloat]{labelfont = {up,sf},format = plain,textfont = rm,labelformat = simple, labelsep = period}

\begin{document}  
\begin{figure}[h!]
  \ffigbox[\textwidth]
    {\begin{subfloatrow}
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{A.pdf}}%
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{B.pdf}}%
      \end{subfloatrow}
      \begin{subfloatrow}
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{C.pdf}}%
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{D.pdf}}%
      \end{subfloatrow}}
    {\caption{this is a caption}}
\end{figure}

\end{document}
  • 2
    Here up means just "upright shape", not "uppercase". Do you want all the caption uppercase? – egreg May 3 '11 at 21:29
8

To make the word "Figure" appear in uppercase, you can use the option figurename=FIGURE in the \captionsetup.

To change the subfigure letters to uppercase, you can use \renewcommand{\thesubfigure}{\Alph{subfigure}} somewhere in your preamble.

If you also want the caption text to be made uppercase, you can define a new style using \DeclareCaptionFormat{upper}{#1#2\uppercase{#3}\par}.

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{caption}
\floatsetup[figure]{subcapbesideposition = top}

\DeclareCaptionFormat{upper}{#1#2\uppercase{#3}\par}
\renewcommand{\thesubfigure}{\Alph{subfigure}}

\captionsetup{labelfont={sf}, labelsep=period, format = upper, singlelinecheck = false, textfont=sf, skip = 2pt,figurename=FIGURE}
\captionsetup[subfloat]{labelfont = {sf},format = plain,textfont = rm,labelformat = simple, labelsep = period}
\begin{document}  
\begin{figure}[h!]
  \ffigbox[\textwidth]
    {\begin{subfloatrow}
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{A.pdf}}%
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{B.pdf}}%
      \end{subfloatrow}
      \begin{subfloatrow}
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{C.pdf}}%
        \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{D.pdf}}%
      \end{subfloatrow}}
    {\caption{this is a caption}}
\end{figure}

\end{document}

uppercase subrow captions

  • thanks! but do you know why the period after the subcaption label is missing. I also noticed this when I compiled my own code. – Timtico May 4 '11 at 15:53
  • The period is missing because it's a separator, and because there is only a label but no caption, there is nothing to separate, and so the separator is not printed. If you remove the caption text "this is a caption", the period will disappear from the main caption label as well. If you want a period after the subcaption label, you could use \renewcommand{\thesubfigure}{\Alph{subfigure}.} – Jake May 4 '11 at 16:04
  • Is it possible to make it work for Cyrillic texts? At the moment, the code above returns a mix of capital and small letters. – Anton Tarasenko Dec 10 '13 at 13:23
  • 1
    @Anton: I think it's best to open a new question for that, including a minimal example document. – Jake Dec 10 '13 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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