0

I want to know how should I cross-reference the following caption in manuscript in following way Fig 1a and Fig 1b.

\begin{figure}
\minipage{0.50\textwidth}
\includegraphics[width=\textwidth]{fig1}
\endminipage\hfill
\minipage{0.50\textwidth}
\includegraphics[width=\textwidth]{fig2}
\endminipage\hfill

 \caption{$(a)$ taghyer jabejaei: $R$ is the reference configuration and $D$ is the deformed configuration and $(b)$ Salam Khub hasti density $\bf f$ agr bashe en ro dorost kard force density $\bf t$ at both points} \label{fig:m}

\end{figure}
4
  • 2
    There is a big difference between "citing" and "referencing". The former typically refers to items inside a bibliography, while the latter uses a \label-\ref approach. Could you include a complete, minimal example that highlights your setup? We want to copy-and-paste-and-compile and see exactly what you're seeing.
    – Werner
    Commented Feb 29, 2016 at 20:22
  • From just your example, it seems you could use the subfig package and the normal \label-\ref mechanism.
    – Dan
    Commented Feb 29, 2016 at 20:34
  • @ Werner, it is complicated to copy-paste here however I have used this Fig.~\ref{fig:m} in order to cite the figures into manuscript. The issue is I do not know how to distinct this between 1a and 1b. Please guide me how I can have Fig1a and Fig1b in to manuscript.
    – Mohammad
    Commented Feb 29, 2016 at 20:34
  • @ Dan, where should I use that subfig..the figures are located in side by side.
    – Mohammad
    Commented Feb 29, 2016 at 20:36

1 Answer 1

2

I suggest you load the subcaption package, which provides an environment called subfigure. I further suggest you load the cleveref package to help streamline making cross-references to items such as subfigures.

enter image description here

\documentclass{article}
\usepackage{subcaption} % provides 'subfigure' environment
\usepackage[demo]{graphicx} % omit 'demo' option in real document
\usepackage[capitalize]{cleveref} % for "clever" cross-referencing
\begin{document}

\begin{figure}

\begin{subfigure}{0.475\textwidth}
  \includegraphics[width=\linewidth]{fig1}
  \caption{First subfigure} \label{fig:1a}
\end{subfigure}\hfill% leave no blank line between subfigures
\begin{subfigure}{0.475\textwidth}
  \includegraphics[width=\linewidth]{fig2}
  \caption{Second subfigure} \label{fig:1b}
\end{subfigure}

\caption{A figure with two subfigures} \label{fig:1}

\end{figure}

\noindent
A cross-reference to \cref{fig:1b}.
\end{document}

Addendum: If you don't need to cross-reference the subfigures individually, and if you're fine with providing a long caption that describes the contents of the two image files, there's certainly no need to load the subcaption package or to place the image files in minipage environments.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % omit 'demo' option in real document
\usepackage[capitalize]{cleveref} % for "clever" cross-referencing
\begin{document}

\begin{figure}

\includegraphics[width=0.475\textwidth]{fig1}
\hfill
\includegraphics[width=0.475\textwidth]{fig2}

\caption{Left-hand panel: taghyer jabejaei, $R$ is the reference configuration and $D$ is the deformed configuration. Right-hand panel: Salam Khub hasti density $\mathbf{f}$ agr bashe en ro dorost kard force density $\mathbf{t}$ at both points} \label{fig:m}
\end{figure}

\noindent
A cross-reference to \cref{fig:m}.
\end{document}
6
  • @ Mico, this is good but I do not want to use this format. I like to have one caption but cite that in manuscript as Fig 1a and Fig 1b.
    – Mohammad
    Commented Feb 29, 2016 at 21:11
  • @Mohammad - Please clarify: If you have only one caption, how can it be referred to alternately as "Fig 1a" and "Fig 1b"?
    – Mico
    Commented Feb 29, 2016 at 21:22
  • @ Mico, in the figure "a" and "b" are boxed (for example). It seems that LaTeX can cite this only and only if we have two figures. in other words, there is one cite corresponding each figure. does it make sense?
    – Mohammad
    Commented Feb 29, 2016 at 22:07
  • @Mohammad - "does it make sense?" I'm afraid not. If you want to cross-reference the entire figure, type \cref{fig:1}; if you want to cross-reference the subfigure, type \cref{fig:1a}, say. If you think you'll never need to cross-reference one or the other subfigure, don't use subfigure (or minipage) environments to begin with.
    – Mico
    Commented Feb 29, 2016 at 22:21
  • Okay, it does works now.
    – Mohammad
    Commented Feb 29, 2016 at 22:32

You must log in to answer this question.

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