0

How to give cross-reference to all words, Example 1, as follows?

enter image description here

I defined a new environment as follows:

\newtheorem{exmp}{Example}

When I give a \label{Example} to the example and write \ref{Example}, I get: enter image description here

just 1 includes the link.

`\documentclass[final,5p,times,twocolumn]{elsarticle} 
\usepackage{hyperref}
 
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
    citecolor=blue}
\usepackage[all]{xy,xypic}
\usepackage{amsfonts,amssymb,amsmath,amsgen,amsopn,amsbsy,theorem,graphicx,epsfig}
\usepackage{multicol}  
\usepackage{eufrak,amscd,bezier,latexsym,mathrsfs,enumerate,multirow}
\usepackage[utf8]{inputenc}\usepackage[english]{babel}
\usepackage[dvipsnames]{xcolor}
\usepackage[pagewise]{lineno}
\usepackage{cleveref}
\graphicspath{{figures/}}
\usepackage{subfig} 
\usepackage{longtable} 
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}% http://ctan.org/pkg/algorithm2e
\DontPrintSemicolon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%

\usepackage{amsthm}
\theoremstyle{definition}
\theoremstyle{remark}
\newtheorem{exmp}{Example}
     \newtheorem{rem}{Remark}
\let\proof\relax
\let\endproof\relax
\let\example\relax
\let\endexample\relax
%%%%%%%%%%%

\begin{document}
\begin{exmp} \label{Ex1}
 Let's consider:
 \begin{equation}
     2x+y=3
 \end{equation}
 \end{exmp}

\begin{table*}[h!]
    \caption{Results in \cref{EX1}

.....
\end{document}`
 
9
  • 1
    You should take a look at the cleveref package (to be loaded after hyperref)..
    – Bernard
    Mar 9, 2021 at 20:48
  • In fact, I usually cleveref and \cref. But it doesn't work in here.
    – 1_student
    Mar 9, 2021 at 21:25
  • 1
    Could you post a minimal, yet complete, code that we can text to see what happens?
    – Bernard
    Mar 9, 2021 at 21:27
  • Thank you. I edited the OP.
    – 1_student
    Mar 9, 2021 at 21:35
  • I'm sorry, but I can't compile your code. I don't have some packages installed (unrelated to the problem such as subfig, which is obsolete), vut more important there seems to be conflicts between packages. Could you post a code with only the relevant packages?
    – Bernard
    Mar 9, 2021 at 22:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.