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.

I'm using the following package for convert a PDF to a PDF/A format

\usepackage[a-1b]{pdfx}

When I compile, I receive the following error.

"Option clash for package hyperref"

I've searched within TEX but until now I didn't find any valid solution.

I compile with Mac OS Tex in TexShop. The typeset is set as LaTex.

Thank you in advance.

Edit

Here a small example of what I'm trying to achieve

\documentclass[english,lof,lot]{thesis} 
\errorcontextlines=9

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}

\usepackage{lmodern}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Added Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{caption}
\usepackage{algorithmic}
\usepackage{array}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[figuresright]{rotating}
\usepackage{float}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF/A
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[a-1b]{pdfx}

// begin document here...

where thesis.cls is a document class that contains the following

\RequirePackage{ifpdf}
\ifpdf
  \RequirePackage[pdfpagelabels]{hyperref}
\else
  \RequirePackage{hyperref}
\fi

Since I didn't write the class, I would like to know if how is it possible to overcome the error.

When I try to compile with this configuration, the error is the following

The package hyperref has already been loaded with options: [pdfpagelabels]. There has now been an attempt to load with option [pdftex,pdfa] Adding the global options:pdfpagelabels,pdftex,pdfa to your \documentclass declaration may fix this.

share|improve this question
2  
if you type h to the prompt it should tell you which option clashed and suggest a possible workaround –  David Carlisle Jan 3 '13 at 0:05
1  
The package pdfx already loads hyperref; if you need to set other options for this one, use \hypersetup{<options>} –  egreg Jan 3 '13 at 0:06
    
@DavidCarlisle Thank you. The compiler gives me: The package hyperref has already been loaded with options: [pdfpagelabels] There has now been an attempt to load with option [pdftex,latex] Adding the global options:pdfpagelabels,pdftex,pdfa to your \documentclass declaration may fix this –  flexaddicted Jan 3 '13 at 0:10
    
@egreg Thank you. What do you mean with your comment? I'm not very expert about this. –  flexaddicted Jan 3 '13 at 0:10
1  
On the next line it will have said Adding the global options:... to your \documentclass declaration may fix this. add the options it says to \documentclass (this can fail but it works in most cases) –  David Carlisle Jan 3 '13 at 0:12
show 5 more comments

2 Answers 2

up vote 1 down vote accepted

Following @egreg comment

The package pdfx already loads hyperref; if you need to set other options for this one, use \hypersetup{options here}

I removed this code in the class file

\RequirePackage{ifpdf}
\ifpdf
  \RequirePackage[pdfpagelabels]{hyperref}
\else
  \RequirePackage{hyperref}
\fi

and in .tex file I did the following

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF/A
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[a-1b]{pdfx}
\hypersetup{pdfpagelabels}

Now it compiles and when I open it trough Adobe, it says me that is PDF/A compliant.

I think this works since I compile through PdfLaTex, but I'm not sure. I'm not an expert on this.

If exists a better solution, let me know. I will try it and remove the mark for my answer.

P.S. @Herbert, thank you for the support.

share|improve this answer
add comment

that should be

\RequirePackage{ifpdf}
\ifpdf \PassOptionsToPackage{pdfpagelabels}{hyperref} \fi
\RequirePackage{hyperref}
share|improve this answer
    
+1 for you support. Do I need to replace your code in my cls file? Why the else statement is removed? Thanks. –  flexaddicted Jan 3 '13 at 9:10
    
copy the thesis.cls to mythesis.cls and change that part of code. For a test put mythesis.cls into your documents directory and use \documentclass{mythesis}. The else part is not needed because hyperrefis loaded anyway. –  Herbert Jan 3 '13 at 9:15
    
Always the same error. The log has changed a bit: [pdfpagelabels,] There has now been an attempt to load it with options [pdftex,pdfa] Adding the global options: pdfpagelabels,,pdftex,pdfa –  flexaddicted Jan 3 '13 at 9:20
    
before you load pdfax do a \PassOptionsToPackage{pdfpagelabels}{hyperref} And do not use the option pdftex. Is the thesis.cls for download anywhere? –  Herbert Jan 3 '13 at 9:46
    
Well, Does pdfax is the same of pdfx? I tried to use \PassOptionsToPackage{pdfpagelabels}{hyperref} before documentclass, but no chance. I'm not using pdftex option anywhere. I searched in the class but I cannot find it. Now I'm compiling under Windows with pdfLatex. I didn't write the class, so I'm not sure I can share it. Thank you for your support. –  flexaddicted Jan 3 '13 at 9:56
show 1 more comment

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.