1

how can I link figure in tex in this way, i.e.

"Fig.\,6(b)" in tex, then I click Fig.\,6(b), I will see the 6.jpg automatically

namely What should I do in

\begin{figure}[h]
....
\end{figure}

Best,

4

If you place a unique \label{foo} after the caption of your image, you can reference it with \ref{foo}.

A combination of a couple of packages can make it easier to get your desired format:

  • hyperref to make the cross references clickable

  • subcaption to split a figure in multiple subimages numbered with a, b etc

  • cleveref to automatically insert fig. before the figure number in the cross reference


\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}

\cref{imageb}

\begin{figure}[htbp]
\begin{subfigure}{.5\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}
\caption{text}
\label{imagea}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}
\caption{text}
\label{imageb}
\end{subfigure}
\end{figure}

\end{document}

enter image description here

  • if I need fig.1a-1f ? Thanks ! – acsdaswe Jan 30 at 22:40
  • @ABCDEMMM You can use \cref{labela,labelb,labelc,labeld,labele,labelf}, cleveref will automatically compress these into a-f if you reference all labels. – user36296 Jan 30 at 22:48
  • I got errors: tex capacity exceeded, sorry[input stack size=5000] – acsdaswe Feb 1 at 0:42
  • @ABCDEMMM can you make a minimal working example (MWE) that reproduces your problem? – user36296 Feb 1 at 9:12
  • can i use subfig? if yes, then how?? – acsdaswe Mar 7 at 23:27

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.