Rich Shepard wrote:
On Thu, 11 Sep 2008, Steve Litt wrote:
It seems to me that from the dawn of time (2001 for me), getting LyX to
work with a layout file anywhere but /home/myuid/.lyx/layouts was
extremely difficult, with no reproducible procedure. You'd create a
symlink from where the file really existed to /home/myuid/.lyx/layouts,
and then after about an hour of fiddling around, the document class
would
somehow magically show up in your list.
Steve,
Most of my layouts are in /usr/local/share/lyx/layouts/, but a few are in
~/.lyx/layouts. I've not had any issues using them from either place
regardless of LyX version.
I have no LyX layouts with an .src extension.
I think part of what Steve wants, which other people have also wanted,
is to be able to keep the layout file with the document: to have a
somewhat closer association between them than is possible when the
layouts are in some common directory. I can see reasons to want this,
especially if, as Steve does, you construct a lot of different layouts
for different projects.
The layouts module in 1.6 will alleviate this problem somewhat. In most
cases, I suspect, the reason people will have lots of layouts is because
they have various customizations to some base class that they want to
apply in different combinations for different projects. This is
precisely what layout modules are for.
That said, sometimes you just want to add some layout information to one
document.
******
WARNING: Read what follows at your own risk!
******
LyX 1.6 includes a facility that can also be used for this purpose. I
call it "local layout". If you look at the 1.6 Customization.lyx file,
you'll find this in the header:
\begin_local_layout
Format 7
InsetLayout CharStyle:MenuItem
LyxType charstyle
LabelString menu
LatexType command
LatexName menuitem
Font
Family Sans
EndFont
Preamble
\newcommand*{\menuitem}[1]{{\sffamily #1}}
EndPreamble
End
\end_local_layout
As you'll see, this is just layout information, embedded directly into
the document. LyX reads it, if it's there, and uses it. I added this
precisely because I wanted this charstyle in Customization.lyx, but I
didn't really see the point of writing a special module that would ship
with LyX and then show up in everyone's module list. I just wanted it
for this one document. So there it is.
There is, as yet, no UI for this, because it is really quite
experimental and may prove dangerous. What happens if you enter invalid
layout information? Well, LyX will react in a reasonable way, but you'd
better save your document first. Live layout editing is not really
recommended (though it is now possible for layouts, via the
layout-reload LFUN, and changes to modules will show up whenever you
make changes to Document>Settings). But you just can open your LyX file
in an editor and add this in by hand, if you want. Debug it first!
(Create a trivial test.module, and use that for experiments.) I intend
to use it myself a fair bit, and if I don't have any serious problems,
it'll be a trivial matter to add a simple UI, like the one for preamble.
With appropriate warnings.
Personally, I don't want to see this overused. Part of the point of the
way LyX uses layouts (and soon, modules) is to promote reusability.
Local layout is not reusable except by cut-and-paste, and that's not
really what one means by "reusability".
Richard