[Tex/LaTex] How to use spanish accents

accentsspanish

I'm trying to add spanish accents to my document ( my Thesis )

\documentclass[11pt, spanish]{report}
\usepackage[spanish]{babel}
\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
\begin{document}

    Hola! Cómo estás ?

\end{document}

This piece of code doesn't seem to work on my Mac ( OS X Lion ), And I get:

Hola! Cmo ests?

in the pdf output.

Any ideas ?

Best Answer

You could choose another way of input encoding by the selinput package from the oberdiek bundle. It chooses the right encoding by some glyphs from your language correspondingly to the encoding of the source file.

\documentclass[11pt,spanish]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{%
  aacute={á},
  ntilde={ñ},
  Euro={€}
}
\usepackage{babel}

\begin{document}
  Hola! Cómo estás ?
\end{document}
Related Question