Re: Sure-fire LyX layout files

2008-09-12 Thread G. Milde
On 11.09.08, rgheck wrote:
 Rich Shepard wrote:
 On Thu, 11 Sep 2008, Steve Litt wrote:

 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
...
Yes, I want to have additional styles for personal use but at the
same time to keep the option to send my document to a colleague
without with just the LyX standard layouts.

 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.

I am looking forward to this much cleaner way of adding my styles to
the standard classes (hopefully a stable 1.6 is out soon).

 That said, sometimes you just want to add some layout information to one  
 document.
or, as stated above, to ship your private extensions with the LyX file.

 **
 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. 
 ..., this is just layout information, embedded directly into  
 the document. LyX reads it, if it's there, and uses it. 
 There is, as yet, no UI for this, because it is really quite  
 experimental and may prove dangerous. 

How about an embed button for selected modules?

This way it would be easy to create self-contained lyx documents with
private styles. You can create and test a module in ~/.lyx/layouts/ and
if you want it in a document for others to use, simply embed it. (It will
still show up in *your* modules list but not in everyones.)

 it'll be a trivial matter to add a simple UI, like the one for preamble.  
 With appropriate warnings.
Maybe this is not even needed with an embed button for modules. But
still a possible supplement for one-off layouts.

 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.

But there is also the problem with compatibility. My private reusable
modules can (currently) not be used in files that should work everywhere.

Maybe there could be an extract-module tool, that can extract embedded
modules to ~/.lyx/layouts/

Günter



Re: Sure-fire LyX layout files

2008-09-12 Thread rgheck

G. Milde wrote:
LyX 1.6 includes a facility that can also be used for this purpose. I  
call it local layout. 
..., this is just layout information, embedded directly into  
the document. LyX reads it, if it's there, and uses it. 
There is, as yet, no UI for this, because it is really quite  
experimental and may prove dangerous. 



How about an embed button for selected modules?

  
I think a general embedding solution will be a topic at the next LyX 
developer's meeting. A general solution is preferable to anything piecemeal.


rh



Re: Sure-fire LyX layout files

2008-09-12 Thread G. Milde
On 11.09.08, rgheck wrote:
 Rich Shepard wrote:
 On Thu, 11 Sep 2008, Steve Litt wrote:

 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
...
Yes, I want to have additional styles for personal use but at the
same time to keep the option to send my document to a colleague
without with just the LyX standard layouts.

 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.

I am looking forward to this much cleaner way of adding my styles to
the standard classes (hopefully a stable 1.6 is out soon).

 That said, sometimes you just want to add some layout information to one  
 document.
or, as stated above, to ship your private extensions with the LyX file.

 **
 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. 
 ..., this is just layout information, embedded directly into  
 the document. LyX reads it, if it's there, and uses it. 
 There is, as yet, no UI for this, because it is really quite  
 experimental and may prove dangerous. 

How about an embed button for selected modules?

This way it would be easy to create self-contained lyx documents with
private styles. You can create and test a module in ~/.lyx/layouts/ and
if you want it in a document for others to use, simply embed it. (It will
still show up in *your* modules list but not in everyones.)

 it'll be a trivial matter to add a simple UI, like the one for preamble.  
 With appropriate warnings.
Maybe this is not even needed with an embed button for modules. But
still a possible supplement for one-off layouts.

 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.

But there is also the problem with compatibility. My private reusable
modules can (currently) not be used in files that should work everywhere.

Maybe there could be an extract-module tool, that can extract embedded
modules to ~/.lyx/layouts/

Günter



Re: Sure-fire LyX layout files

2008-09-12 Thread rgheck

G. Milde wrote:
LyX 1.6 includes a facility that can also be used for this purpose. I  
call it local layout. 
..., this is just layout information, embedded directly into  
the document. LyX reads it, if it's there, and uses it. 
There is, as yet, no UI for this, because it is really quite  
experimental and may prove dangerous. 



How about an embed button for selected modules?

  
I think a general embedding solution will be a topic at the next LyX 
developer's meeting. A general solution is preferable to anything piecemeal.


rh



Re: Sure-fire LyX layout files

2008-09-12 Thread G. Milde
On 11.09.08, rgheck wrote:
> Rich Shepard wrote:
>> On Thu, 11 Sep 2008, Steve Litt wrote:

> 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
...
Yes, I want to have additional styles for personal use but at the
same time to keep the option to send my document to a colleague
without with just the LyX standard layouts.

> 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.

I am looking forward to this much cleaner way of adding my styles to
the standard classes (hopefully a stable 1.6 is out soon).

