Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
What hyperref options do you want to set/change with the tufte-handout class? Can you use the \hypersetup command? –  godbyk Aug 9 '12 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 '12 at 22:14

1 Answer 1

up vote 2 down vote accepted

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}
share|improve this answer
    
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 '12 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 '12 at 20:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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