# Missing number, treated as zero. When attempting define special characters

Looking into multiple threads, I stil cannot seem to solve my error. I therefore hope some of you might be able to help me out?

When attempting to define the three scandinavian letters å æ ø Å Æ Ø with the following code:

\catcodeæ=\active\catcodeø=\active\catcodeå=\active
\catcodeÆ=\active\catcodeØ=\active\catcodeÅ=\active
\defæ{\ae}\defø{\o}\defå{\aa}
\defÆ{\AE}\defØ{\O}\defÅ{\AA}


I get the following error message when I typeset the document:

./main.tex:63: Missing number, treated as zero.


I am using "Classicthesis" and the input is defined as latin9

Hope one of you will be able to help me out here!

Best regards, Henrik

• Welcome to TeX.SE. Not knowing what code may be on line 63 of main.tex, it's hard to provide a clean diagnosis, let alone suggest a cure. Incidentally, since you would appear to have a keyboard that lets you enter the "Scandinavian" characters (æ, Æ, etc) directly, why not just load the inputenc and fontenc packages with the appropriate options and enter the characters along with the "non-Scandinavian" characters? Put differently, why are you making them into macros? – Mico Sep 2 '15 at 4:57
• You don't say which engine (pdfTeX/XeTeX/LuaTeX) you are using: this is important here as what you have above will only work in XeTeX and LuaTeX, not in pdfTeX. – Joseph Wright Sep 2 '15 at 5:55
• What's the purpose of doing that? If your file is Latin-9 encoded, just add \usepackage[latin9]{inputenc} to your preamble and LaTeX will do everything for you. – egreg Sep 2 '15 at 7:29

I can reproduce the issue, but only if the input file is UTF-8. If I save it as Latin-9, the definitions are performed without any complaint.

Why is the error issued when the file is encoded as UTF-8? Because in this case what you see as æ is actually two characters, as far as TeX is concerned (it doesn't understand multibyte encodings). Precisely, æ is seen as the pair of bytes <C3><A6>, so what TeX really sees is

\catcode<C3><A6>=\active


(note that <xy> is used just to represent a single character), which is a bad assignment and indeed will trigger the error message you see. This cannot happen if the file is encoded in a one byte encoding such as Latin-9.

In any case you shouldn't do things like that. Check the file encoding looking carefully to what your text editing program tells you and then add to the document preamble

\usepackage[latin9]{inputenc}


if the encoding really turns out to be Latin-9, or

\usepackage[utf8]{inputenc}
`

if instead it is UTF-8. Both declarations (when the option agrees with the encoding of the file) automatically do what you want to do manually.

I'm under the impression that you're using some template you got from the net or some friend. Don't trust them, particularly if they contain things you know absolutely nothing about.