[Tex/LaTex] Problem with accented characters in ClassicThesis template

classicthesisinput-encodingsspanish

I've just downloaded the template for ClassicThesis in CTAN and I was trying to use it writing some spanish text. I've only changed the title and name of the document (in the classicthesis-config.tex file). The document compiles, but the accented characters (like in 'Teoría') are wrong.

Now, I tell you what changes I made that are supposed to prepare the template to recieve accented characters:

  • In the classicthesis-config.tex file I have the following lines:

    \PassOptionsToPackage{utf8}{inputenc}   % latin9 (ISO-8859-9) = latin1+"Euro sign"
    \usepackage{inputenc}   
    

    (as you see, the author recommends using latin9 encoding, but i'm using TeXworks, which works in utf8. Anyway, neither latin9 nor latin1 work.)

    \PassOptionsToPackage{T1}{fontenc} % T2A for cyrillics
    \usepackage{fontenc}     
    \usepackage{textcomp} % fix warning with missing font shapes
    
  • I have the following ones, too, but I think this has nothing to do with the encoding problem:

    % Spanish languages need extra options in order to work with this template
    \PassOptionsToPackage{spanish,es-lcroman}{babel}
    \usepackage{babel}
    
  • And in the ClassicThesis.tex file I've put spanish option in the \documentclassand selected the spanish language via \selectlanguage{spanish}, but, as I said, I think this has nothing to do with the encoding, it must be related with the 'Figure', 'Table', etc. stuff.

My distribution is MiKTeX 2.9 in Windows 7.

PS: I'm compiling with pdfLaTeX.

Best Answer

I can guarantee you that using a code like this:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\begin{document}
    Sólo una pequeña demostración.

    S\'{o}lo una peque\~{n}a demostraci\'{o}n
\end{document}

Will produce a correct output like this:

enter image description here

Please make sure non of your packages required by your template or any other setting in your editor conflicts with the specifications mentioned above.

As David Carlisle said in the comments:

... so I would guess that your editor is making new files in utf8 but that file is copied from some original template and it is keeping its encoding. I don't know the editor but you should be able to force save to utf-8 (or just start a new file in utf8 and then cut and paste the old text in.