9

I know already that \usepackage{url} and then using the \url{} command will allow me to insert URLs without the hyperlink, but, I do not even use this package and used the \url{} command and it gives the URLs hyperlinks and if I add \usepackage{url}, it still adds the hyperlinks. Here are the list of packages that I am already using with my document:

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[scaled=.92]{helvet}
\usepackage{graphicx} 
\usepackage{balance}  
\usepackage{booktabs} 
\usepackage{ccicons}  
\usepackage{ragged2e} 
\usepackage[flushleft]{threeparttable}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}

\makeatletter
\makeatother
\usepackage{lmodern} 
lonesome
  • 565

2 Answers2

11

The question is tagged with hyperref, then \nolinkurl is the counterpart of \url without link.

If hyperref is not used, then the link is probably created by the PDF viewer, which uses a heuristics to detect links in text.

Heiko Oberdiek
  • 271,626
  • That \nolinkurl works perfectly fine. – lonesome Jan 04 '16 at 05:09
  • 2
    Note that the hyperlink may still be active, but be viewer-dependent. Adobe Reader, for example, interprets both \url and \nolinkurl with a clickable link. – Werner Jan 04 '16 at 05:13
  • @Werner yes I have noticed that but it will be only active if it has either www or http as a part of the URL and will be only clickable as a part of the URL and not the whole URL, if it has more further segments.. But if we remove www or http from the URL, the URL will be completely read only. Even if we just leave the URL as how it is, it will not be converted into a blue text which is still good though. – lonesome Jan 05 '16 at 04:10
1

It is not very clear what you want to achieve, but you can simply type those links in plain text (while escaping characters that need to be escaped). Please note that this may produce subpar results:

\documentclass{article}
\usepackage[colorlinks=true, urlcolor=black]{hyperref}

\begin{document}
The following text is a link but is not clickable: http://myexample.com \par
Some links need to be altered by hand: https://en.wikibooks.org/wiki/LaTeX/Hyperlinks\#Hyperlink\_and\_Hypertarget \par
Text: http://myexample.com/index.php?a=1\&b=1\_p \par
\verb|href|: \href{http://myexample.com/index.php?a=1&b=1_p}{http://myexample.com/index.php?a=1\&b=1\_p}
\end{document}

enter image description here

If you do not want those links to be active at all, use the [draft] option of the hyperref package, as suggested by this excellent answer.

  • 1
    try this link and you will get an error at first line :

    https://twitter.com/sig_chi?lang=en

    moreover, treating URL as plain text will exceed the border line of a marginpar . So that is not suitable either.

    – lonesome Jan 04 '16 at 05:06
  • 1
    @lonesome That's because you need to escape the underscore: twiitter.com/sig\_chi?lang=en – timelmer Jul 17 '18 at 22:43