How to Copy an Equation from MathType to Lyx

Recently, I've been using Latex with Lyx instead of Microsoft Word to format my dissertation and research papers. I find managing the formatting to be much easier, and the layout is guaranteed to be consistent throughout the document. However, much of what I have done previously was in Word, and I often want to transfer math equations I wrote previously in MathType over to Lyx rather than rewriting them from scratch.

While the method is somewhat of a nuisance because of the terrible way MathType handles Latex, it is certainly possible, and can often be faster than rewriting an equation.

  1. In Microsoft Word, select the MathType equation you want to copy over to Lyx.

    original equation

  2. Click the MathType tab at the top of Word. Click Toggle Tex. This will convert the MathType equation image into Latex code.
    ToggleTex location

  3. Copy the Latex code. In my example, I get:

    \[\hat{F}(u,v)=\left[ \frac{{{H}^{*}}(u,v)}{{{\left| H(u,v) \right|}^{2}}+{1}/{\text{SNR}}\;} \right]G(u,v)\]

  4. Insert a new math formula field in Lyx. Here is the tricky part. You cannot simply paste the Latex code you have copied directly into this formula field. Otherwise, it will show up as text, not a formatted equation, like so:

    wrong equation

  5. MathType adds the \[ characters to the beginning and the \] characters to the end of the Latex code. DELETE these characters before pasting into Lyx. (For multi-line equations, MathType also may surround the Latex code with \begin{align} and \end{align}. These must be deleted too to paste into Lyx properly). In my example, I end up with:

    \hat{F}(u,v)=\left[ \frac{{{H}^{*}}(u,v)}{{{\left| H(u,v) \right|}^{2}}+{1}/{\text{SNR}}\;} \right]G(u,v)

  6. With the extra two characters removed from the beginning and end of the Latex code, the code will paste properly into Lyx:

    messy equation

  7. However, as you can see in the example, MathType inserts extra braces into the Latex code, more than are necessary. These must be removed manually, but at least the majority of the equation formatting is preserved and recognized by Lyx's formula editor. Once removed, you are done!

    pretty equation

This method was tested using MathType 6.5 and Lyx 1.6.8

10 comments

  • Roger Day says:

    Thanks!!! Very useful.

    1
  • mark3000 says:

    Thanks for the help :)

    2
  • shahir says:

    Thanks man

    3
  • Resh says:

    Muchísimas gracias.

    Thank you very much!

    4
  • bahmanpars says:

    thanks, it was very useful. :)

    5
  • bahmanpars says:

    This is better

    open MathType >>>> choice preferences from menu >>>> select cut and copy preferences >>>> just select ( MathML or TaX )

    then select Inline equation at Format in the menu.

    It's ready for transfer equations of word to Lyx or LaTex.

    Open equation from word to MathType then copy equation and paste to Lyx.

    In Lyx select equation and click (Insert math).

    :)

    6
  • Rodrigo says:

    And what happen if the text it's too long?

    I found a better way, but if I say something about that many people will be angry with me, because it's better fight a little with this stuff....but....I can give a clue: be "Libre". Bye

    7
  • Paul says:

    What "bahmanpars" it Says, work very good, but if you have MathType with license or before trial over.

    8
  • Ashish says:

    thanks for the help really worked

    9
  • Rodolfo Oviedo says:

    You convert all equations to TeX at once:

    • select the whole document (e.g. pressing Ctr+A)
    • Toggle TeX

    If you want to convert one by one the following is better:

    • Open MathType. Menu > Preferences > Cut and copy preferences > MathLM or TeX.

    Then, for each equation:

    • Open the target MathType equation. Inside it, press Ctr A , Ctr +, Ctr C (keep the Ctr key pressed while typing A,  + and C).

    • In LyX, paste in text environment (not equation environment).

    • Remove [ from the beginning and ] from the end of the pasted text. If there are aligned equations, remove \begin{align} and \end{align} as well.

    • Select what is left from what was copied and press Ctr+M if you want an inline equation or Ctr+Shift+M if you want a displayed equation.

    • Remove the curly brackets { }. Not to remove anything else, position the cursor just after { and delete it with the backspace key. This removes the closing one as well.

    Notice that you can see the cursor just to the left of { and after pressing the left arrow key (<-) you may still be to the right of {, which means that you were not just close to {. To make sure you are, do one of the following:

    • Click the opening curly bracket.

    • Position the cursor to the left of {. Then, use the right arrow key to move just after {.

    10

Comments are closed.