LyXImporting txt-Files with special characters

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
ion87
Posts: 4
Joined: Thu Jan 17, 2013 5:32 pm

Importing txt-Files with special characters

Post by ion87 »

Hi everybody,
I want to import a txt-file into LyX. I'm using the report (KOMA-script) class. Now I have sentences like "Zu messen sind Formänderungen an Körperteilen, z.B. Füßen" in a normal .txt-file. As you can see, it contains four special characters. By copy&paste the special characters display but the line breaks don't. So I tried to do it via File->Import->Simple text (I translated it from german so I hope it's the same in the english version).
Now line breaks display but all special characters like german umlauts and also the ° show up as question marks in rhombuses.
Also writing {\"A} in the txt-file instead of Ä does not help.
How can I import text with special characters and line breaks?
Thank you very much!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

hm_cavalcanti
Posts: 6
Joined: Fri Feb 10, 2012 3:12 pm

Re: Importing txt-Files with special characters

Post by hm_cavalcanti »

I've been trying to include .txt files in lyx by keeping accents and special characters, without success. But in the other hand, copy and paste seems to work. I don't know if that's your case, but you can always do a .lyx , copy and paste the german text into it and then use it as a child document (insert - file - child document).

I don't know if that may be a solution for your problems, but that's still not the solution for your question.

So, let's see if the people of the forum can give us some more advices. I am still trying to find a solution.
ion87
Posts: 4
Joined: Thu Jan 17, 2013 5:32 pm

Re: Importing txt-Files with special characters

Post by ion87 »

hm_cavalcanti, thanks for your answer. I hope I understood you correctly, but line breaks are not copied with the text in your solution, right?
Anyway, I solved the problem by myself otherwise. I replaced all accents/special characters/etc with distinct strings like ä->aE, °->[dg] and replaced them again after importing.
The only disadvantage is that you have to know before which characters won't work.
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Importing txt-Files with special characters

Post by scottkosty »

ion87 wrote:hm_cavalcanti, thanks for your answer. I hope I understood you correctly, but line breaks are not copied with the text in your solution, right?
Anyway, I solved the problem by myself otherwise. I replaced all accents/special characters/etc with distinct strings like ä->aE, °->[dg] and replaced them again after importing.
The only disadvantage is that you have to know before which characters won't work.
Hi ion87 and hm_cavalcanti,

Can you please report this bug on the LyX bug tracker? This way it will get fixed for future versions. It is easy to register and post. Go here: http://www.lyx.org/trac
Under component, please choose "tex2lyx".
I believe the main developer of the tex2lyx component is German(-speaking at least) so he should know what's going on and what to do about it.

Also, which versions of LyX are you using?

Thanks,

Scott
ion87
Posts: 4
Joined: Thu Jan 17, 2013 5:32 pm

Importing txt-Files with special characters

Post by ion87 »

Hi,
I reported the bug and the answer was the following:
This is an English bugtracker, please post in English.

Your problem is that the plain text file apparently uses an encoding which
is not detected by LyX. I think the file needs to be encoded in utf8.
A bit weird, because the whole page appeared in german but ok^^

scottkosty, if you have contact maybe you can tell them that if the prompt is in german it is not obvious to have to post in english. ;) Don't know if it's possibile to answer that bug report answer mail.
Post Reply