> That said, sometimes you just want to add some layout information to one  
> document.
or, as stated above, to ship your private extensions with the LyX file.

> **
> 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". 
> ..., this is just layout information, embedded directly into  
> the document. LyX reads it, if it's there, and uses it. 
> There is, as yet, no UI for this, because it is really quite  
> experimental and may prove dangerous. 

How about an "embed" button for selected modules?

This way it would be easy to create self-contained lyx documents with
private styles. You can create and test a module in ~/.lyx/layouts/ and
if you want it in a document for others to use, simply embed it. (It will
still show up in *your* modules list but not in everyones.)

> it'll be a trivial matter to add a simple UI, like the one for preamble.  
> With appropriate warnings.
Maybe this is not even needed with an "embed" button for modules. But
still a possible supplement for one-off layouts.

> 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".

But there is also the problem with compatibility. My private reusable
modules can (currently) not be used in files that should work everywhere.

Maybe there could be an "extract-module" tool, that can extract embedded
modules to ~/.lyx/layouts/

Günter



Re: Sure-fire LyX layout files

2008-09-12 Thread rgheck

G. Milde wrote:
LyX 1.6 includes a facility that can also be used for this purpose. I  
call it "local layout". 
..., this is just layout information, embedded directly into  
the document. LyX reads it, if it's there, and uses it. 
There is, as yet, no UI for this, because it is really quite  
experimental and may prove dangerous. 



How about an "embed" button for selected modules?

  
I think a general embedding solution will be a topic at the next LyX 
developer's meeting. A general solution is preferable to anything piecemeal.


rh



Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
Hi all,

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.

It got even worse in 1.5.x when they attempted to recognize layout files in 
the current directory. You could have duplicate copies with all sorts of 
environment-munching disasters, or none, or who knows what.

Yesterday I got a layout file to work the first time. What a refreshing 
difference. Here's what I did:

cd /home/myuid/mybook
Decided my document class should be called infacebook
Created a small layout file as infacebook_layout.src
ln -s /home/myuid/mybook/infacebook_layout.src 
/home/myuid/.lyx/layouts/infacebook.layout
lyx/reconfigure
lyx mybook.lyx
switch document class to infacebook, which is now listed.

The key here is that the actual physical file (as opposed to the symlink name) 
does not end with .layout, so LyX doesn't try to use it as a layout file. LyX 
relies only on the symlink copy in /home/myuid/.lyx/layouts.

HTH

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread Rich Shepard

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.

  Obviously, our milages vary.

Rich

--
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 503-667-8863


Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 12:02:05 pm 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.

Yes, if you keep all your layout files in those two places, there will never 
be any problem. My issue is I like to keep my layout source code in the same 
directory as my book source code. Pre 1.5.x, LyX wouldn't look for layout 
files anywhere but /usr/local/share/lyx/layouts or ~/.lyx/layouts, so you'd 
need to create a symlink in a place where LyX looked, namely ~/.lyx/layouts.

However, starting with 1.5.x, LyX looked for layout files in the current 
directory, but sometimes finds them and sometimes doesn't, so if you don't 
have the symlink you might or might not have your document class available if 
you only put the layout file in the current directory. But if you symlink it, 
then you might get duplicates, one in the current directory and one in 
~/.lyx/layouts, in which case all sorts of bad things happen.


I have no LyX layouts with an .src extension.

That's the whole point -- the .src is my deliberate sabotage so that 
incarnation of the file is NOT recognized as a layout. Then the symlink will 
be the only copy seen, and will fire up right away.


Obviously, our milages vary.

The main place our mileages vary is in preferences. You prefer to keep your 
layout source code in ~/.lyx/layouts, and I prefer to keep it in the 
directory with the book. If your preferences shifted to mine, then you'd need 
to do my workaround to get things to consistently work.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread rgheck

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 DocumentSettings). 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



Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 11:51:59 am Steve Litt wrote:
 Hi all,

 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.

 It got even worse in 1.5.x when they attempted to recognize layout files in
 the current directory. You could have duplicate copies with all sorts of
 environment-munching disasters, or none, or who knows what.

 Yesterday I got a layout file to work the first time. What a refreshing
 difference. Here's what I did:

 cd /home/myuid/mybook
 Decided my document class should be called infacebook
 Created a small layout file as infacebook_layout.src
 ln -s /home/myuid/mybook/infacebook_layout.src
 /home/myuid/.lyx/layouts/infacebook.layout lyx/reconfigure
 lyx mybook.lyx
 switch document class to infacebook, which is now listed.

 The key here is that the actual physical file (as opposed to the symlink
 name) does not end with .layout, so LyX doesn't try to use it as a layout
 file. LyX relies only on the symlink copy in /home/myuid/.lyx/layouts.

 HTH

 SteveT

