I have a class file in my LaTeX project. When I include the package \usepackage{hyperref} I get the following error:

LaTeX Error: Option clash for package inputenc.

The cls file:

% http://ctan.mirrors.hoobly.com/macros/latex/doc/clsguide.pdf
\ProvidesClass{SCmastersthesis}[2021/11/30 SC Master''s Thesis class]

\LoadClass[12pt, a4paper, openright]{report}

% Usefull packages
\usepackage[arabic, french, english]{babel}

\RequirePackage{microtype}   % Improves typography
\RequirePackage{tabto}       % Tabulation
\RequirePackage{anyfontsize} % size of fonts
% For all sorts of hyperlinks in the PDF output.

% Commands for title, readers, authors, dates, specialities,...

% Lenghts

% Title creation
    % background
    \noindent \hspace{-3cm} 
    % Font
    \color{white} \fontfamily{phv} \selectfont
    % Define lengths
    % Title and subtitle
      \fontsize{26}{36}\selectfont \textbf{\@title}
      \ifdef{\@subtitle}{\fontsize{20}{30} \selectfont \@subtitle}{$ $} \\
    % Metadata
    \noindent \hspace{1.7cm}
      % authors
        \ifdef{\@secondauthor}{, \@secondauthor}{}
        \ifdef{\@thirdauthor}{, \@thirdauthor}{}}
      % supervisors
        \ifdef{\@secondsupervisor}{, \@secondsupervisor}{}\ifdef{\@thirdsupervisor}{, \@thirdsupervisor}{}}
      % readers
        \ifdef{\@readertwo}{, \@readertwo}{}\ifdef{\@readerthree}{, \@readerthree}{}\ifdef{\@readerfour}{, \@readerfour}{}\ifdef{\@readerfive}{, \@readerfive}{}}
      % academic year
      Année académique \@years
      % degree title

% Front cover page

% Back cover page


  • 4
    what do you intend \usepackage[cp1256,cp1256,cp1256,cp1256,utf8x]{inputenc} to do?? It can not do anythig useful, a file can only be in one encoding at a time, and utf-8 is the default, so just delete the whole line. Aug 20, 2022 at 11:44
  • Thank you , but that doesn't resolve the problem
    – userB
    Aug 20, 2022 at 11:45
  • But the problem occurs only when I add the instruction : \usepackage{hyperref}
    – userB
    Aug 20, 2022 at 11:53
  • No it shows hyperref but only becuse that is on the following line, delete the inputec line and the error will go (I just tried your class) Aug 20, 2022 at 11:54
  • your class already loads hyperref, so why are you trying to add hyperref again? Aug 20, 2022 at 11:59

1 Answer 1


Given a test file




You get

! LaTeX Error: Option clash for package inputenc.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.10 \usepackage

But hyperref is not involved here, in fact the linebreak in the message shows [hidelinks]{hyperref} has not even been read yet.

The error is on the previous line


Which could never do anything useful, and can simply be deleted. Without this line the example runs without error

  • hm, one get the clash because arabic loads inputenc with cp1256 so simply removing the line means that the document is read as cp1256. One should probably switch the encoding, but this could break arabic ... Aug 20, 2022 at 12:14
  • I think one must load \usepackage[utf8]{inputenc} before arabic, then it won't try to load it itself. Aug 20, 2022 at 12:26
  • @UlrikeFischer the class shouldn't be specifying the document encoding anyway Aug 20, 2022 at 12:40
  • the problem is \usepackage[arabic]{babel} which will load inputenc. (arabic.ldf contains \@ifpackageloaded{inputenc}{}{\RequirePackage[cp1256]{inputenc}}}` Aug 20, 2022 at 12:44
  • @UlrikeFischer the class shouldn't be setting the document language either:-) Aug 20, 2022 at 12:48

You must log in to answer this question.

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