[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-users
Subject:    Re: Going from custom charstyles to module
From:       Richard Heck <rgheck () bobjweil ! com>
Date:       2008-11-24 16:06:06
Message-ID: 492AD0EE.3070605 () bobjweil ! com
[Download RAW message or body]

Charles de Miramon wrote:
> Hello
>
> I'm starting to move my real work to LyX 1.6 and I have problem with the new
> modules.
>
>   
This seems mostly to be a problem with the new Flex insets. It doesn't 
matter whether you put the code into a module or into an inc file as far 
as this problem is concerned.

> I had in LyX 1.5 some semantic custom markup for citations in Latin and Old
> French in a mycharstyles.inc file
>
> # Personal character styles definition
>
> Format 2
> CharStyle Latin
>         LatexType             Command
>         LatexName             latin
>         Font
>           Family              Sans
>         EndFont
>         LabelFont
>           Family              Roman
>           Color               blue
>         EndFont
> Preamble
> \newcommand{\latin}[1]{\og~#1~\fg}
> EndPreamble
> End
>
> CharStyle Ancien
>         LatexType             Command
>         LatexName             ancien
>         Font
>           Family              Sans
>         EndFont
>         LabelFont
>           Family              Roman
>           Color               blue
>         EndFont
> Preamble
> \newcommand{\ancien}[1]{\og~#1~\fg}
> EndPreamble
> End
>
> I have created a module in LyX 1.6 (I could not find any documentation about
> the syntax of modules and the new flexible insets)
>
>   
See the Customization manual, chapter 5, especially sections 5.2.1 and 
5.3.6.

> Latin.module
> #\DeclareLyXModule{Latin}
> #DescriptionBegin
> #Définit des styles spécifiques pour les textes en latin et en ancien
> français
> #DescriptionEnd
>
> #Charles de Miramon 24/11/08
>
>
> Format 11
> InsetLayout Latin
>         LyxType               charstyle
>         LabelString           Latin
>         LatexType             Command
>         LatexName             latin
>         Font
>           Family              Sans
>         EndFont
>         LabelFont
>           Family              Roman
>           Color               blue
>         EndFont
> Preamble
> \newcommand{\latin}[1]{\og~#1~\fg}
> EndPreamble
> End
>
> InsetLayout Ancien
>         LyxType         charstyle
>         LabelString           Ancien
>         LatexType       Command
>         LatexName       ancien
>         Font
>           Family              Sans
>         EndFont
>         LabelFont
>           Family              Roman
>           Color               blue
>         EndFont
> Preamble
> \newcommand{\ancien}[1]{\og~#1~\fg}
> EndPreamble
> End
>
> It works for new files but does not translate the old files.
>
> The old LyX code was :
> \begin_inset CharStyle Latin
> status inlined
>
> and the new one seems to be :
> \begin_inset Flex Latin
> status collapsed
>
> Questions :
> 1) Is there a way to automatically transform the old custom charstyle
> formatting to the module ?
>
>   
This SHOULD work. As you see, LyX does update the file to the new 
format. What does the LyX code look like if you use your new InsetLayout 
definition? It's the disagreement between these that is causing the 
problem, I think.

What you might want to do is just to put your old Format 2 code into a 
module and let LyX do the conversion to Format 11 for you. You can also run:
    python $LYXDIR/layout2layout.py oldlayout.module newlayout.module
and see how LyX converts it, then just use newlayout.module instead of 
oldlayout.module.

> 2) Why do we have in the new syntax a 'status collapsed' ? Charstyles are
> not insets that can be closed or opened
>
>   
No, but they can have the "sublabel", showing which charstyle they are. 
That's what this reflects.

And in fact, they can be collapsable if you want them to be. The 
Decoration tag controls this.

> 3) I'm a bit mixed up between the old custom charstyles, flexible insets,
> modules. What is going to be deprecated ?
>
>   
There are no charstyles any more, only Flex insets.

Modules are an entirely different matter. They are a more flexible 
alternative to include files.

rh

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic