1

How to create hyperlink from page to another page even if there is no section or chapter ? and the easy way to automatically make it color blue of all the hyperlink I created. Thank you in advance.

        \documentclass{article}
        \usepackage[utf8]{inputenc}
        \usepackage{xcolor}
        \usepackage{hyperref}
    \title{Hyperlink}
    \author{For Testing }
    \date{August 2022}

    \begin{document}

    \maketitle

    \section{Introduction}
    \color{blue}{page 2\\
    page 3\\
    page 4 title name}

    Lorem

    \clearpage
    page 2

    \clearpage
    page 3

    \clearpage
    page4\\
    page 4 title name

    \end{document}

Udot
  • 45

1 Answers1

3

For links with arbitrary text, you can use \hyperlink{label}{Link text} with a matching \hypertarget{label}{Link destination}.

For a link to something marked with \label, you can use \hyperref[label]{link text}.

For page number links you can use \pageref to a label; you may need to use \phantomsection before the target.

If you want links to be blue, use the colorlinks and linkcolor=blue options for hyperref.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[colorlinks,linkcolor=blue]{hyperref}

\title{Hyperlink} \author{For Testing} \date{August 2022}

\begin{document}

\maketitle

\section{Introduction}

\hyperlink{page2anchor}{Link to page 2}\ \hyperlink{page3anchor}{Link to page 3}\ \hyperlink{page4anchor}{Link to page 4}

\hyperref[alabelkey]{Arbitrary link to label}

That label is on page \pageref{alabelkey}

\clearpage \hypertarget{page2anchor}{page 2}

\clearpage \hypertarget{page3anchor}{page 3}

\clearpage \hypertarget{page4anchor}{page 4}

\phantomsection\label{alabelkey} Here

\end{document}

See the hyperref package documentation.

frabjous
  • 41,473