I should add a couple things:

Before opening mybook.lyx with infacebook document class, you should make a 
brand new document, which can be empty, and set that empty document to 
infacebook document class. If that doesn't work, suspect your layout file has 
errors and fix them.

If necessary, start with this trivial known good layout file to eliminate the 
possibility of your layout source being bad:


#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{trivialbook}

Input stdclass.inc
#Format 2
Input book.layout

Preamble
EndPreamble

Style TrivItemize
CopyStyle Itemize
End


Of course, you must call this file ./trivialbook_layout.src and follow all the 
symlinking/reconfigure steps in order for it to work. The point is, there's 
now a way to quickly put your layout source code into any directory you want, 
and have it quickly recognized by LyX.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
Hi all,

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.

It got even worse in 1.5.x when they attempted to recognize layout files in 
the current directory. You could have duplicate copies with all sorts of 
environment-munching disasters, or none, or who knows what.

Yesterday I got a layout file to work the first time. What a refreshing 
difference. Here's what I did:

cd /home/myuid/mybook
Decided my document class should be called infacebook
Created a small layout file as infacebook_layout.src
ln -s /home/myuid/mybook/infacebook_layout.src 
/home/myuid/.lyx/layouts/infacebook.layout
lyx/reconfigure
lyx mybook.lyx
switch document class to infacebook, which is now listed.

The key here is that the actual physical file (as opposed to the symlink name) 
does not end with .layout, so LyX doesn't try to use it as a layout file. LyX 
relies only on the symlink copy in /home/myuid/.lyx/layouts.

HTH

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread Rich Shepard

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.

  Obviously, our milages vary.

Rich

--
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 503-667-8863


Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 12:02:05 pm 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.

Yes, if you keep all your layout files in those two places, there will never 
be any problem. My issue is I like to keep my layout source code in the same 
directory as my book source code. Pre 1.5.x, LyX wouldn't look for layout 
files anywhere but /usr/local/share/lyx/layouts or ~/.lyx/layouts, so you'd 
need to create a symlink in a place where LyX looked, namely ~/.lyx/layouts.

However, starting with 1.5.x, LyX looked for layout files in the current 
directory, but sometimes finds them and sometimes doesn't, so if you don't 
have the symlink you might or might not have your document class available if 
you only put the layout file in the current directory. But if you symlink it, 
then you might get duplicates, one in the current directory and one in 
~/.lyx/layouts, in which case all sorts of bad things happen.


I have no LyX layouts with an .src extension.

That's the whole point -- the .src is my deliberate sabotage so that 
incarnation of the file is NOT recognized as a layout. Then the symlink will 
be the only copy seen, and will fire up right away.


Obviously, our milages vary.

The main place our mileages vary is in preferences. You prefer to keep your 
layout source code in ~/.lyx/layouts, and I prefer to keep it in the 
directory with the book. If your preferences shifted to mine, then you'd need 
to do my workaround to get things to consistently work.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread rgheck

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 DocumentSettings). 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



Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 11:51:59 am Steve Litt wrote:
 Hi all,

 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.

 It got even worse in 1.5.x when they attempted to recognize layout files in
 the current directory. You could have duplicate copies with all sorts of
 environment-munching disasters, or none, or who knows what.

 Yesterday I got a layout file to work the first time. What a refreshing
 difference. Here's what I did:

 cd /home/myuid/mybook
 Decided my document class should be called infacebook
 Created a small layout file as infacebook_layout.src
 ln -s /home/myuid/mybook/infacebook_layout.src
 /home/myuid/.lyx/layouts/infacebook.layout lyx/reconfigure
 lyx mybook.lyx
 switch document class to infacebook, which is now listed.

 The key here is that the actual physical file (as opposed to the symlink
 name) does not end with .layout, so LyX doesn't try to use it as a layout
 file. LyX relies only on the symlink copy in /home/myuid/.lyx/layouts.

 HTH

 SteveT

I should add a couple things:

Before opening mybook.lyx with infacebook document class, you should make a 
brand new document, which can be empty, and set that empty document to 
infacebook document class. If that doesn't work, suspect your layout file has 
errors and fix them.

If necessary, start with this trivial known good layout file to eliminate the 
possibility of your layout source being bad:


#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{trivialbook}

