[Tugindia] Hyperref and url

Nina Mazumdar nina.mazumdar at gmail.com
Fri Sep 5 07:45:48 CEST 2008

On Thu, Sep 4, 2008 at 9:15 PM, Dr C. K. Raju <dr_c_k_raju at hotmail.com> wrote:
> I want to use both packages hyperref and url (together with memoir, endnotes, and a special font).

Of course, you can.  In fact, hyperref loads url.sty internally and
therefore, when you use hyperref, in fact, you are using url.sty as

> 1. If I use url alone, as follows, everything works fine.
> \usepackage[obeyspaces,spaces]{url}
> \urlstyle{same}
> \urldef{\tikdum}\url{http://mathforum.org/kb/thread.jspa?threadID=381990&messageID=1175734%\#1175734}
> %This url is used as an argument to \footnote, and is fragile since it contains the % sign. In contrast, the defined \url like command \tikdum is robust.

Sure, that is the way to do it.

> (But of course I don't get bookmarks to the chapters and contents in the pdf document, which have to be created manually. This is fine if I only want to print.)

Obviously, since you have no hyperref loaded.

> 2. If I use hyperref alone,
> \usepackage[pdftex, bookmarksnumbered=true, breaklinks=true]{hyperref}
> it does not correctly understand a url of the following sort and flags this as an error (in the .ent file)
> \textit{Augustan History,}\url{http://penelope.uchicago.edu/Thayer/E/Roman/Texts/Historia_Augusta/Firmus_et_al*.html\#8}
> Also, links are _not_ automatically wrapped in the pdfviewer (Acrobat 6). (Have I overlooked some option other than breaklinks?) The package breakurl says that this feature is already included in pdflatex. [Also there are no links to endnotes, as one would want.]

Unfortunately, I could not replicate your problem.  I have the following setup:

OS: GNU/Linux kernel  2.6.24-19-generic
pdfTeX:  1.40.9-2.2  (from TeXLive 2008)
url.sty:    3.3   (TeXLive 2008)
hyperref.sty: 6.78f (TeXLive 2008)

> 3. If I use package hyperref _before_ package url that leads to an error (conflicting options for package url) and no pages of output.

That won't work, snce hyperref loads url.sty and would result in option clash.

> 4. If I use package hyperref _after_ package url I still get the error, but I also get an output. However, the urls in the endnotes remain all mucked up as if the package url had not been loaded at all.

I'm afraid, this can't happen.  Seems like you have an old setup.

> 5. As far as I can see, hyperref has no command analogous to \urldef of package url. If I use \href to try to define \url like commands as in

You can surely use this since hyperref loads url.sty.

> \href{\tikdum}\url{http://mathforum.org/kb/thread.jspa?threadID=381990&messageID=1175734%\#1175734}
> that is flagged as an error. Also,  \href seems to change the font.
> Any suggestions?

Time to upgrade your TeX system.

Happy TeXing and best regards


More information about the tugindia mailing list