Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ?

share|improve this question
    
When I compile it I get the accents. –  N.N. Nov 4 '11 at 8:08
    
Same here, I seem to have no problem compiling this will accents. I'm on Lion too, TeXLive-2011. –  qubyte Nov 4 '11 at 8:13
    
Check the log file for warnings. –  Thorsten Donig Nov 4 '11 at 8:30
    
No problem with your code with MikTeX. Look at you .log file and may be will find some clue there. By the way, if you include spanish as option for documentclass, you don't need to include in babel. And if you just use one language, don't need \selectlanguage command. –  Ignasi Nov 4 '11 at 8:34
6  
Make sure that the source file is saved with the same encoding as you use for input (UTF-8 here). –  Thorsten Donig Nov 4 '11 at 8:39

5 Answers 5

up vote 8 down vote accepted

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}
share|improve this answer

Gando, I just compile this code with pdflatex in an iMac (Mountain Lion OS X):

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

¡Hola! ¿Cómo estás ?

\end{document}

and got this output: enter image description here

share|improve this answer

You can also use escape codes for any accent you want to make. In general, it might be easier to fix the encoding once than have to escape every accented character, but for the occasional foreign name I use the table here http://en.wikibooks.org/wiki/LaTeX/Special_Characters.

Specifically, I would write:

!`Hola!, ?`c\'{o}mo est\'{a}s?

Note, to get the initial question mark and exclamation point, you type a backtick character immediately after.

share|improve this answer

Try this:

\documentclass[11pt, spanish]{report}

\usepackage[spanish]{babel}

\usepackage[latin1]{inputenc}

\begin{document}

    Hola! Cómo estás ?

\end{document}

It should work with the additional package

share|improve this answer

For avoid that problem try this:

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

    ¡Hola! ¿Cómo estás?

\end{document}

If this doesn't compile right then perhaps the problem are not in the packages or the codification.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.