Jean-Marc Lasgouttes wrote:
Le 31 janv. 09 à 17:33, Jean-Marc Lasgouttes a écrit :
I noticed an #ifdef TEX2LYX in the patch. If that does what I think
it does, then a quick and dirty fix for the AMS problem with tex2lyx
would be to include appropriate such code in the TextClass::read()
routine that would make tex2lyx treat the DefaultModule tag like
Input. I.e., something like:
Isn't there a way to ask instead TextClassList (or whatever it is
called these days) to return us a textclass with the modules loaded
(something like that is done for buffers already...)
It would be better than this hack.
After reading the source: can't we get a Documentclass that has loaded
the modules?
There are shorter-term and longer-term issues here. I was thinking of
something that would simply address the immediate problem while we
figure out what to do more generally. More generally, we presumably want
to load available modules corresponding to paragraph layouts, etc, that
appear in the document. Otherwise, export of a document that uses (e.g.)
Linguistics will fail to re-import properly.
To do that, we'll of course need, from time to time, to get a
DocumentClass that has those modules loaded. I suppose we could manage
to do that now, without choosing any "new" modules but just allowing the
default one to be loaded. How exactly this should be done in tex2lyx, I
do not know, but the problem has to be solved eventually, so, yes, I
guess it could be done now.
The list of modules for a given document is maintained in BufferParams,
and there is a set of routines there---these include addDefaultModules()
and removeBadModules()---that determine exactly what modules are active,
check for conflicts, etc. Similar routines will eventually be needed by
tex2lyx, too, I'm guessing, since the document could (e.g.) use modules
that conflict with default modules. As you will have seen, the routine
that generates a DocumentClass from a TextClass is also in BufferParams,
and it uses the list of modules maintained by the BufferParams to do its
work. So most of what is needed is, at present, in BufferParams, which
tex2lyx does not, from what I can see, use.
But there's probably no reason we can't extract that stuff from
BufferParams. The list of modules itself could become a separate class
(call it Modules for now). The makeDocumentClass() routine could then be
liberated from BufferParams and operate on a Modules it gets from wherever.
??
rh