[Tex/LaTex] pdfx option clash inputenc + fontenc + hyperref

hyperrefpdf-apdftexpdfx

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
colorlinks=false,       % no color
breaklinks=true,        % break URLs
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.
%hidelinks=true,
%linkcolor=blue,
%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
pdfmenubar=true]        % make PDF viewer’s menu bar visible
{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
%\linespread{1.05}
%\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.

Best Answer

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
  colorlinks=false,       % no color
  breaklinks=true,        % break URLs
  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.
  %hidelinks=true,
  %linkcolor=blue,
  %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
  pdfmenubar=true,        % make PDF viewer’s menu bar visible
  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.