Olivier Ripoll | 19 Aug 17:42

example of layout module for LyX 1.6

Hi,

I just wanted to share a simple and probably imperfect layout module for 
LyX 1.6. I do not know much about LaTeX, so I used the examples provided 
with LyX and google to create this file. I called it 
"moremathsfunctions.module" (it should be placed in the "layouts" folder 
in the lyx 1.6 preference folder of your home directory -- in 
"Application Data" for windows users), and here is the content (between 
the dashed lines, so people can comment on the code):

------------------------------------------------------------------------
#\DeclareLyXModule{More Maths Functions}
#DescriptionBegin
#Additional functions: erf, erfc, sinc, sgn , missing hyperbolic & 
inverse hyperbolic functions,
#Fourier transform & inverse, logarithms in base 10 and 2, floor/ceil 
(letters and mathematical
#notation).
#DescriptionEnd

# Author : Olivier Ripoll

Format 7

Requires	amsmath,mathrsfs

AddToPreamble
	\DeclareMathOperator{\sinc}{sinc}
	\DeclareMathOperator{\sgn}{sgn}
	\DeclareMathOperator{\erf}{erf}
(Continue reading)

Manveru | 19 Aug 18:31
Favicon

Re: example of layout module for LyX 1.6

I do not have 1.6 yet... but I do not understand how LyX understands how to
handle these new commands? From my understanding these go only to preamble
of document, but how to add these to some buttons on toolbar for example?

2008/8/19 Olivier Ripoll <durocortorum73-gmane@...>

> Hi,
>
> I just wanted to share a simple and probably imperfect layout module for
> LyX 1.6. I do not know much about LaTeX, so I used the examples provided
> with LyX and google to create this file. I called it
> "moremathsfunctions.module" (it should be placed in the "layouts" folder in
> the lyx 1.6 preference folder of your home directory -- in "Application
> Data" for windows users), and here is the content (between the dashed lines,
> so people can comment on the code):
>
> ------------------------------------------------------------------------
> #\DeclareLyXModule{More Maths Functions}
> #DescriptionBegin
> #Additional functions: erf, erfc, sinc, sgn , missing hyperbolic & inverse
> hyperbolic functions,
> #Fourier transform & inverse, logarithms in base 10 and 2, floor/ceil
> (letters and mathematical
> #notation).
> #DescriptionEnd
>
> # Author : Olivier Ripoll
>
> Format 7
>
(Continue reading)

Olivier Ripoll | 19 Aug 19:16

Re: example of layout module for LyX 1.6

Manveru wrote:
> I do not have 1.6 yet... but I do not understand how LyX understands how to
> handle these new commands? From my understanding these go only to preamble
> of document, but how to add these to some buttons on toolbar for example?

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.
(Continue reading)

Steve Litt | 19 Aug 19:42
Favicon

Re: example of layout module for LyX 1.6

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)
(Continue reading)

Olivier Ripoll | 20 Aug 09:28

Re: example of layout module for LyX 1.6

Steve Litt wrote:
> On Tuesday 19 August 2008 13:16, Olivier Ripoll wrote:
> 
[...]
>>
>> 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?

That's how I understand it. I hope there will be more docs written on 
this topic after 1.6 is out.

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

I think so. At least that's how I see them. But developers and experts 
might see a bigger picture and envision other uses for the modules. As I 
said, I am a basic (stupid) user.

Best regards,

Olivier

(Continue reading)

rgheck | 21 Aug 19:19
Favicon
Gravatar

Re: example of layout module for LyX 1.6

Olivier Ripoll wrote:
> Steve Litt wrote:
>> 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?
>
> I think so. At least that's how I see them. But developers and experts 
> might see a bigger picture and envision other uses for the modules.
>
Anything that can go into a layout file can go into a module. So they 
can do anything from define a whole ton of environments (as 
theorems-ams.module does) to include a snippet in the premable (as 
foottoend.module does).

I'll be very interested to see what ideas people have for these.

rh

rgheck | 21 Aug 19:17
Favicon
Gravatar

Re: example of layout module for LyX 1.6

Steve Litt wrote:
> 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?
>
>   
Yes, pretty much. The thing about modules, however, is that they are 
dynamically included via Document>Settings. You don't have to edit a 
layout file to "Input" them. You can change them on the fly.

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

rh

Steve Litt | 19 Aug 19:30
Favicon

Re: example of layout module for LyX 1.6

Thanks Oliver,

I still don't understand the underlying philosophy of layout modules:

0) What is a layout module?
1) Why are they better than just writing your own layout file?
2) How do you decide when to use them?
3) By what design methodology do you create them?
4) What are the attributes of a "good" layout module?
5) What are the attributes of a "bad" layout module?

