On 03/04/2010 08:57 PM, Manoj Rajagopalan wrote:
On Thursday 04 March 2010 08:41:08 am rgheck wrote:
Or might it be better to have something
like this:
ListCommand listofvideos
in the float definition? Then you could also have:
ListCommand listoftables
and
ListCommand listoffigures
in the appropriate places, and skip these special checks altogether.
If that seems a good idea, I can create this command. Or, if you'd like
to learn a bit about layout stuff, you can do it. The place to look is
TextClass::readFloat(), and then an appropriate member would need to be
added to Floating.
One other thing: We need to check the other uses of builtin() to make
sure that the code can handle things other than table and figure. If
this routine expects only those two things, then maybe other routines
do, as well. There is such a check in
LaTeXFeatures::getFloatDefinitions(), for example, and I have no idea if
other builtins need similar treatment. Another place is in
InsetFloatList::xhtml(), which was based on the latex output. Whatever
we do for the latex, we can also do here, I suspect.
rh
I agree with you in that a new ListCommand (maybe LaTeXListOfCommand?) is a
better idea - it is not necessary that documentclass creators adhere to this
ad-hoc nomenclature. For example, \listofpotatos could be \listofpotatoes
(notice the penultimate 'e'). Providing such a command will scale in future.
The "LaTeX" prefix in the optionname disambiguates the intent (command could
very well mean lyx command esp. since the value of this option won't have
a '\' prefix to indicates its latex-ness).
I can work on the patch - I am having fun learning lyx and the pointers you
have given will certainly help.
OK. Let me know if you have any questions. Note, by the way, that you'll
also need (a) to increment the layout format in TextClass.cpp and (b) to
do trivial work in layout2layout.py. If you look at r33467, you'll see
what I mean.
FWIW, ListOfCommand or CommandForList is probably good enough. DocBook
has its own way of handling these things, and the "Command" part
disambiguates. Only LaTeX has commands.
About builtin() - the code and documentation must agree. The documentation
(UserGuide appendix on menu items) says "built-in" is something defined by
the document class but the code doesn't seem to honor this 100%. Since table
and figure are latex fundamentals, maybe it would make sense to
distinguish "isLatexPrimitive()" from "builtin()" ? latex-primitive =>
built-in but not the other way.
My sense, from a brief look, is that the documentation is right and the
code is wrong. What this really seems to indicate is whether we need to
use the float package for this float. So it might make more sense to
have a "NeedsFloatPkg" tag instead of the "Builtin" tag. It would
default to false, so the default wouldn't change, and the only actual
work would be in layout2layout.py. The rest would be replacing
Floating::builtin() with Floating::needsFloatPkg().
Richard