# Insert a TeX code into a math mode at LyX

If i'm at math mode at LyX and I want to add a TeX code, how can I do it?

This is possible?

i.e something like: \Ding{152} (or code that is more then a symbol) in math mode.

• \rightarrow + space will produce ;
• if you put \usepackage{stmaryrd} into the LaTeX Preamble then you can type a\leftrightarrowtriangle b. This results in or if "Tools > Preferences > Look&Feel > Instant Preview" is turned on then you will see after leaving math mode;
• furthermore, you can type \def\a{\rightarrow} and use \a later on. (Be aware that copying and pasting the \def-code will transform it into a \global\long\def. This is the same as using "Insert > Math > Macro".)
Overall, you can type probably every TeX code that can be used in math mode. You might find "View > View Source" helpful to check whether LyX understood correctly what you typed. (If you interrupt typing of \ding{123} it might come out as \ding\{123\}.)