开发者

No norwegian characters in LaTeX

开发者 https://www.devze.com 2022-12-25 16:31 出处:网络
I have translated a document from English to Norwegian in the LaTeX format, and while using norwegian special characters, I get an error using

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 u开发者_如何学Pythontf-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 æ ø å.


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.


I solved this error by setting the coding system for saving file:

C-x C-m f utf-8-unix
0

精彩评论

暂无评论...
验证码 换一张
取 消