3

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.

6
  • wrong doesn't give much of a clue, do you get an error, or the wrong letter, or nothing. Are you sure your source is encoded in utf8? Apr 12, 2013 at 21:41
  • As I said, I get wrong letters, the ones with accents. Instead of them, strange characters appear (something like à and a square, where there has to be an 'í'). If I write \'i I get the right character, but I want to write 'í' and get my character. in the preferences of the editor it's set utf8 as the enconding, so I think it is. If I compile a simple document with this encoding, the accented characters work fine. And I don't get any error.
    – dpravos
    Apr 12, 2013 at 21:51
  • They are not "strange letters" the accented capital A is a classic sign that you have encoded the file in utf8 but have processed it as latin1. Apr 12, 2013 at 22:11
  • 1
    ... 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. Apr 12, 2013 at 22:20
  • I use spanish language a lot too, and I'm behind @DavidCarlisle on this one. You should be able to get rid of whatever is messing with your encoding Apr 12, 2013 at 22:32

2 Answers 2

2

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.

1
  • @David Pravos Use a cross-platform unicode LaTeX editor from big list with Platforms: all, Unicode:Yes and Be careful while opening/saving unknown-files-with-unknown-encoding normally editors would detect automatically file encoding, otherwise mention explicitly input encoding via \usepackage[utf8]{inputenc}. Editor encoding,File encoding, and utf8 option inside inputenc must be same to avoid any encoding issues. Apr 13, 2013 at 3:36
0

The solution in error for special characters in \section in a classicthesis worked for me, I used:

\usepackage[T1]{fontenc}                
\usepackage[utf8]{inputenc}
\usepackage[linedheaders,parts,pdfspacing]{classicthesis} 
\usepackage[spanish]{babel}
1
  • Would you consider this a duplicate then?
    – Werner
    Sep 23, 2016 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .