# Subfigure referencing shows Roman number

I am trying to refer figures and subfigures in my thesis. When i refer entire figure( which contains subfigures) I get it correctly as shown Fig. 1.1. Whenever I am referencing a subfigure. It shows roman numeral eg. Fig.I.1(a). How to get it as Fig. 1.1(a). I am adding a minimum working example. First is for main file. and second is chapter file

    \documentclass[12pt,twoside,openright]{report}
\ProvidesPackage{mypackage}
\usepackage{subfigure}
\usepackage[subfigure]{tocloft}
\usepackage[dvips]{graphicx}
\usepackage[cmex10]{amsmath}
\usepackage{setspace}
\usepackage{float}
\usepackage[margin=1in]{geometry}
\usepackage{cite}
\usepackage{caption}
\usepackage{etoolbox}
\usepackage{tabularx}
\usepackage[toc,page]{appendix}
\usepackage{acronym}
\usepackage{titletoc}

\cleardoublepage %\cleardoublepage %for openright

\renewcommand{\chaptername}{CHAPTER}

\renewcommand{\thechapter}{\Roman{chapter}}%chapter number in roman
\makeatletter
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}

\setcounter{section}{0}
\makeatletter
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\setcounter{figure}{0}

\makeatletter
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\begin{document}

%\renewcommand{\thechapter}{\arabic{chapter}}

\include{MWCchapter_01}

\end{document}


Chapter MWC

\chapter{First Chapter}
\section{General}

If I refer entire figure I get it properly as Fig. \ref{Figure}. However if I refer subfigures, it shows roman numeral
Fig.\ref{FigureA} and
Fig. \ref{FigureB}  which I dont want (it should be shown as Fig. 1.1(a) and Fig. 1.1(b)). The figures, subfigure captions and numbering are proper. However the problem comes during referencing.

%

\begin{figure}[!htbp]
\centering
\subfigure[FigureA]{%
\includegraphics[width=3in]{FigureA}
\label{FigureA}}
\subfigure[FigureB]{%
\includegraphics[width=3in]{FigureB}
\label{FigureB}}
\caption{Figure}
\label{Figure}
\end{figure}

• It is almost impossible to help you unless you provide an MWE. – user121799 Mar 10 '18 at 6:29
• I am using it for thesis. In thesis, the coding has been done so that chapter number is shown in Roman. However, i want the figures and subfigures to be shown in normal (arabic) numeral – S.Dev Mar 10 '18 at 6:43
• Well, I'm tempted to tell you to use something like \renewcommand{\thefigure}{\arabic{figure}} but I can't because I do not know what side effects this will have. People here really wish to provide you with a real answer that does not cause any problems, and this is only possible on the basis of an MWE. – user121799 Mar 10 '18 at 6:48
• So, there must be something in the code of the document class that's setting this form. Which document class do you employ? Incidentally, the subfigure package has been deprecated for my years. Don't use it; use the subfig of the subcaption package instead. – Mico Mar 10 '18 at 7:38
• Please ask a structured question, containing a MWE that shows us exactly what you get. Getting information scattered over the comment section is tedious for helpers. – Johannes_B Mar 10 '18 at 7:39

The subfigure package contains the following instruction:

\let\p@subfigure=\thefigure


This defines the "prefix string" that LaTeX inserts just ahead of \thesubfigure during the creation of cross-references to objects of type subfigure. Because the code (inappropriately, in my view!) uses the \let device to set up the macro \p@subfigure, and because \thefigure is set by the report document class to be a composite of the chapter number (in Roman numerals) and the actual figure number (in arabic numerals), you end up getting strings of the form I.1(a).

The reason \let isn't appropriate here is because \let makes a static macro definition: the properties of \thefigure that are in effect when \let\p@subfigure=\thefigure is run, i.e., during the processing of the code contained in report.cls, continue to be used even after \thefigure gets changed later on (in the preamble).

The immediate remedy is to run the following code at the end of the preamble:

\makeatletter
\renewcommand{\p@subfigure}{\thefigure}
\makeatother


The real remedy, though, is not to use the subfigure package in the first place. It's been deprecated for years and years, and good substitutes -- the subfig and subcaption packages -- are available.


MWE:

\documentclass[]{article}

\usepackage{caption}
\captionsetup{justification=centering}

\usepackage{float}
\usepackage{subfloat}

\usepackage{blindtext} % generates dummy text

\begin{document}

\section{Section Title}

\Blindtext

\begin{subfigures}

\begin{figure}
\centering
\fbox{\Huge SubFigure a}
\caption{Sample Image 1}
\end{figure}

\begin{figure}
\centering
\fbox{\Huge SubFigure b}
\caption{Sample Image 2}
\end{figure}

\end{subfigures}

\end{document}

• So this gives what the OP has and does not want. Without knowing what is really going on in the OPs document. – Johannes_B Mar 10 '18 at 8:11
• It was just misreading since 'I' as a roman letter is very similar to '1'. Now it is corrected. It is just a matter of changing the global numbering of sections and figures, and setting the way subfigures are numbered using \renewcommand\thesubfloatfigure – Al-Motasem Aldaoudeyeh Mar 10 '18 at 8:24