Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No norwegian characters in LaTeX

I have translated a document from English to Norwegian in the LaTeX format, and while using norwegian special characters, I get an error using

\usepackage[utf8x]{inputenc}

to try and display the norwegian (scandinavian) special characters in PostScript/PDF/DVI format, saying

 Package utf8x Error: MalformedUTF-8sequence.

So while that didn't work, I tried out another possible solution:

\usepackage{ucs}
\usepackage[norsk]babel

And when I tried to save that in Emacs I get this message:

These default coding systems were tried to encode text
in the buffer `lol.tex':
(utf-8-unix (905 . 4194277) (916 . 4194245) (945 . 4194278) (950
. 4194277) (954 . 4194296) (990 . 4194277) (1010 . 4194277) (1013
. 4194278) (1051 . 4194277) (1078 . 4194296) (1105 . 4194296))
However, each of them encountered characters it couldn't encode:
utf-8-unix cannot encode these: \345 \305 \346 \345 \370 \345 \345 \346 \345 \370 ...

Thanks to Emacs I have the possibility to check out the properties of those characters and the first one tells me:

character: \345 (4194277, #o17777745, #x3fffe5)
preferred charset: eight-bit (Raw bytes 128-255)
code point: 0xE5
syntax: w    which means: word
buffer code: #xE5
file code: not encodable by coding system utf-8-unix
display: not encodable for terminal

Which doesn't tell me much. When I try to build this with texi2dvi --dvipdf filename.text I get a perfectly fine PDF, all without the special norwegian characters.

When I am about to save Emacs also ask me: "Select coding system (default raw-text):" And I type in utf-8 to choose its coding system. I have also tried to choose default raw-text to see if I get some different result. But nothing.

At last I tried \lstset{inputencoding=utf8x, extendedchars=\true} ... a code I came over while trying to google the solution to this problem. Which gives me this error: Undefined control sequence.

So basically, I have tried every encoding option I have been able to find and nothing works. I am desperately trying to make this work since the norwegian translation must be published before the deadline.

As an additional information I may add that I found out later on that I only had the en_US.UTF-8 in my locale, so I added nb_NO.UTF-8 and nb_NO.ISO-8859-15 and ran locale-gen + reboot without any changes.

I hope I provided enough information to get some assistance, the characters in question is æ ø å.

like image 599
bleakgadfly Avatar asked Apr 06 '10 21:04

bleakgadfly


People also ask

How do you put special characters in LaTeX?

LaTeX Spacial Characters If you simply want the character to be printed just as any other letter, include a \ in front of the character. For example, \$ will produce $ in your output. The exception to the rule is the \ itself because \\ has its own special meaning. A \ is produced by typing $\backslash$ in your file.

How do you put accents on letters in LaTeX?

In that case they can be created with the following command: \a' for an acute accent. \a` for a grave accent. \a= for a macron accent.

How do you add special characters to overleaf?

Adding symbols to your documentTo open the Symbol Palette, click the Ω button at the top of the editor. It's available in Source and Rich Text mode. The Symbol Palette will open at the bottom of the editor window.

How do you write XDOT in LaTeX?

Use $\dot x$ for the first derivative, \ddot x for the second, \dddot x for the third, \ddddot x for the fourth.


1 Answers

Apparently your emacs is having a hard time saving the file as UTF-8 (which doesn't make much sense since it should be able to represent all characters using that encoding). You should try using another editor with multiple encoding support to save the file as UTF-8.

While you're unable to save the file in UTF-8, LaTeX will not be able to correctly read it, unless you specify your current file encoding as inputenc package parameter. You may want to try to, for instance, save the file as-is in emacs but specifying \usepackage[latin1]{inputenc} which should do the trick if emacs is writing the file using something in the *iso-8859-** family.

like image 82
Miguel Ventura Avatar answered Sep 21 '22 00:09

Miguel Ventura