Jürgen -

Thanks for the comments. I'll intersperse mine with yours....

On Wednesday, September 24, 2003, at 03:00 AM, Juergen Spitzmueller wrote:

Hello Bennett,

Bennett Helm wrote:
Here are some layout files for the memoir documentclass. I've split

Many thanks for doing this. I have improved my layout too and it has been
added to CVS (both the developer version and LyX 1.3.3) this week. I'm trying
to merge your changes with mine, but there are some slight differences in
approach we have to discuss first.

I guess I should have checked with you first so as not to duplicate effort! Oh well....


them into two layout files -- one for books and one for articles (with
a third file for all the common code). The article layout file does a
couple weird things to make it more compatible with the standard
article documentclasses. The first is to redefine the sectioning
commands (so that,  for example, \section gets interpreted as
\chapter). The reason for this is so that it is possible to switch
between the article document class and the memoir documentclass (with
the "article" class option) without having to change manually anything
in the document. The second is to redefine the \chapter command so as
to remove the erroneous "Chapter x" that precedes section titles in
headers when babel is loaded.

I am not shure if we should rename the environments that way. After all,
chapter is still chapter, it only behaves "sort of" like section in article
does. Also, the article option does not change to oneside by itself. So
# Global parameters
Sides 1
is not correct (also Columns 2; memoir has single column mode by default).

You're certainly right about Sides and Columns -- just a silly goof on my part. One thing I could not get to work is switching from twoside to oneside from within the LyX GUI: unchecking the "Two-sided document" box in Document Settings does nothing, my guess is because LyX assumes the oneside option is the default (which is not true for memoir). Perhaps that should be changed in the LyX code.


IMHO we should only provide one layout file and explain (in Extended.lyx) that
memoir can emulate something that is closer to article than the default
(btw., if you redefine the envoronments like you die, i.e. section (lyx) ->
chapter (memoir), then switching classes within LyX will be much more
difficult).

