2

This question is somehow related to Change counter style for caption. But here I want to use subcaptions as well.

I want to create myStyle for captions. \DeclareCaptionFormat has three options. From Page 29 of Caption Package Doc­u­men­ta­tion:

\DeclareCaptionFormat{myStyle}{#1 #2 #3}

While #1 refers to the caption label, #2 refers to the separator and #3 refers to the text. So why subfigure is not seperated as well and it is included in #2?

Here is MWE:

\documentclass{beamer}

\usepackage[persian]{babel}
\usepackage[compatibility=false]{caption}

\setbeamertemplate{caption}[numbered]

%\DeclareCaptionLabelFormat{rlnumber}{#1 \LR{#2}\bothIfSecond{-}{\roman{ContinuedFloat}}}
\DeclareCaptionLabelFormat{rlnumber}{#1 \LR{#2}\bothIfSecond{-}{\arabic{ContinuedFloat}}}

\captionsetup{labelformat=rlnumber}

\setmainfont[Script=Arabic]{XB Zar}
\setsansfont[Script=Arabic,Numbers=Arabic]{XB Zar}

\begin{document}

\begin{frame}
    \setcounter{figure}{9}
    \begin{figure}\ContinuedFloat*
        \caption{شکل \LR{1-10}}
    \end{figure}
    \begin{figure}\ContinuedFloat
        \caption{شکل \LR{2-10}}
    \end{figure}

    \begin{figure}
        \caption{شکل \LR{11}}
    \end{figure}

    \begin{figure}
        \caption{شکل \LR{12}}
    \end{figure}

\end{frame}

\end{document}

There are two approaches to this problem. First if only I could state that do not use 0 as subsection, everything would fixed. Second approach would be to separate subcaption and caption.

Of course if I don't use the \arabic counterstyle and replace it with \roman everything would be O.K.

Subcaption-RL

Another MWE for English, left-to-right in article class:

\documentclass{article} 
    \usepackage{caption} 
    \DeclareCaptionLabelFormat{rlnumber}{#1 \bf{#2}\bothIfSecond{-}{\arabic{ContinuedFloat}}}
        \captionsetup{labelformat=rlnumber}   
\begin{document}
        \setcounter{figure}{9}

        \begin{figure}\ContinuedFloat*
            \caption{I want it to be Figure 10-\bf{1}}
        \end{figure}

        \begin{figure}\ContinuedFloat
            \caption{I want it to be Figure 10-\huge{2}}
        \end{figure}

        \begin{figure}
            \caption{I want it to be Figure 11}
        \end{figure}

        \begin{figure}
            \caption{I want it to be Figure 12}
        \end{figure} 
\end{document}
2
  • You will get help much quicker, if you remove everything which is not needed in your code snippet. Like this, people are forced to use Lua/XeLaTeX, to have the fonts (I don't), to install Persian babel, and to tweak around with beamer which might not be needed here. Thank you.
    – LaRiFaRi
    Jul 1, 2015 at 7:51
  • 1
    I added a general MWE to indicate the problem so everyone can typeset it now.
    – user81104
    Jul 1, 2015 at 8:07

2 Answers 2

2

If you want a different style for continued floats setup them with their own format:

\documentclass{article}
    \usepackage{caption}
    \DeclareCaptionLabelFormat{rlnumber}{#1 \bf{#2}}
    \DeclareCaptionLabelFormat{continued}{#1 #2-\arabic{ContinuedFloat}}
    \captionsetup{labelformat=rlnumber}
    \captionsetup[ContinuedFloat]{labelformat=continued}
\begin{document}
        \setcounter{figure}{9}

        \begin{figure}\ContinuedFloat*
            \caption{I want it to be Figure 10-\bf{1}}
        \end{figure}

        \begin{figure}\ContinuedFloat
            \caption{I want it to be Figure 10-\huge{2}}
        \end{figure}

        \begin{figure}
            \caption{I want it to be Figure 11}
        \end{figure}

        \begin{figure}
            \caption{I want it to be Figure 12}
        \end{figure}
\end{document}
1

Right now, you are changing the caption format for all captions in your document. In your case, \captionsetup[subfigure]{} or \captionsetup[sub]{} do not work as they are meant for real subfigures and not continued floats (56 seconds later, I fount out its [ContinuedFloat] from Ulrike's answer above :-)). Therefore, I would just add the caption redefinition in each occurrence of \ContinuedFloat. If you do not have to much of those, it could be feasible.

% arara: pdflatex

\documentclass{article} 
\usepackage{caption} 
\DeclareCaptionLabelFormat{first}{#1 #2\bothIfSecond{-}{\textbf{\arabic{ContinuedFloat}}}}
\DeclareCaptionLabelFormat{continued}{#1 #2-\huge\arabic{ContinuedFloat}}
\begin{document}
    \setcounter{figure}{9}

    \begin{figure}\ContinuedFloat*
        \captionsetup{labelformat=first}   
        \caption{I want it to be Figure 10-\textbf{1}}
    \end{figure}

    \begin{figure}\ContinuedFloat
        \captionsetup{labelformat=continued}
        \caption{I want it to be Figure 10-\huge{2}}
    \end{figure}

    \begin{figure}
        \caption{I want it to be Figure 11}
    \end{figure}

    \begin{figure}
        \caption{I want it to be Figure 12}
    \end{figure} 
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .