0

I am trying to insert a hyperlink--> http://pages.cs.wisc.edu/~cao/cs537/lecture17.txt in my document, but since its a text file the last part of that link is not working, and it is taking me to the homepage only. I have used the command

\href{http://pages.cs.wisc.edu/~cao/cs537/lecture17.txt}

The complete code

\documentclass{article} 
\usepackage[utf8]{inputenc}

\title{jgklgi} 
\author{mancdmejldmuxsvsyf} 
\date{February 2020}

\begin{document}

\maketitle

\section{Introduction} \usepackage{hyperref} \href{http://pages.cs.wisc.edu/~cao/cs537/lecture17.txt} 

\end{document}
14
  • works fine for me. Show a complete small example. Feb 19, 2020 at 15:49
  • \documentclass{article} \usepackage[utf8]{inputenc} \title{jgklgi} \author{mancdmejldmuxsvsyf } \date{February 2020} \begin{document} \maketitle \section{Introduction} \usepackage{hyperref} \href{pages.cs.wisc.edu/~cao/cs537/lecture17.txt} \end{document}
    – Turing101
    Feb 19, 2020 at 15:54
  • 3
    \usepackage{hyperref} must be placed in the preamble and not in the body of the document. Your code should actually result in an error message about this.
    – leandriis
    Feb 19, 2020 at 15:56
  • 1
    The example has another problem, \href takes two arguments (the url and the link text) and not one. Please test out example code before you post it. In any case, the link works fine if I correct that (i.e., the text file is opened in the browser, Firefox in my case). Maybe your browser has some security setting that prevents you from opening text files?
    – Marijn
    Feb 19, 2020 at 16:01
  • 1
    Also, welcome to TeX.SE of course :)
    – Marijn
    Feb 19, 2020 at 16:01

1 Answer 1

2

Too large for comment

This works just fine

\documentclass{article}
\usepackage[utf8]{inputenc}
\title{test}
\author{test}

\usepackage{hyperref}
\begin{document}

\maketitle

\section{Introduction}
\url{http://pages.cs.wisc.edu/~cao/cs537/lecture17.txt}
\end{document}
1
  • Thanks a ton..... :)
    – Turing101
    Feb 19, 2020 at 16:07

You must log in to answer this question.

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