I've been trying to get a hyperlinked table of contents working with a preexisting large book project. I've tried hyperref, and have had problems getting it to work right. In case it's of interest, I'll append a brief description of the problems, but the long and the short of it is that I'm getting the impression of hyperref as a big, complex, fragile package that includes a lot of unrelated functionality such as PDF titling, and I don't want to use it. Is there any alternative that will allow me to do something more low-level and just generate the hyperlinks I want? All I want is something like this:

\target{about-socrates}Socrates was sentenced to execution by drinking hemlock.
We recall that \href{about-socrates}{Socrates} drank hemlock.

That's all I need. I don't need it to do any styling of links for me (colors, boxes, etc.) -- I can handle that myself. I only need it to work with PDF output, not DVI, HTML, etc. I don't need it to automatically generate hyperlinks in the TOC; I think I can do that myself as well.

Description of the problems with hyperref (probably irrelevant)

I get a cryptic error message if I invoke hyperref after all other packages (! Package hyperref Error: This should not happen! (hyperref) Missing version of 'hpdftex.def'.), and although this error goes away if I invoke it before other packages, then some of the page numbers it links to are wrong. Unfortunately I have not had any luck getting a MWE to demonstrate either problem.

  • It's no answer to your question (well, I know of no other package), but what is precisely your problem? Please post a MWE in order to show the issue. I agree with you, that the various \href commands from hyperref might be confusing a little bit – user31729 Sep 7 '14 at 23:01
  • 2
    I have to admit that I've more-or-less given up on hyperlinks except when using beamer in part because every time I solved one issue, I seemed to create another. I don't think there is any other option, though. Everything which isn't hyperref seems to use hyperref. PDF metadata (title etc.) is actually easy but I don't think that requires hyperref. If you really want to go low level, you should look at the documentation for pdfTeX but I doubt that will prove simpler than hyperref. – cfr Sep 7 '14 at 23:17
  • 1
    @BenCrowell: hyperref is complex, given its functionality, that's true. It's big... yes, somehow... fragile? Well, I use only some of its features, but I have not expeared it to be fragile – user31729 Sep 7 '14 at 23:24
  • 6
    The error message indicates that your hyperref installation is broken. All its files should come from the same version. The .log file tells, where the files (e.g. hyperref.sty, hpdftex.def) are found. – Heiko Oberdiek Sep 7 '14 at 23:27
  • 1
    @BenCrowell If you can't provide a MWE, it is going to be really difficult for anybody to guess what is wrong. As I say, producing one is just tedious - it is a mechanical procedure you go through. Sometimes it takes a while. Sometimes you can make a lucky or informed guess and get there quicker. But the slow, tedious way is always an option when you are unlucky and uninformed. (As I often find I am.) If you really don't want to use hyperref then, short of using the low-level pdfTeX stuff, I think you have to give up hyperlinks. – cfr Sep 7 '14 at 23:27

You can use the navigator package.

Nav­i­ga­tor im­ple­ments PDF fea­tures for all for­mats (with some lim­i­ta­tions in ConTEXt) with PDFTEX, LuaTEX and X∃TEX (i.e. xd­vipdfmx). Fea­tures in­clude:

  • Cus­tomiz­able out­lines (i.e. book­marks);
  • An­chors;
  • Links and ac­tions (e.g. JavaScript or user-de­fined PDF ac­tions);
  • File em­bed­ding (not in ConTEXt);
  • Doc­u­ment in­for­ma­tion and PDF viewer's dis­play (not in ConTEXt); and
  • Com­mands to cre­ate and use raw PDF ob­jects

Nav­i­ga­tor re­quires texapi and yax, both ver­sion at least 1.03.

Using navigator, the code snippet you included above would look like

\anchor{about-socrates}Socrates was sentenced to execution by drinking hemlock.
We recall that \jumplink{about-socrates}{Socrates} drank hemlock.
  • (+1) Never heard of this. Looks intriguing. (Though I do wish there were not quite so many different key-value systems. Not the fault of this package. Just the cumulative effect of lots of packages choosing different things.) – cfr Sep 8 '14 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.