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}
Best Answer
The
subfigure
package contains the following instruction:This defines the "prefix string" that LaTeX inserts just ahead of
\thesubfigure
during the creation of cross-references to objects of typesubfigure
. Because the code (inappropriately, in my view!) uses the\let
device to set up the macro\p@subfigure
, and because\thefigure
is set by thereport
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 formI.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 inreport.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:
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 -- thesubfig
andsubcaption
packages -- are available.