2

Today ,I use the package hyperref to create hyperlink .However ,some links can jump to the right place while some hyperlinks cannot jump to the destination .

my mini code

  \documentclass[UTF8]{ctexrt}
  \usepackage {hyperref}
  \usepackage {graphicx}
  \begin{document}
  \section{welcome}
  Hi,welcome to latex  \hyperref[fig1 ]{fig1 }
  Hi,welcome to latex
   \hyperref[fig2 ]{fig2}
  Hi,welcome to latex
 \includegraphics{fig2.eps}
 \label{fig2}

  \includegraphics{fig3.eps}
 \label{fig3}
  Hi,we
  \includegraphics{fig1.eps}
 \label{fig1}
  come to latex
  Hi,welcome to latex
  Hi,welcome to latex
  Hi,welcome to latex

  \end{document }

so I wonder how to.solve .

  • 2
    You need a "counter stepping mechanism" in order to fix a position where the hyperlink will go. If this is not used, then you need to place a manual \phantomsection to mark the hyper target. So, place a \phantomsection before each \label where you want that \hyperref to jump to. – Werner Jan 15 '14 at 15:27
  • @Werner,which package contains the command \plantomsection – xyz Jan 16 '14 at 2:26
  • 1
    hyperref provides \phantomsection. See the hyperref documentation and search for \phantomsection. It'll give some information on where it's used/how to use it. – Werner Jan 16 '14 at 2:47
  • @Werner,dear friend,thanks sincerely,It goes well. – xyz Jan 16 '14 at 11:16
3

\label is used for cross-referencing in LaTeX, which also generates a hyperlink to the corresponding unit, in this case the section (if you use \label inside an equation it would be the equation, etcetera). What you appear to need is \hypertarget+\hyperlink.

Edit in response to the comment:

\documentclass[UTF8]{article}

\usepackage {hyperref}

\usepackage{lipsum}

\begin{document}

\section{welcome}

\lipsum[1] 

\hyperlink{fig1}{fig1 }

\lipsum[2]

\hyperlink{fig2}{fig2}

\lipsum[3]

\hypertarget{fig2}{figure 2}

\lipsum[5]

\hypertarget{fig3}{figure 3!}

\lipsum[6]

\hypertarget{fig1}{figure 1!}

\lipsum[7]

\end{document}
|improve this answer|||||
  • Providing an MWE that demonstrates your solution would be helpful. – Adam Liter Jan 15 '14 at 15:31
  • sorry ,your method makes the chinese characters become the garbage english word. – xyz Jan 16 '14 at 2:24
  • 1
    Just change the article class back to what you had before. – JPi Jan 16 '14 at 2:44

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.