# [texhax] Using accented characters in source

Michael Barr barr at math.mcgill.ca
Sat May 1 20:46:34 CEST 2010

On Sat, 1 May 2010, Lars Madsen wrote:

> Michael Barr wrote:
>>  Now I have a simple way of actually entering an accented character in my
>>  source code (using AllChars) I began to wonder if it is easy to get TeX to
>>  interpret them correctly.  This is obviously a Windows-specific question.
>>  If I compile the file
>>
>>  \documentclass{article}
>>  \usepackage[french]{babel}
>>  \begin{document}
>>  Université
>>  \end{document}
>>
>>  with or without the second line, the output is simply Universit.  This
>>  doesn't surprise me because the Windows code page does not match any of
>>  the font encodings, as far as I know.  Still I expected that the é would
>>  generate some output.  It is hex 82 and, from the table on page 261 of The
>>  LaTeX Companion, first edition, I would have expected C with an acute
>>  accent.
>>
>>  It is not really important; only for a few foreign words in an English
>>  language text, but I am still curious.  I can always say Univerist\'e (or
>>  I could make the è active and define it to be that, but then it wouldn't
>>  hyphenate.
>>
>>  Michael Barr
>>
>>
>
> you need inputenc, LaTeX use ansii by default, så the é is ignored. Next you
> need ti figure out which input encoding your file is written in. This depends
> on the editor.
>
> In try one of the following
>
> \usepackage[ansinew]{inputenc} % std win encoding
> \usepackage[latin1]{inputenc} % latin 1
> \usepackage[applemac]{inputenc} % this is the default in TeXShop on MAC
> \usepackage[utf8]{inputenc} % default in many linux dists, and in
> % TeXWorks on all platforms
>

None of those encodings worked.  The first gave what looked like a comma
(but wasn't quite) and the other three caused a character undefined error.
But the log file told me that was being loaded was xxxx.def and the
directory that it was located in.  So I looked at those files and the
names cpxxx.def looked interesting.  In particular cp437.def seemed to
give the correct definitions.  Later I poked around in the windows help
file and discovered that code page 437 is the standard US encoding.  I
didn't test anything besides my original file, but with that encoding, it
seems to work.

TeXhax works again!

Michael Barr