[Tex/LaTex] LaTeX Error: Option clash for package inputenc!

errorsinput-encodingspackages

I'm getting this problem and I can't find a fix for it. Tried searching but still couldn't find a solution. Here's how the file begins:

% !TEX encoding = UTF-8 Unicode
\documentclass{llncs}
\usepackage[utf8]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}

\usepackage[applemac]{inputenc}
\usepackage{a4}
\usepackage{epstopdf}
\usepackage{graphicx}
\usepackage{fancyvrb}

I've added the first 3 "usepackages" because I'm writing in portuguese and need the "ยด~`" symbols and I keep getting the "LaTeX Error: Option clash for package inputenc".

How can I fix this?

thanks in advance!

Best Answer

I faced the same issue (for Portuguese language) and solved as follows:

  1. The reported issue occurred to me only when a non-Latin character appeared in an input TeX file (e.g., chapter1.tex, chapter2.tex, etc.) called in main TeX file (e.g., thesis.tex). Note that for the main TeX file the package \usepackage[latin1]{inputenc} was working properly;
  2. It must be mentioned that I'm using WinEdt 9.0 editor;
  3. So, I set the "document mode" of main file (e.g., thesis.tex) as "TeX" and its "Document Format" as "ANSI - 0 Default ANSI code page";
  4. Similarly, I set the "document mode" of auxiliary files (e.g., chapter1.tex, chapter2.tex, etc.) as "TeX" and their "Document Format" as "ANSI - 0 Default ANSI code page".

In summary: before, each file was configured in different input modes. So, MikTex was unable to compile all them with "latin1" codification. Standardize all files to TeX and ANSI and call the inputenc package just once.