LaTeX forum ⇒ LyXtex2lyx drops underscores and circumflex accents Topic is solved

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
dirkd
Posts: 2
Joined: Sun Dec 06, 2015 12:31 pm

tex2lyx drops underscores and circumflex accents

Postby dirkd » Sun Dec 06, 2015 12:46 pm

I tried to import an old tex-file into LyX. Generally, the import went well but all occurences of underscores (_) and circumflex accents (^) were simply removed. And there are a lot of them. When LyX was able to determine that math-mode was active it interpreted the accents well (as sub- and superscripts), but when it thought it was reading plain text, it just dropped them.

Here's a short excerpt as an example:

  1. Twee {\trm termen} $a_m$ en $a_n$ $(m>n)$ in een MR liggen $m-n$ posities uit elkaar. Hieruit volgt dat
  2. \beq a_m=a_n\cdot r^{m-n}. \eeq


The a_m symbol between dollar-tags is imported correctly (with a subscript), the a_m between \beq and \eeq tags is imported simply as 'am', while I would want it to be imported literally as 'a_m'.

Any help would be appreciated.

Tags:

scottkosty
Site Moderator
Posts: 531
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Sun Dec 06, 2015 7:25 pm

I would suggest you make a minimal example and file a bug report at http://www.lyx.org/trac. In the bug report, please select the component "tex2lyx".

scottkosty
Site Moderator
Posts: 531
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Sun Dec 06, 2015 11:12 pm


User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Dec 07, 2015 1:18 am

Hi Dirk,

welcome to the forum!

I assume \beq and \eeq are tags defined by you. When I would naively look at that code, I would see that a_m=a_n\cdot r^{m-n}. is not in math mode. That's why the underscore and the circumflex would be illegal there, thus they are dropped.

A clever assumption would be that you defined \beq and \eeq as abbreviation for math mode, such as for \begin{equation} and \end\begin{equation}. I guess tex2lyx does not see that. This shortcut syntax is bad anyway, it hides the original meaning and changes an environment syntax to pairs of commands.

An easy way would be automatic search & replace of those shortcuts via any editor.

Stefan
Site admin

dirkd
Posts: 2
Joined: Sun Dec 06, 2015 12:31 pm

Postby dirkd » Mon Dec 07, 2015 10:14 am

Hi Stefan,

thanks for your help. In the meantime I thought about your search-and-replace solution myself, and since there were only four troublesome definitions that tex2lyx didn't like, I quickly had a working lyx-version of my tex-file.

I am convinced now that this behaviour of tex2lyx is fully by design, since an underscore in plain text seems to be handled completely different from an underscore in math-mode by LyX. Fixing the underscores AFTER importing in LyX with search-and-replace seems impossible.

So consider this question as solved. Thanks again, I learned yet a bit more about LyX.


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 7 guests