Den 20. mars 2018 21:43, skrev Baris Erkus:

Ok. I was wondering if it was possible to do it from within LyX, without editing the LyX file. I guess, it is not possible.


It is possible to do within LyX. Example:
1. Open a document containing math you want to change. (Or create a sample document)

In my case:
    a+b
a + --- + b
    c+d

equivalent to ( a + (a+b)/(c+d) + b ), if this mail get misformatted.

2. Mark the *contents* of the formula. Make sure you mark only the contents, *not* the entire formula inset. I.e. put the cursor inside the math, then use shift+arrow keys to mark. Do not move the cursor outside the math inset, because then the whole inset will be marked. You can mark part of the math, or all of the math, but *not* the inset itself.

3. Press ctrl+c to copy the math

4. Create an empty TeX box.  "Insert->TeX Code" or use the TeX button (First, make sure the cursor is in a standard paragraph, *not* still inside some math inset.)

5. Put the cursor inside the red TeX box. Press ctrl+v to paste. You should now see the familiar TeX code for your math. If this doesn't work, chances are you marked the inset itself and not only the contents. If you have problems, mark a smaller part of the math and copy+paste again.

6. Edit the formula inside the TeX box. You may change \frac to \dfrac, as originally suggested.

7. When you are done editing, mark all the math inside the TeX box. (Marking the entire box works too, in this case). Press ctrl+c to copy

8. Put the cursor inside some math inset, or create an empty math inset. Press ctrl+v to paste. The TeX formula is now pasted as a LyX formula, and you have the changes you wanted.

9. Tidy up, perhaps remove the original math that you wanted to replace.

Many steps, but not hard to do. With some practice, you can use ctrl+x to cut instead of ctrl+c to copy. That way, no need to clean up later.  It is easier to make mistakes with ctrl+x, but "undo" can usually fix such problems.

Helge Hafting

Reply via email to