2

I'm currently using this code

\documentclass{article}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\renewcommand{\thefigure}{\Roman{figure}}
\captionsetup[figure]{labelsep=period}

\begin{document}

\begin{figure}[!htb]
\caption{Optimal Claims}\label{optimalclaims}
\centering
\begin{subfigure}[H]{0.49\textwidth}
    \includegraphics[width=\textwidth]{Plot1.pdf}
    \medbreak
    \subcaption{X}\label{our}
\end{subfigure}
\hfill
\begin{subfigure}[H]{0.49\textwidth}
    \includegraphics[width=\textwidth]{Plot2.pdf}
    \medbreak
    \subcaption{Y}\label{mascu}
\end{subfigure}
\end{figure}
\end{document}

Which generates this output (when running this MWE on your computer, choose any two images, name them Plot1.pdf and Plot2.pdf and save them in the same folder as the main .tex file; it should compite without problems):

enter image description here

I have been trying to modify the numbering of the subcaptions by looking at this link, but with no success. Instead of (a) X and (b) Y, I would like to get I.a. X and I.b. Y. Can anybody please help me achieve so?

Thank you all very much in advanced for your time and effort.

3

(Remark: I posted the following answer based on the information given in the OP's MWE and, in particular, the fact that the article document class was supposed to be in use. The OP has since informed me -- see one of the comments below -- that he/she actually uses the scrartcl instead of the article document class. In consequence, my answer doesn't solve his/her actual typesetting issue.)


Something like this?

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real document

\usepackage{subcaption} % 'caption' package is loaded automatically    
\captionsetup[figure]{labelsep=period}
\renewcommand{\thefigure}{\Roman{figure}}
\captionsetup[subfigure]{labelformat=simple} % default is 'parens'
\renewcommand\thesubfigure{\thefigure.\alph{subfigure}.}

\begin{document}

\begin{figure}[!htb]
\caption{Optimal Claims}\label{optimalclaims}
\begin{subfigure}[b]{0.49\textwidth}
    \includegraphics[width=\textwidth]{Plot1.pdf}
    \medbreak
    \caption{X}\label{our}
\end{subfigure}%
\hfill % to maximize separation between the subfigures
\begin{subfigure}[b]{0.49\textwidth}
    \includegraphics[width=\textwidth]{Plot2.pdf}
    \medbreak
    \caption{Y}\label{mascu}
\end{subfigure}
\end{figure}

\end{document}

Addendum: If you plan to create cross-references to subfigures, it would be best if you replaced the two lines of code

\captionsetup[subfigure]{labelformat=simple} % default is 'parens'
\renewcommand\thesubfigure{\thefigure.\alph{subfigure}.}

with

\DeclareCaptionSubType*[alph]{figure}
\captionsetup[subfigure]{labelformat=simple,labelsep=period}

See section 5 of the user guide of the subcaption package for the commands \DeclareCaptionSubType and \DeclareCaptionSubType*. With this change, the period at the end of the composite subcaption number isn't a part to the cross-reference output.

  • 1
    This is not only an answer that solves the issue, but also an anser that teaches how to proper typset MWE. Thank you. I will accept it as soon as I can. EDIT: unfortunately, when applying your solution to my real document, I get II.A and II.B instead of I.A and I.B. I'll look into it tomorrow. – Héctor Apr 10 '18 at 0:02
  • 1
    @Héctor - You're most welcome! By the way, I just posted an addendum, with some code that should be used if you intend to make cross-refences (using the \label-\ref mechanism) to objects of type subcaption. – Mico Apr 10 '18 at 0:15
  • Thank you very much for the addendum. I will look into the issue that I have now and I will be back to this question if it persists. Can I notify you via comment if necessary? – Héctor Apr 10 '18 at 0:19
  • 1
    @Héctor - Absolutely. – Mico Apr 10 '18 at 0:20
  • 1
    @Héctor - Why did you post an MWE that uses the article document class when, in fact, you not only not use that class but actually use one -- scrartcl -- which for which the subcaption package doesn't work correctly. I would never have written the answer I did if I'd known that you employ the scrartcl document class. I would like to suggest that you either edit your posting to provide a more relevant MWE or post an entirely new query, this time with all relevant. I wish I could simply delete my answer, but that's not possible for answers that have received the "accept" check-mark. – Mico Apr 10 '18 at 4:46

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.