# Lyx customized view of command

I have a command definition in my LaTeX preamble:

\newcommand*{\code}[1]{\texttt{#1}}


But the usage of this command appears as an ERT e.g. \code{select}. I would like this to appear as select that is, italics. How to do this?

-
what is an ERT? And exactly what do you want to do? Will changing \texttt with \textit solve your problem? –  Juan A. Navarro Oct 31 '10 at 8:12
@Juan: ERT is Lyxspeak for Evil Red Text, meaning Lyx's pretensions to be a graphical editor are compromised. –  Charles Stewart Oct 31 '10 at 9:54

I was able to extract my answer from Rob's another article here: Close your lyx file from within lyx editor. Put the following near the top of your lyx file after \end_modules using a text editor. Reopen the lyx file using the lyx editor. Then you can customize a part of your text by: Select text > Right Click > Text Styles > Charstyle:code.

 \begin_local_layout
Format 7
InsetLayout    CharStyle:Code
LyxType               charstyle
LabelString           code
LatexType             command
LatexName             code
Font
Family              Sans
Color               Green
EndFont
Preamble
\newcommand*{\code}[1]{\texttt{#1}}
EndPreamble
End
\end_local_layout


To use the same layout for a different document, use File > New from Template.

-