On Sunday 15 February 2009 08:20:00 pm Justin Crites wrote:
> Greetings,
>
> I am new to LyX and love the concept. I was hoping to be advised about the
> correct way to typeset certain document features.
>
> I am using it for some documents that frequently require sections of
> monospace text. For example, I might have a "program listing" block and
> then discussion surrounding it, referencing the names of variables or
> expressions. I think of the variables or expression snippets semantically
> as "code fragments".
>
> I have been using the "Text style" feature to change the "Family" to
> Typewriter, which achieves the desired result, but not in a very LyX-like
> manner (specifically, deriving style from semantics, rather than
> controlling style directly).
>
> How can I include semantic "code fragments" in my document which are styled
> monospace?
>
> I am using 1.5.2.
>
> Thanks for your help!
Hi Justin,
If I understand correctly, you want to apply a style to specific words that
appear in source code.
If I undestand correctly, use a character style as shown in the Charcode
character style that follows:
Preamble
% ### Character style -- monotype for code in paragraph
\newcommand{\charcode}[1]{\texttt{#1}}%
EndPreamble
# %%% Typewriter font inside paragraphs
CharStyle Charcode
Font
Family Typewriter
EndFont
LatexName charcode
LatexType Command
End
Then, you highlight the word(s) you want to appear as variables or whatever,
and apply the Charcode character style.
HTH
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US