Marshall Feldman <[email protected]> writes:
> Furthermore, LaTeX takes care of any \RequirePackage, \LoadClass, or
> similar commands in x.cls, so LyX does not need to know about these.
Yes.
> This implies that LyX's \DeclareLaTeXClass statement simply ties the
> current LyX layout file to a LaTeX cls file with the same name, and
> the contents of the statement play no role in making the association.
It does play a role when there is a class name as optional argument.
> In particular, the information in curly brackets is used ONLY to
> specify a character string displayed in the Document Settings
> drop-down.
>
> You say that "adding the optional "letter" argument tells (LyX) that
> your document actually starts with \documentclass{letter}." Does this
> imply that when the argument is omitted for a layout file named
> x.layout, LyX will start the document with "\documentclass{x}"?
Yes.
> What if, for some reason the layout designer wants two different
> layouts to use a common LaTeX class? (E.g., using letterhead for both
> memos and letters) Wouldn't this imply two layout files and one class
> file? How would one make the association?
Assuming that letterhead.cls is a class, I'd do:
mymemos.layout:
# \DeclareLaTeX[letterhead]{my nice memo class}
myletter.layout:
# \DeclareLaTeX[letterhead]{my nice letter class}
> Finally, I have two questions about the argument(s) in square brackets
> on the \DeclareLaTeXClass statement:
>
> 1. I'm assuming that it's just a list of comma-separated class and
> style names. An alternative syntax might be a mandatory first
> argument separated by a comma from an optional second argument,
> but the second argument would be a list of names separated only by
> spaces. (The documentation is not clear on this.) Is my assumption
> that everything is comma-separated correct?
Yes, everything is comma separated. It is a syntax that was not
designed, but grew as the need arose. I seem to remember there was no
optional argument at first, and that it was added this way in order to
avoid breaking compatibility (we had no layout2layout.py compatibility
script at the time). The single optional argument was changed to a list
of entries for the same reason. it could have been
\DeclareLaTeXClass[][]{} instead.
This weird syntax is used because the availability checking is done by
LaTeX itself. We should probably get rid of it and redesign the whole
thing. You'll notice that modules use a different syntax, which looks a
bit weird.
> 2. More importantly, the optional square brackets and arguments
> within it are only used to mandate that LyX check that certain
> packages and classes are installed before even allowing the user
> to use the layout to select a document class. Since some LaTeX
> implementations (e.g., MiKTeX) can load packages on the fly, this
> might disallow some document classes that would otherwise run
> perfectly.
No, because Miktex will run its magic (and create lots of problem when
there is no network connection) when we check for availability.
Moreover, the classes can still be selected, but LyX warns that no
output can be produced.
> Besides being more clear in the documentation (a draft of which I'd be
> glad to offer once I'm sure I understand the command), one change that
> LyX developers might consider is to issue a warning message and make
> the document class available to the user even if the classes in square
> brackets are not installed.
I thought we did that already...
JMarc