subfig
and subcaption
packages can not be used in cooperation with each other. Instead you can usecaption
package with subfig
to add some flavor to the captions and subcaptions. (or you can use caption
along with subcation
(which gives a subfigure command also).
\documentclass{memoir}
\usepackage[demo]{graphicx} % remove [demo] in your file
\usepackage{subfig} % for subfigures
\usepackage{caption}
\usepackage{lipsum}
\captionsetup[figure]{labelfont={bf,small},textfont={it,small}}
\captionsetup[subfloat]{labelfont={bf,small},textfont={it,small},
subrefformat=parens} %<-----designing subcaption
\newcommand{\myfigref}[2]{~\ref{#1}.\subref{#2}}% <---- a new macro for referring to a subfigure
%
\begin{document}
%=========================
\chapter{First chapter}
\lipsum[1-4]
%=========================
\begin{figure}[ht]
\includegraphics[width=1\textwidth]{my figure}
\caption{My single picture}\label{fig:figures}
\end{figure}
%=========================
\begin{figure}[ht]
\centering
\subfloat[My first picture]{\label{fig:mdleft}{\includegraphics[width=0.4\textwidth]{my figure}}}\hfill
\subfloat[My second picture]{\label{fig:mdright}{\includegraphics[width=0.4\textwidth]{my figure}}}
\caption{My two big pictures}
\label{fig:subfigures}
\end{figure}
%===========================
From figure~\ref{fig:subfigures}.\subref{fig:mdleft}, we can see a small cat, in \myfigref{fig:subfigures}{fig:mdright} both can be used to refer figures.\end{document}
No hay comentarios:
Publicar un comentario