2
\documentclass [12pt,a4paper] {article}
\usepackage {geometry}
\usepackage {graphicx}
\usepackage {hyperref}
%
\begin {document}
bapi

\par

\begin {eqnarray}
\frac{dy}{dt} &=& -t \\
%
\frac{dx}{dt} &=& 1
%
\end {eqnarray}

\end {document}

To run the LaTeX file abc.tex, I use the command latex abc.tex. Then an error message will occur:

! LaTeX Error: File `url.sty' not found.
Type X to quit or <RETURN> to proceed, or enter new name.
(Default extension: sty) Enter file name:

I am using Ubuntu 14.04 LTS and the version of the TeX compiler in my computer is pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian).

Without \usepackage{hyperref}, there is no error message and the .tex file run smoothly.

What is the problem with \usepackage{hyperref}?

Heiko Oberdiek
  • 271,626
Bapi
  • 121
  • Which command did you run to build the file? When I run latex -output-format pdf abc.tex it compiles just fine. – Skillmon Jan 08 '17 at 14:42
  • And which error message does occur when you run pdftex? – Skillmon Jan 08 '17 at 14:48
  • 2
    It is well known that eqnarray doesn't work with hyperref; on the other hand, eqnarray should not be used, see eqnarray vs align – egreg Jan 08 '17 at 15:06
  • The error message is -------------- ! LaTeX Error: File `url.sty' not found.

    Type X to quit or to proceed, or enter new name. (Default extension: sty)

    Enter file name:

    – Bapi Jan 08 '17 at 15:08
  • while i use \usepackage{graphicx} , the file compile and run smoothly. But while use \usepackage {hyperref} , then error occurs @barbara beeton – Bapi Jan 08 '17 at 15:09
  • Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – Martin Schröder Jan 08 '17 at 18:03
  • 4
    url.sty is part of all the major tex distributions, if for some reason you really do not have it, just update your tex installation with your package manager and install it. – David Carlisle Jan 08 '17 at 23:57
  • Can you please tell me how to update my latex, so that it runs without error ? I want to know the particular process, as you told about package manager . Please help @David Carlisle – Bapi Jan 09 '17 at 15:02
  • I understand, what do you want to say, as I cannot use any \ref command for describing the process. But, I only want to know that why the code shows error only by using \usepackage {hyperref}. Thats all. @MartinSchröder – Bapi Jan 09 '17 at 15:05
  • 1
    It's hard to know why you don't have url already (you could just copy it from ctan and put it in the same directory as your document) to do a proper install I would guess the debian setup is managed by apt-get rather than the usual tlmgr from texlive but I do not know the details. just saving url.sty from here is probably simplest https://www.ctan.org/tex-archive/macros/latex/contrib/url/ – David Carlisle Jan 09 '17 at 15:22
  • Any updates? Do you have this problem with up-to-day software and packages? – Bobyandbob Dec 14 '17 at 18:44

1 Answers1

1

Many packages rely on other packages for their work. For example, package loads the following packages directly or indirectly:

  • keyval
  • graphics
    • trig

Furthermore, the configuration file graphics.cfg can load further packages, e.g. (without duplicates):

  • pdftexcmds
    • infwarerr
    • ltxcmds
    • ifpdf
  • epstopdf-base
    • grfext
    • kvoptions
      • kvsetkeys
        • etexcmds

Also, hyperref loads many packages, one of them is url. If the package is not installed, you get the error message and the macro \url will not work.

Solution:

Install the package with the means of your TeX distribution. Packages that are not provided by the TeX distribution (very unlikely in case of package url) can often be found on CTAN.


BTW, environment eqnarray is commonly considered as deprecated. Package amsmath provides much better and powerful environments for vertical equation alignments. See "eqnarray vs align" for more details.

Heiko Oberdiek
  • 271,626