2

I'm writing a document in spanish language. Since I need to use spanish accents (for example "camión") the best encoding should be utf-8.

However, for some reason, when I compile the document (I'm using TeXnicCenter) I get a lot of errors. For example:

Package inputenc Error: Unicode char és) (U+45)

They occur just where the spanish accents are. Okay, I think the errors are because the .tex file is in ANSI. I proved it opening the TeX, changing it to UTF8 without BOM (using NotePad++) and zero problems when trying to compile it.

So far, I have two possible solutions: the one I wrote above and just using ANSI (removing inputenc) and writing the accents using '\.

Both ways work but they are tedious. Is there any better solution?

UPDATED: Fast solution: just change the TeX Editor. I'm using now TeXmaker and all is ok. But anyway, maybe there is a solution to users who wants to still use TeXnicCenter so I leave it open if there is a better solution.

  • You should stick to UTF-8. Just use a TeX editor that's capable of encoding your TeX files as UTF-8 by default (should be nearly every available editor by now). – TeXnician Nov 5 '17 at 15:43
  • there is no encoding called ansi really, if you are not using UTF-8 you are most likely using latin1 so should use \usepackage[latin1]{inputenc} (the fact that some accented characters accidentally work if you do not specify an encoding at all is an accident of the implementation details and should not be relied on) – David Carlisle Nov 5 '17 at 15:46
  • For some reason, latin1 makes the compiler to get errors too. By the way, just changing the editor solved the problem. – Miguel Duran Diaz Nov 5 '17 at 15:51
  • searching for texniccenter on this site suggests newer versions can default to utf-8 tex.stackexchange.com/questions/86704/… – David Carlisle Nov 5 '17 at 16:14
2

Just use TeXnicCenter correctly ...

In the following image you can see the problem:

enter image description here

the tex file wants utf8 encoding (red line) but TeXnicCenter shows in the red circle that it uses ansi.

Now just change the encoding of your tex file in TeXnicCenter with:

Click on menu point "file" (german "Datei"), then "save file" (german "speichern unter") and close the window with "save" (Speichern) as showed in the following image:

enter image description here

Now you can compile the file encoded in utf8, as you can see in TeXnicCenter ...

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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