On Tuesday 19 August 2008 13:16, Olivier Ripoll wrote: > This layout module is simply adding the definitions to the preamble. > Then, when you type in a formula \erf for instance, it will not be > interpreted by LyX (unless you use preview-latex stuff). But when > generating the pdf, they will be correctly interpreted as functions > (i.e. not in italic, and with a small space afterwards). > The advantage of having them in a layout module is that you do not have > to add them in a preamble by hand. Just add the module to the document > settings, as described in http://wiki.lyx.org/LyX/NewInLyX16#toc4 . > > Of course if someone has any ideas to provide more functionality, any > idea is welcome (that's the reason for posting the module). > > You can also have layouts that will create text styles or environments, > and those will appear in some menus automatically. That's how I have > implemented my "filename" and "code" text styles. See the > "logicalmkup.module" file for an example or my module below. > When I add my "customstyles.module" to the document settings, two > entries appear in the "Edit->Text Style" menu for using them. And when I > use them, LyX correctly change the text style accordingly. Here it is > for reference: > > ------------------------------------------------------------------- > #\DeclareLyXModule{Custom Styles} > #DescriptionBegin > #Custom character styles for code, filename. > #DescriptionEnd > > # Author : Olivier Ripoll (based on layout by Martin Vermeer) > > Format 7 > > InsetLayout CharStyle:Filename > LyxType charstyle > LabelString filename > LatexType command > LatexName filename > Font > Series Bold > Family Typewriter > EndFont > Preamble > \newcommand{\filename}[1]{\texttt{\textbf{#1}}} > EndPreamble > End > > > InsetLayout CharStyle:Code > LyxType charstyle > LabelString code > LatexType command > LatexName code > Font > Family Typewriter > EndFont > Preamble > \newcommand{\code}[1]{\texttt{#1}} > EndPreamble > End > ------------------------------------------------------------------- > > Note that I am pretty sure you can create shortcuts for accessing the > styles using what is described on the wiki: > http://wiki.lyx.org/Tips/KeyboardShortcutForCharacterStyles > > Best regards, > > Olivier
Ohhhhh, Maybe I do understand it. Is a layout module just a chunk of debugged LyX/LaTeX code that would normally go in a layout file, and gets included in the layout file by reference? So you could mix and match layout modules to get a more granular modularization, similar to #include in C? So is it a way to write once, use many times? Is it a way to use known-debugged LyX/LaTeX code? And is it a way for all of us to trade debugged and tested code without throwing in every silly little feature we put in our book? Thanks SteveT Steve Litt Recession Relief Package http://www.recession-relief.US