Input stdclass.inc
#Format 2
Input book.layout

Preamble
EndPreamble

Style TrivItemize
CopyStyle Itemize
End


Of course, you must call this file ./trivialbook_layout.src and follow all the 
symlinking/reconfigure steps in order for it to work. The point is, there's 
now a way to quickly put your layout source code into any directory you want, 
and have it quickly recognized by LyX.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
Hi all,

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.

It got even worse in 1.5.x when they attempted to recognize layout files in 
the current directory. You could have duplicate copies with all sorts of 
environment-munching disasters, or none, or who knows what.

Yesterday I got a layout file to work the first time. What a refreshing 
difference. Here's what I did:

cd /home/myuid/mybook
Decided my document class should be called infacebook
Created a small layout file as infacebook_layout.src
ln -s /home/myuid/mybook/infacebook_layout.src 
/home/myuid/.lyx/layouts/infacebook.layout
lyx/reconfigure
lyx mybook.lyx
switch document class to infacebook, which is now listed.

The key here is that the actual physical file (as opposed to the symlink name) 
does not end with .layout, so LyX doesn't try to use it as a layout file. LyX 
relies only on the symlink copy in /home/myuid/.lyx/layouts.

HTH

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread Rich Shepard

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.

  Obviously, our milages vary.

Rich

--
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
 Voice: 503-667-4517  Fax: 503-667-8863


Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 12:02:05 pm 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.

Yes, if you keep all your layout files in those two places, there will never 
be any problem. My issue is I like to keep my layout source code in the same 
directory as my book source code. Pre 1.5.x, LyX wouldn't look for layout 
files anywhere but /usr/local/share/lyx/layouts or ~/.lyx/layouts, so you'd 
need to create a symlink in a place where LyX looked, namely ~/.lyx/layouts.

However, starting with 1.5.x, LyX looked for layout files in the current 
directory, but sometimes finds them and sometimes doesn't, so if you don't 
have the symlink you might or might not have your document class available if 
you only put the layout file in the current directory. But if you symlink it, 
then you might get duplicates, one in the current directory and one in 
~/.lyx/layouts, in which case all sorts of bad things happen.

>
>I have no LyX layouts with an .src extension.

That's the whole point -- the .src is my deliberate sabotage so that 
incarnation of the file is NOT recognized as a layout. Then the symlink will 
be the only copy seen, and will fire up right away.

>
>Obviously, our milages vary.

The main place our mileages vary is in preferences. You prefer to keep your 
layout source code in ~/.lyx/layouts, and I prefer to keep it in the 
directory with the book. If your preferences shifted to mine, then you'd need 
to do my workaround to get things to consistently work.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US



Re: Sure-fire LyX layout files

2008-09-11 Thread rgheck

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



Re: Sure-fire LyX layout files

2008-09-11 Thread Steve Litt
On Thursday 11 September 2008 11:51:59 am Steve Litt wrote:
> Hi all,
>
> 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.
>
> It got even worse in 1.5.x when they attempted to recognize layout files in
> the current directory. You could have duplicate copies with all sorts of
> environment-munching disasters, or none, or who knows what.
>
> Yesterday I got a layout file to work the first time. What a refreshing
> difference. Here's what I did:
>
> cd /home/myuid/mybook
> Decided my document class should be called infacebook
> Created a small layout file as infacebook_layout.src
> ln -s /home/myuid/mybook/infacebook_layout.src
> /home/myuid/.lyx/layouts/infacebook.layout lyx/reconfigure
> lyx mybook.lyx
> switch document class to infacebook, which is now listed.
>
> The key here is that the actual physical file (as opposed to the symlink
> name) does not end with .layout, so LyX doesn't try to use it as a layout
> file. LyX relies only on the symlink copy in /home/myuid/.lyx/layouts.
>
> HTH
>
> SteveT

I should add a couple things:

Before opening mybook.lyx with infacebook document class, you should make a 
brand new document, which can be empty, and set that empty document to 
infacebook document class. If that doesn't work, suspect your layout file has 
errors and fix them.

If necessary, start with this trivial known good layout file to eliminate the 
possibility of your layout source being bad:


#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{trivialbook}

Input stdclass.inc
#Format 2
Input book.layout

Preamble
EndPreamble

Style TrivItemize
CopyStyle Itemize
End


Of course, you must call this file ./trivialbook_layout.src and follow all the 
symlinking/reconfigure steps in order for it to work. The point is, there's 
now a way to quickly put your layout source code into any directory you want, 
and have it quickly recognized by LyX.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US