1

EDIT: I must clarify that the example below works with tufte-latex-3.5.0, but doesn't work in older versions. The accepted solution is a good workaround for older versions (<3.0.0) were nohyper option doesn't work.


(EDIT: Older version of) tufte-handout class doesn't seem to play well with hyperref, probably because tufte-handout loads hyperref with its own set of options. How can I set up the document so that hyperref can be loaded normally?

I thought that the option nohyper would solve the problem but it doesn't.

The idea is to be able to have a simple document that compiles correctly whether I change tufte-handout by article in the \documentclass command.

Here is an example code (not working)

\documentclass[nohyper]{tufte-handout} 
% but works with \documentclass{article}
\usepackage[hyperfootnotes=false, pdftex, pdfauthor={}, pdftitle={ hyperref.pdf}, pdfsubject={subject}, pdfkeywords={}]{hyperref} 
% but works with \usepackage[hyperfootnotes=false,]{hyperref}
\begin{document}
Body text.
\end{document}
2
  • 1
    What hyperref options do you want to set/change with the tufte-handout class? Can you use the \hypersetup command?
    – godbyk
    Aug 9, 2012 at 22:05
  • Any option in hyperref seems to break the compatibility (for example, the ones in the example in my question). hypersetup (+1) is an option but I just wanted to change the documentclass line, for things that already compiled for article.
    – alfC
    Aug 9, 2012 at 22:14

1 Answer 1

2

You can use the \@ifpackageloaded command to run other commands depending on whether or not the hyperref package has already been loaded.

\documentclass{tufte-handout}% or article

\makeatletter
\@ifpackageloaded{hyperref}{%
  % do this if hyperref is already loaded
  % (e.g., if you're using the tufte-handout
  % document class)
  \hypersetup{
    pdfauthor={},
    pdftitle={Tufte-LaTeX document},
    pdfsubject={subject},
    pdfkeywords={}
  }%
}{%
  % do this if the hyperref package hasn't
  % been loaded yet
  \usepackage[
    hyperfootnotes=false,
    pdftex,
    pdfauthor={},
    pdftitle={article},
    pdfsubject={subject},
    pdfkeywords={}]{hyperref}
}
\makeatother

\begin{document}
Body text.
\end{document}
2
  • Thank you, I also figured out that nohyper option doesn't work for old versions of tufte-latex. For that your solution is a good workaround.
    – alfC
    Aug 10, 2012 at 18:24
  • 1
    @alfC: The nohyper option was added to the code May 19, 2009. So it looks like it should exist in all versions after (but not including) 3.0.0.
    – godbyk
    Aug 10, 2012 at 20:02

You must log in to answer this question.

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