My aim was to get memoir with the article option to work as closely as possible to the normal article class. I write more articles than books, and I sometimes find myself having reason to switch between, for example, the standard article documentclass and the paper documentclass. So I thought I should preserve the option of switching between these and the memoir documentclass with the article option, making that go as smoothly as possible. Moreover, if someone switches from one of the article classes to one of the book classes, the effects of the switch should be predictable. That is, if I go from an article documentclass to a book documentclass, I end up having my section titles go from "1 [title]" to "0.1 [title]". It would be somewhat jarring, I thought, to make the switch from memoir with the article option (which, although it's not really a separate documentclass nonetheless mimics the article documentclass in many ways) to memoir without the article option and have section titles go from "1 [title]" to "Chapter 1 [title]".


Of course, someone who really understands the memoir class may not want to do it this way. For such a person, it would always be possible to use my "book (memoir)" layout and add the article option: that's not a trick that would be difficult for an expert. My aim, however, was to make things as easy as possible for those who are not experts and do not have the inclination to learn how memoir actually works but just want to use the GUI tools to produce nice documents with a minimum of fuss. That's why I redefined things as I did, and that's why I provided two layouts.

I've tried to include as many commands and environments as I could from
the memoir class, though I wasn't able to figure out how to do many of
them since they take more arguments or options than I could accommodate
within the LyX layout file. In some cases, as with the \epigraph
command, I've made the quotation be the body of the Epigraph paragraph,
with the author to be inserted as a "Short Title" (under the "Insert"
menu), since the "Short Title" actually gets passed as an optional
argument to the command.

There is a trick to let Lyx pass two optional arguments (or two parameters,
for that matter), which I have mentioned in the memoir doc section (which I
have added to Extended):
Inside an OptArg Inset (i.e. Short Title), Just insert ][ in ERT. This will
close the first argument an open a second one (in memoir, this can be used to
pass the two arguments two chapter
\chapter[toc][headings]{title}
With epigraph, you can similarly just add a pair of curly brackets in ERT (as
"smart motto }{ source"). Than you don't have to redefine the environment
(it's still a hack after all, but maybe the LyX framework will change
eventually)..

It is a hack (as is mine). Yours has the advantage of making the contents of the extra arguments visible, though I suspect it would be a bit more difficult for users who don't know LaTeX (which is not to say that mine approach would be easy). I'm not sure which is better.


In other cases, as with the \hangpara command, I've done the same trick
(where the "Short Title" specifies the number of lines to be "hung" by
the paragraph), though I've had to stipulate that the width of the
"hanging" be 2em. This use of LyX's "Short Title" is certainly
counterintuitive, but it gets the job done.

It don't think it's a good idea to hardcode some value (why 2em?). I really
think hangpara is one of the environments which cannot be supported by LyX in
a sensible way currently and the user is stuck with ERT (of course you could
use the trick mentioned above, but I don't think taht is more elegant than
ERT). There are similar cases in KOMA two (the "addmargin" environment).

It's hardcoded because that was the closest-to-sensible way I could figure out to do it. (I agree, it is not an elegant solution.) Nonetheless, I think it's better to have a GUI option where possible, again for users who don't know LaTeX and don't want to have to learn ERT.


I have added legend to the layout.
I am not shure about sidebar, as Peter Wilson classifies it as experimental
and considers to remove it again if it proves too buggy. I think we should
wait until this feature has been declared "stable".

Fair enough. I was aiming at being inclusive.


I am reluctant on framed and shaded either. They are both more container
insets than environments (they can include other environments as quote and
verse themselves), so a collapsable inset would be more appropriate.

That's true. Is there a way to define such a thing in a layout file? Assuming there's not, my inclination again was to be both inclusive and aim for utilizing the GUI rather than ERT as much as possible. So, although framed and shaded allow extra formatting of paragraphs inside those (LaTeX) environments, and although my making them be LyX environments does not allow for that easily, I thought having something was better than nothing.


Furthermore, Martin Vermeer is currently working on a native frames'n'boxes
support for LyX. Maybe this thing should be considered there. Furthermore,
for shaed you are loading the color package, but you have to make shure that
this is not loaded before. This could be done by something like


Preamble
        [EMAIL PROTECTED]
        \usepackage{color}}{}
        \definecolor{shadecolor}{gray}{0.8}
EndPreamble

But again, why hardcoding a color here?

That mistake is just my ignorance of LaTeX, I'm afraid. Why hardcode a color? Well, some value is needed, and I didn't see how else that could be easily incorporated into LyX. (With your solution, would the Preamble inserted by the layout file be after the user's additions to the preamble from the Document Settings dialog? If so, then it's always possible for the user to add LaTeX code there to define a custom color.)


Perhaps there ought to be a way in the definition of layout files to
make handling extra arguments/options easier or to make it possible to
specify more than 2 arguments within LyX. (Or perhaps I'm just not
seeing how this could be done.)

I don't know how two arguments could be supported in a sane way (but I didn't
think too hard about it), two opt arguments are certainly possible, if
someone adds the code. Until then, we have two use some hackery.


Of course, comments or suggestions for improvement would be welcome.

Please take these points only as suggestions. My experience on Memoir is
limited and I am just trying to understand what the class actually aims. I
have attached the most recent version of my layout (plus your legend
environment). I'm looking forward for comments, I have also attached the
section from Extended.lyx where I try to explain the usage in short. I think
this all can be improved a lot, and I am grateful for any help.

Other than the points above, the only other thing I did was to mix the additional styles in with the appropriate .inc files, which I input explicitly rather than inputting stdclass.inc. (This is similar to the Koma-script layouts.) The reason for this is to ensure that the additional styles get added in the appropriate place in the drop-down list in the toolbar -- so that the epigraph style comes next to the title, author, date, and abstract styles, e.g. As you have it, the new styles all come at the end of the GUI, which can be confusing.


Anyway, thanks for the thoughtful comments.

Bennett

----------
Bennett Helm
Department of Philosophy
Franklin & Marshall College

Reply via email to