## LaTeX forum ⇒ LyX ⇒ LyX adds "junk" code in LyX to LaTeX conversion

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
kmkieva
Posts: 1
Joined: Tue Feb 20, 2018 11:07 am

### LyX adds "junk" code in LyX to LaTeX conversion

As a professional indexer, to write an index in LaTeX, I first open the .tex file in Word, create the embedded index, convert the Word file to LyX and then export to LaTeX (plain). This is the only method I've found that retains the embedded index.

My problem is with the LyX to LaTeX conversion. LyX automatically adds a preamble, which I don't want. Ok, easy enough to delete it. But it also replaces all backslash characters with "\textbackslash" and it inserts "\medskip{}" between paragraphs and extraneous \{ and \} characters within existing LaTeX code. Where the author has a comment (%), the converted file has \%. When indexing a book, it becomes impossible to delete all these "extras" with any confidence that I've gotten every instance. I'm left with having to copy/paste the \index code from the "bad" .tex file to a clean copy. Not the most efficient way to accomplish the task.

Does anyone know why LyX adds all the "junk" and what might solve the problem?

kaiserkarl13
Posts: 623
Joined: Tue Mar 25, 2008 5:02 pm
You have hit on the primary reason that I hate LyX! There are ways to disable that behavior, but it takes some searching if I recall correctly (and some things simply can't be disabled).

What exactly are you using Word to do? It's very possible to do make an index using LaTeX (see the makeidx package and associated makeindex program. It's almost certain that involving Word in the loop is an unnecessary step.