Thanks

SteveT

On Tuesday 19 August 2008 11:43, Olivier Ripoll wrote:
> Hi,
>
> I just wanted to share a simple and probably imperfect layout module for
> LyX 1.6. I do not know much about LaTeX, so I used the examples provided
> with LyX and google to create this file. I called it
> "moremathsfunctions.module" (it should be placed in the "layouts" folder
> in the lyx 1.6 preference folder of your home directory -- in
> "Application Data" for windows users), and here is the content (between
> the dashed lines, so people can comment on the code):
>
> ------------------------------------------------------------------------
> #\DeclareLyXModule{More Maths Functions}
> #DescriptionBegin
> #Additional functions: erf, erfc, sinc, sgn , missing hyperbolic &
(Continue reading)

Re: example of layout module for LyX 1.6

On Tue, 19 Aug 2008, Steve Litt wrote:

> Thanks Oliver,
>
> I still don't understand the underlying philosophy of layout modules:
>
> 0) What is a layout module?
> 1) Why are they better than just writing your own layout file?
> 2) How do you decide when to use them?
> 3) By what design methodology do you create them?
> 4) What are the attributes of a "good" layout module?
> 5) What are the attributes of a "bad" layout module?

Hi Steve,

I personally have no idea, but I suspect the answer can be found by asking 
on the developers' list :-)

Best regards,
/Christian

PS. Once 1.6 is out, I think the layout module should be stored  somewhere 
in the wiki.

> On Tuesday 19 August 2008 11:43, Olivier Ripoll wrote:
>> Hi,
>>
>> I just wanted to share a simple and probably imperfect layout module for
>> LyX 1.6. I do not know much about LaTeX, so I used the examples provided
>> with LyX and google to create this file. I called it
(Continue reading)

Olivier Ripoll | 20 Aug 09:23

Re: example of layout module for LyX 1.6

Hi Steve,

Steve Litt wrote:
> Thanks Oliver,
> 
> I still don't understand the underlying philosophy of layout modules:
> 
> 0) What is a layout module?

 From my (user) point of view, it is a small ".module" file in your 
"layouts" folder containing class, styles, etc. But the developers might 
answer that your questions better...

> 1) Why are they better than just writing your own layout file?

I think that's the question I can easily answer: I used LyX years ago to 
write my PhD thesis. However, I do not know anything about LaTeX, 
styles, etc. I just took some code from here and there and added them to 
the preamble (a lot from the now defunct web site that contained many 
LyX tricks before Wiki even existed). But I never did a layout file. To 
me, that was (and still is) a too daunting task.

When I saw the wiki page on the new features, I jumped into the modules 
provided with 1.6 and it took me very low time to write the two modules 
I use. I think the advantage is that a less experienced user like me 
prefers to add a given module than to touch the preamble, or to write a 
layout file. Also, I suspect that debugging a trivial module that you 
can turn on/off is probably easier than debugging a layout file.

There are also other advantages: you can add them, remove them, combine 
(Continue reading)

G. Milde | 20 Aug 11:53

Re: example of layout module for LyX 1.6

