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

\DeclareMathOperator{\sinc}{sinc}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\erf}{erf}
\DeclareMathOperator{\erfc}{erfc}
\DeclareMathOperator{\FT}{\mathscr{F}}
\DeclareMathOperator{\iFT}{\mathscr{F}^{-1}}
\DeclareMathOperator{\logten}{log_{10}}
\DeclareMathOperator{\logtwo}{log_2}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\csch}{csch}
\DeclareMathOperator{\arsinh}{arsinh}
\DeclareMathOperator{\arcosh}{arcosh}
\DeclareMathOperator{\artanh}{artanh}
\DeclareMathOperator{\arcoth}{arcoth}
\DeclareMathOperator{\arsech}{arsech}
\DeclareMathOperator{\arcsch}{arcsch}
\newcommand{\Floor}[1]
{\left\lfloor {#1} \right\rfloor}
\DeclareMathOperator{\floor}{floor}
\newcommand{\Ceil}[1]
{\left\lceil #1 \right\rceil}
\DeclareMathOperator{\ceil}{ceil}
EndPreamble
------------------------------------------------------------------------

As the description says, this module simply defines several useful math
functions that are not available by default (I hope I did not overwrite
existing LaTeX stuff). There are two versions of the "floor" and "ceil"
functions, the one with a capital letter must be followed by \{xxx}
where xxx is the number to which it is applied. It provides an aspect
like in http://en.wikipedia.org/wiki/Floor_function

I used http://en.wikipedia.org/wiki/List_of_mathematical_functions as a
reference for the functions I added. And before someone says so, Fourier
transform and its inverse are not functions, but I do not care ;-)

I hope this can be helpful to someone. I like this layout module feature
a lot, I created another one with custom char styles for filenames and
code, based on Martin Vermeer's "logicalmkup.module".

Small question: should I change the "Format 7" to "Format 8" ?

Best regards,

Olivier

PS: be careful, some lines are wrapped by the mail agent in the
description.





--
Christian Ridderström, +46-8-768 39 44            http://www.md.kth.se/~chr