# Package inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. \acro{I2C}[I²C]

Package inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. \acro{I2C}[I²C]{Inter-Integrated Circuit}

So I get this error I get when I try to compile my university latex template. Any suggestions please?

The code looks something like this:

\documentclass[
a4paper,
12pt,
oneside,
BCOR1cm,
toc=chapterentrywithdots]
{scrbook}

\usepackage{graphicx}           % use for pdfLatex
\usepackage{makeidx} % f\"{u}r Benutzung des Befehls \printindex
\usepackage{tocbibind}
\usepackage{blindtext}
\usepackage{subfigure}
\usepackage{acronym}

\hypersetup{%
bookmarksnumbered=true, hyperindex=true,
%
%Im Acrobat Reader Subtitel 1. Ebene anzeigen
bookmarksopen=true, bookmarksopenlevel=1,
%
pdfborder=0 0 0 % Keine Box um die Links!
}

\renewcommand*{\tableofcontents}{%
\begingroup
\tocsection
\tocfile{\contentsname}{toc}
\endgroup
}
\renewcommand*{\listoffigures}{%
\begingroup
\tocsection
\tocfile{\listfigurename}{lof}
\endgroup
}
\renewcommand{\listoftables}{
\begingroup
\tocsection
\tocfile{\listtablename}{lot}
\endgroup
}
\begin{document}

\begin{titlepage}

{
\begin{center}
\raisebox{-1ex}{\includegraphics[scale=1.5]
{Uni_positiv_gruen.pdf}}\\
\end{center}
\vspace{0.5cm}
}

\begin{center}

\LARGE{\textbf{Title of the thesis}}\\
\vspace{1cm}

\Large{\textbf{Thesis}}\\
\vspace{1cm}
Submitted in Fulfilment of the\\
M.Sc.\\
\vspace{0.5cm}
Dept. of Computer Science\\
Chair of Computer Engineering
\end{center}
\vspace{3cm}
Submitted by: Max Mustermann\\
Student ID: 111222\\
Date: 12.12.1212\\
\vspace{0.3cm}\\
Supervising tutor: Prof. Dr. \\
(further supervisors)

\end{titlepage}

\blindtext
\\\\
\textbf{Keywords: Keyword1, Keyword2, Keyword3, ...max 5}

\tableofcontents
\listoffigures
\listoftables

\twocolumn
\begin{acronym}[Bash]
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\end{acronym}

\chapter{Introduction}
\input{src/intro}  % Load Data from File intro.tex

\chapter{Tables}
\input{src/example_tables} % Load Data from File example_tables

\chapter{Figures}
\input{src/example_figures} % Load Data from File example_figures

\chapter{Referencing}
% Alternativ just write your text under \chapter like this example

\chapter{Subchapter}

\printindex

\end{document}


• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – BambOo Aug 22 '18 at 19:58

As you don't prowide the expected MWE, I dont know what \acro does.

But generally speaking, to declare unknown unicode characters you should load

\usepackage[utf8]{inputenc}


and use:

\DeclareUnicodeCharacter{<unicode-in-hexa>}{<latex-code>}


that is to say in your case:

\DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}}


A simpler alternative :

\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{²}{\ensuremath{{}^2}}


EDIT (with the MWE) I have just pasted

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}}


or

\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{²}{\ensuremath{{}^2}}


at the beginning of the preamble of your MWE, and (after correction of BCOR1cm into BCOR=1cm) it works without any error or warning, and gives in both cases:

• HI, I am trying to add the code, but it kind of comes as a block, I am not able to put it in code format. Help plz? – Newbee Aug 22 '18 at 20:26
• Hi, just updated the code. Now I know how to use the code structuring here. :) – Newbee Aug 22 '18 at 20:48
• I also get a lot more errors and multiple warning, if possible can any one elaborate on the others too? – Newbee Aug 22 '18 at 20:54
• @Newbee: I just compiled your code snippet and it return with no errors … – current_user Aug 22 '18 at 21:00
• hi @current_user : how? Did u use any of the suggestion mentioned above? – Newbee Aug 23 '18 at 9:42

You’re running the legacy toolchain, which still uses 8-bit text encodings specific to LaTeX, and not loading the encoding that contains that character.

### With Modern TeX Engines

The solution I recommend is to switch to LuaLaTeX or XeLaTeX and load \usepackage{fontspec} instead of fontenc. This will switch you over to using Unicode and modern, standard fonts. Places that still aren’t compatible with the newer toolchain should update.

### With Type 1 Fonts

If you can’t do that, the LaTeX font encoding that contains ² is TS1, the text-companion encoding. By default, LaTeX 3 will run \usepackage[utf8]{inputenc} after your preamble and before \begin{document}. It will convert UTF-8 characters into LaTeX commands, but because there are so many, and because some encodings overlap, it will only define the commands for encodings you have loaded. For historical reasons back in the late twentieth century, you set up the TS1 encoding from the textcomp package.

\usepackage[T1]{fontenc}
\usepackage{textcomp}


(If you’re interested, this is because, back when commercial Type 1 fonts were still around, they didn’t include most of the symbols from TS1 unless they were specifically designed for then-bleeding-edge TeX. So, the package sets up the symbols your TS1 font actually contains.)

### A Fallback

Another option is to load the newunicodechar package and define the command

\newunicodechar{²}{\textsuperscript{2}}


This is the only way to support certain other superscript characters in Unicode.