[Tex/LaTex] In LyX, is there a way to toggle the display of TeX code in math expressions

editorslyxmath-mode

Is there a way to toggle the display of math expressions in LyX between the default, which makes an attempt at replacing TeX code with easy to read symbols (but is short of actual rendering), and the underlying TeX code?

For example, I'd like the be able to toggle between this

Default mode for displaying math in LyX

and this

Desired TeX mode for displaying math in LyX

Best Answer

There is not a built-in toggle that I know of. But you can create one yourself by using a command sequence. First place your cursor in front of the math expression that you want to convert to LaTeX. Press alt+x to go to the command buffer (or go to view>toolbars>command buffer and then click on it at the bottom). Enter the following command and press return:

command-sequence char-forward; line-end-select ; cut; char-backward; paste; char-delete-forward`

This works for me. Does it work for you? If it works, make a shortcut for it. And then when you want to go back, just select the LaTeX code and do Ctrl + m.

Here are some additional suggestions:

  • go to View > Code Preview Pane to get a look at the LaTeX code around where your cursor is.

  • if you put your cursor inside the math box, copy (but don't copy the entire math box), go outside of math, and paste, it will paste the LaTeX code. To turn that LaTeX code back into the math symbols, highlight it, and press Ctrl + m.