# pdfx option clash inputenc + fontenc + hyperref

I want to compile my .tex file with pdflatex but get an option clash, since I load pdfx to get a PDF/A-1b compliant file.

This is part of my header:

\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
\usepackage[
linktocpage=false,      % no page numbers are clickable
bookmarks,              % creates bookmarks in pdf
hyperfootnotes=true,    % clickable footnotes
pdfborder={0 0 0},      % for removing borders around links
bookmarksnumbered=true, % If Acrobat bookmarks are requested, include section numbers.
bookmarksopen=false,    % If Acrobat bookmarks are requested, show them with all the subtrees expanded.
%citecolor=blue,
%urlcolor=blue
pdfpagemode={UseOutlines}, % show pdf bookmarks (indices) on startup; does not function all the time
pdftitle={...}, % title
pdfauthor={...}, % author
pdfkeywords={...}, % subject of the document
pdfsubject={...}, % list of keywords
{hyperref}
\usepackage{url} % Urls become clickable
\urlstyle{same}

\usepackage[a-1b]{pdfx}
\hypersetup{pdfpagelabels}

% ------
% Fonts and typesetting settings
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine} % libertine font as pbk (=Garamond font, ugm) substitution
\renewcommand{\familydefault}{pbk} % to change the headers and body texts
\usepackage{mathpazo} % palatino font as pbk (=Optima font, pbk) substitution
%\usepackage{lmodern} % removes this restriction by allowing font sizes at arbitrary sizes
\usepackage{mycals}
\usepackage{ngerman} % new german spelling

\begin{document}
foobar here
\end{document}


Bonus question: I did not get the difference of inputenc and fontenc but I know that I have to insert both packages for this document. Otherwise I would run into issues with the fonts.

I get no error if I load the packages in the correct order:

\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
% Fonts and typesetting settings
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[sc]{mathpazo} % For Palatino
%\usepackage{mycals} % What's this????

\usepackage[
linktocpage=false,      % no page numbers are clickable
bookmarks,              % creates bookmarks in pdf
hyperfootnotes=true,    % clickable footnotes
pdfborder={0 0 0},      % for removing borders around links
bookmarksnumbered=true, % If Acrobat bookmarks are requested, include section numbers.
bookmarksopen=false,    % If Acrobat bookmarks are requested, show them with all the subtrees expanded.
%citecolor=blue,
%urlcolor=blue,
pdfpagemode={UseOutlines}, % show pdf bookmarks (indices) on startup; does not function all the time
pdftitle={...}, % title
pdfauthor={...}, % author
pdfkeywords={...}, % subject of the document
pdfsubject={...}, % list of keywords
pdfpagelabels,
]{hyperref}
\usepackage[a-1b]{pdfx}

\urlstyle{same}

% ------

\begin{document}
foobar here
\end{document}


Note that hyperref should be loaded as late as possible, with some exceptions such as pdfx and cleveref.

Also \usepackage{ngerman} should be replaced by \usepackage[ngerman]{babel} and it doesn't make sense to load libertine and doing \renewcommand{\rmdefault}{pbk} if you later do \usepackage{mathpazo}. No need to load url, because it's already loaded by hyperref.

I'm not sure what you think pbk means: it's the symbolic name for Bookman.

I commented mycals, as I know nothing about it.

• Thanks egreg, it functions now! I need pbk for a slightly different type setting in some parts of the book. I added the suggestion you made. mycals is a sty I wrote for some styling and only forgot to remove it from the minimal example. – Til Hund Oct 11 '15 at 14:02

With pdfx.sty (v1.5.8) the following order of packages works also, provided you change the \usepackage[..options..]{hyperref} into \hypersetup{..options..}.

\documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook}
\usepackage[a-1b]{pdfx}
% Fonts and typesetting settings
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[sc]{mathpazo} % For Palatino
...
\hypersetup{%
linktocpage=false,      % no page numbers are clickable

I've put a lot of work, within pdfx.sty, into ensuring compatibility with other packages, and am doing further work to allow it to be loaded at any point within the LaTeX preamble. So I'd appreciate notification of any incompatibility that anyone encounters. Example documents are just what I need.
• I just added \usepackage[x-1a]{pdfx} to a custom class I am developing and suddenly got an option clash for [utf8x]{inputenc} so I switched the order of my inputenc and fontenc lines as suggested, but the error still occurs. Email me and I'll send you the example. – Peter Flynn Jul 23 '17 at 20:43
• You mean I won't need the \usepackage{inputenc}? I had tried with \PassOptionsToPackage{utf8x}{inputenc} but I didn't realise pdfx.sty loaded inputenc. – Peter Flynn Jul 24 '17 at 22:00
• Umm. Two problems with that: (a) it gags on \PrerenderUnicode{š} and half a dozen similar, saying Undefined control sequence. \305->\UTFviii@two@octets; and (b) it also gags on an ellipsis character (LaTeX Error: Command \dots unavailable in encoding T1) and a pound sterling character (LaTeX Error: Command \pounds unavailable in encoding T1). – Peter Flynn Jul 24 '17 at 22:14