On 19.08.08, Steve Litt wrote:

> I still don't understand the underlying philosophy of layout modules:

> 0) What is a layout module?

A file with syntax and content similar to a LyX layout file that can be
added to a chosen documentclass' layout definitions on a per-document base.

> 1) Why are they better than just writing your own layout file?

It's orthogonal: you can combine document classes with additional features
provided by the modules.

> 2) How do you decide when to use them?

In Document>Settings

> 3) By what design methodology do you create them?

Take an example from the LyX 1.6 layouts directory and modify.

> 4) What are the attributes of a "good" layout module?
> 5) What are the attributes of a "bad" layout module?

This is a matter of taste (to a certain extent). Look at the examples that
come with LyX 1.6 for "good" ones.

Günter

(Continue reading)

rgheck | 21 Aug 19:28
Favicon
Gravatar

Re: example of layout module for LyX 1.6

G. Milde wrote:
> On 19.08.08, Steve Litt wrote:
>
>   
I developed these, so let me add a bit.

>> 0) What is a layout module?
>>     
>
> A file with syntax and content similar to a LyX layout file that can be
> added to a chosen documentclass' layout definitions on a per-document base.
>
>   
Modules are similar to included files, except in this sense: They are 
included on a per-document basis, using a GUI in Document>Settings. And, 
as you put it elsewhere, they allow easy sharing of layout code, without 
anyone's having to edit a layout file. Put the new module in your 
layouts/ directory, reconfigure, and use it.

>> 1) Why are they better than just writing your own layout file?
>>     
>
> It's orthogonal: you can combine document classes with additional features
> provided by the modules.
>
>   
The advantage is precisely that they can be included on a per-document 
basis. Suppose, for example, that you sometimes want a "Formula" layout. 
You want it in articles, books, etc, but not all of them. In 1.5, you 
could put this into formula.inc and then Input it into various new 
(Continue reading)

Helge Hafting | 22 Aug 11:21

Re: example of layout module for LyX 1.6

Steve Litt wrote:
> Thanks Oliver,
> 
> I still don't understand the underlying philosophy of layout modules:
> 
> 0) What is a layout module?
A modular approach to layout files.

> 1) Why are they better than just writing your own layout file?
Flexibility.
For example, lets say you need a special kind of markup. (A new 
charstyle or an extra paragraph type.) This extra stuff can now be used 
in many different document types.  I.e. you can use your
layout module in book, article, scrarticle, ...

Under the old system, you had to make a new layout file for each of 
these cases. And what if you had a second special kind of markup? You'd 
need to make layout files for all combinations of "extra stuff" and 
various document classes. Now, all you need is one layout module per
extra feature. These can be added to existing document classes as 
needed. So you include "extra math theorem environments" only when you 
need them, avoiding cluttered menus in all those documents that don't 
use math.

> 2) How do you decide when to use them?

When you have some nonstandard markup feature that'd be nice to use in 
several different document classes. And perhaps you don't want to use 
them _always_, only when needed.

(Continue reading)

G. Milde | 20 Aug 10:57

Re: example of layout module for LyX 1.6

On 19.08.08, Olivier Ripoll wrote:
> Hi,

> I just wanted to share a simple and probably imperfect layout module for  
> LyX 1.6. 
...
> As the description says, this module simply defines several useful math  
> functions that are not available by default.

One tip: to get the additional functions nicely rendered in LyX, I use
"dummy" math-macros: The definitions goes to the preamble and the
math-macro is in a branch or comment (to suppress the \newcommand{}{}
definition in the LaTeX file.)

This is, however, the <=1.5.x way to do, I do not know how this will fit
with the new math-macro implementation in 1.6.

The attaced file has such a dummy macro for the sgn function.
It is an excerpt of the math-macros for my phd thesis.

Günter

Attachment (sgn-macro.lyx): application/x-lyx, 1596 bytes

Gmane