On Friday 01 June 2007 13:34, Jeremy C. Reed wrote: > I have a 180+ page book with many (probably over 500) character > formattings. > > I want to have styles defined for: > > filenames > command names > command line options > configuration options > command output (I just use lyxcode for that) > command input > etc.. > > Currently I am just using stuff like typewriter, italics (or emphasis), > bold, ... but whenever I want to try something different I will have to > change hundreds of things. So I want to be able to identify something as a > "filename" or "command" for example.
Hi Jeremy, You're right that things like filenames and command names should never be formatted with generic stuff like typewriter, emphesis and bold. You're right that the correct way is to use character styles. I'm going to tell you the generics of character styles first. I defined something like your command line options character style. It's typewriter font representing any kind of source code. I called it CharCode. Here's the LyX portion of the character style: CharStyle Charcode Font Family Typewriter EndFont LatexName charcode LatexType Command End The stuff between Font and EndFont determines how it looks from within LyX. You'll notice that the LatexType is Command. That's important -- character styles must have a LatexType of Command, never of Environment or anything else (as far as I know). The LatexName is charcode. That's the LaTeX command that gets run, using the text to which the character style is applied as an argument. The following is the LaTeX definition of charcode: % ### Character style -- monotype for code in paragraph \newcommand{\charcode}[1]{\texttt{#1}}% In other words, you make a LaTeX command to format the output the way you want it, and then you make a LyX CharStyle to format it within the LyX editor and also to call the command. The only trouble I see your having is if you absolutely must have all the different character styles look differently, which I believe usually isn't the case in technical books. IIRC Sams Publishing told me to use bold monofont for text I typed at the command prompt, and regular monofont for what the program output. IIRC Sams told me to use regular monofont to represent source code and configuration files. However, you're doing it right by making different character styles for all of these things, because if you ever DO want to differentiate them, it's as simple as changing the LaTeX command. > Also email from Steve L at > http://wiki.lyx.org/Tips/KeyboardShortcutForCharacterStyles says: > > - Insert > - Character Style > - Pick which character style > > But I don't see that anywhere. (Not on my Insert menu.) Can someone > explain this? I can. LyX is smart enough that it doesn't offer that option in the Insert menu until you've created at least one character style. The minute you successfully create a character style, "Character Style" will appear as an option on your Insert submenu. If I were in your shoes, I'd create a tiny LyX test document and a tiny layout file, and experiment. Hope this helps. SteveT Steve Litt Author: Universal Troubleshooting Process books and courseware http://www.troubleshooters.com/