>>From: Steve Litt <[EMAIL PROTECTED]>
>>To: [email protected]
>>Subject: I need a character style example
>>Date: Wed, 7 Feb 2007 12:11:34 -0500
>>X-ELNK-Trace: 
2958f12584ef992474bf435c0eb9d478e09d0e0b1ffcb0a6c42a1d02fa3935f4591ed1b9d3f0f590
350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c
>>
>>Hi all,
>>
>>Today I just used my first character style (LyX 1.4.2), and it didn't go 
>>well. 
>>I simply wanted a way to define text within a paragraph (not the whole 
>>paragraph, just some text within it) as code. I wanted it typewriter font 
>>both in LyX and in the output. So I did this:
>>
>>Preamble
>>\newenvironment{charcode}{\ttfamily}{\rmfamily}
>>EndPreamble

Why \newenvironment ?
\newcommand will work fine, here is mine which provides the same style

Format 2

CharStyle Identifier
        LatexType             Command
        LatexName             mycode
        LabelFont
          Family              Typewriter
          Color               blue
        EndFont
        Preamble
                \providecommand{\mycode}[1]{\texttt{#1}}
        EndPreamble
End

I had to use \providecommand instead of \newcommand, for some reason
that I don not recollect.

HTH

-- 
Jean-Pierre

Reply via email to