# Unicode error in inputenc package

My beamer presentation presents this problem Package inputenc Error: Unicode char − (U+2212)(inputenc) not set up for use with LaTeX. \end{frame}. I tried remove some elements and I see that problem appear when I use - in equation. I'd like one hint about this problem.

\documentclass[pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{upgreek}
\usepackage{mathtools}
\usetheme{Berlin}

\begin{document}
\begin{frame}{Convergência - Prova}
%\justifying
Sem perda de generalidade a demonstração foi focada numa partícula unidimensional. Reescrevendo a Equação, tem-se que
$$x_i(t + 1) + \alpha_1 x_i(t) + \alpha_2 x_i(t − 1) = \alpha_3$$
onde
\begin{aligned} \alpha_1 &= (1 + \omega) + u(r_1 - r'_1)c_1 + u(r_2 -r'_2)c_2 + c_1r{'}_1 + c_2r'_2 \\ \alpha_2 &= \omega \\ \alpha_3 &= u(r_1 - r'_1)c_1p + uc_2(r_2g - r'_2n) + c_1r'_1p + c_2r'_2n \end{aligned}
\end{frame}
\end{document}

Sorry by english

• In my notebook only exists one symbol. How can I solve this problem? – Wagner Jorge Mar 29 '17 at 13:44
• Yes, the xelatexsolved the problem. Thank you! – Wagner Jorge Mar 29 '17 at 13:47
• Which notebook? What the - key ends up giving is generally up to the editor you are using. – daleif Mar 29 '17 at 13:49

## 1 Answer

Unicode U+2212 is MINUS SIGN, which is not set up by default with inputenc. Just add

\DeclareUnicodeCharacter{2212}{-}

to your preamble, just before \begin{document}.

\documentclass[pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{upgreek}
\usepackage{mathtools}
\usetheme{Berlin}

\DeclareUnicodeCharacter{2212}{-}

\begin{document}
\begin{frame}{Convergência - Prova}
%\justifying
Sem perda de generalidade a demonstração foi focada numa partícula unidimensional. Reescrevendo a Equação, tem-se que
$$x_i(t + 1) + \alpha_1 x_i(t) + \alpha_2 x_i(t − 1) = \alpha_3$$
onde
\begin{aligned} \alpha_1 &= (1 + \omega) + u(r_1 - r'_1)c_1 + u(r_2 -r'_2)c_2 + c_1r{'}_1 + c_2r'_2 \\ \alpha_2 &= \omega \\ \alpha_3 &= u(r_1 - r'_1)c_1p + uc_2(r_2g - r'_2n) + c_1r'_1p + c_2r'_2n \end{aligned}
\end{frame}
\end{document}

This will do the right thing even without searching for the offending character (you possibly got it from copy-paste).