Jean-Marc Lasgouttes wrote:

>  Edmar> The patch 5 associates latex command "dummy" to "do not
>  Edmar> generate \begin{} \end{} nor \tem".  With that patch applied,
>  Edmar> and defining the Scrap layout to be: Style Scrap LatexType
>  Edmar> Item_Environment LatexName dummy ....
>
>  The right thing to do is not that, but rather add a way in texclass
>  files to determine whether Return should end a layout or not (if I
>  understand correctly, this is the behaviour that you want to
>  emulate). Something like 'KeepStyleOnReturn 1'.

No, that is not entirely true. Actually, the fact that "return" ends
a layout is not even a concern (I can use alt-return instead of plain ret...)
The problem, is that if you define the Scrap layout to be anything different
than "Environment" or "Item_Environment" then each line in the code will be
treated as a paragraph, and the output will have many empty lines. Example:

on lyx:
Scrap>  <<test>>=
Scrap>  j = i;
Scrap>  i = i + 1;
Scrap>  print();
Scrap>  @

What I want in the output file is:

Noweb>  <<test>>=
Noweb>  j = i;
Noweb>  i = i + 1;
Noweb>  print();
Noweb>  @

But if I define the Scrap layout as a paragraph, I will get:

LaTeX>  <<test>>=
LaTeX>
LaTeX>  j = i;
LaTeX>
LaTeX>  i = i + 1;
LaTeX>
LaTeX>  print();
LaTeX>
LaTeX>  @

If I define it as a command, and command name is "foo", I will get:

LaTeX>  \foo{<<test>>=}
LaTeX>
LaTeX>  \foo{j = i;}
LaTeX>
LaTeX>  \foo{i = i + 1;}
LaTeX>
LaTeX>  \foo{print();}
LaTeX>
LaTeX>  \foo{@}

If I define the Scrap layout as an Environment, and environment name
is "bar", I will get:

LaTeX>  \begin{bar}
LaTeX>  <<test>>=
LaTeX>  j = i;
LaTeX>  i = i + 1;
LaTeX>  print();
LaTeX>  @
LaTeX>  \end{bar}

Which is the closest of the desired "Noweb>" output. The patch
I provided will get rid of the \begin{} and \end{}, *if* you declare
the environment name to be "dummy".

In summary, the KeepStyleOnReturn behaviour that the Environment
layout provides is a plus, but not essential.

>  Edmar> Then, the output of lyx will be exactly what we need it to be.
>
>  Yes, but you are twisting the semantics of the definition instead of
>  fixing it...

But the purpose of having a file that describes the layouts, is
to make it easier to create different layouts with existing tools, isn't it ?
That is what I did.

>  Edmar> On the other hand, a separate class may require the user to
>  Edmar> define wether the document is a web document or plain latex
>  Edmar> document very early.  Like for example: pressing a button in
>  Edmar> the Layout/Document menu.  In that case, a Web document would
>  Edmar> allways be a Web document even if it has no scrap on it. (
>  Edmar> Which is OK with noweb, BTW). And a LaTeX document would have
>  Edmar> the "Scrap" layout grayed out, i.e., disabled. Thus, it could
>  Edmar> never be upgraded to a Web document.
>
>  What you could do is have a new OutputType (new in lyx 1.0.0pre5 cvs)
>  noweb (existing types are LaTeX, LinuxDoc, DocBook) and a specific
>  article class for noweb. It is certainly the best solution for me,
>  since I don't want to add a bogus Scrap entry that will look just
>  annoying to 95% of the users.

Well, that is actually easier to do. But article is too small to handle
the projects I have. You need report, or book class.

Eventually, we can duplicate all the latex classes, this is pretty easy
to do, and the "Scrap" layout will not show up in the list, when the
user selects standard "article/report/book/letter...", but only when
defining the document as "web-article/web-report/web-letter..."

If you all agree on this, I can go ahead and define the classes.

That reminds me: I also have a thesis.layout class and the corresponding
thesis.cls for latex I wrote for my thesis. I don't know if other
universities have similar thesis formats or if they are all diferent
(Rice format has a lot of pick details..).

Anyway, if you think a thesis.layout class is a valid contribution,
I can submit a patch for that one too.

Regards,

/*----------------------------------------------------------------------*/
/*      Edmar Wienskoski Jr.    - [EMAIL PROTECTED]           */
/*                              - http://www.cs.rice.edu/~wiensk        */
/*----------------------------------------------------------------------*/
     ____
    | [] |                                                 ______()_||_
 ---+----+---  ------------  ------------  ------------     | []       |
 | |      | |  |          |  |          |  |          |  ___|          |
 |_|______|_|  |__________|  |__________|  |__________|  |______________\
"o-o      o-o""o-o      o-o""o-o      o-o""o-o      o-o""o-o  O-O-O  o-o "


Reply via email to