On 20. des. 2010 22:20, Guenter Milde wrote:
On 2010-12-17, Helge Hafting wrote:
On 17. des. 2010 09:37, Guenter Milde wrote:
On 2010-12-16, Helge Hafting wrote:
[...]
I wonder why/if it is necessary to change src/LaTeXFeatures.cpp.
I did not see changing scr/LaTeXFeatures.cpp mentioned in the
Customization guide.
It is necessary in order to have LyX "support" multicol.sty. So LyX
will check to see that the .sty is actually present, and say you can't
use the module if it isn't.
And I believe supporting multicol.sty in LaTeXFeatures.cpp will ensure
the latex packages are loaded in correct order. Don't know if there
are any constraints on multicol.sty, but some packages have
such constraints. LaTeXFeatures.cpp takes care of that.
lib/doc/LaTeXConfig.lyx (document multicol.sty)
lib/Makefile.am (makefile support for multicol.module)
I can update our existing examples of multicol documents, if this goes
in. Currently, they use ERT which is no longer needed. And maybe it
should move from "Additional" to "UserGuide" ?
Making this module showed that a couple of things are missing from the
module system, that would be really nice to have:
1. It seems to be impossible to add support for \columnbreak,
because this is a command that doesn't take any text as
parameter. In the LyX GUI, it should look similar to \newpage.
Or am I missing something?
Maybe make it a dummy style similar to "-- separator --"?
but with "columnbreak" as LaTeX command?
I tried that, and will post an updated multicol.module shortly.
It sort of works, but also shows that the mechanism isn't perfect.
I get a "column break" paragraph type, which can contain text. The latex
result is \columnbreak{text}. Fortunately, this cause no problems for
latex, but it doesn't look good in the main window either.
Also, the user is not inserting a column break, but _changing_ the
paragraph type to "column break". So unless he takes care and make an
empty paragraph first, things go wrong.
The "--separator--" has the same problems, so I guess this is OK for now.
I see. Maybe a custom inset would be the better choice for "column
break". (Custom insets were not available at the time the
"--separator--" style was added. Unfortunately, there is no way to
"obsolete" as style with an inset.)
A custom inset is a box that you can type into. That is so _wrong_ for
this usage. I need to insert something similiar to pagebreak/newpage.
But it looks likes modules cannot declare any kind of new inset that
*doesn't* contain at least one paragraph of text.
As long as this is missing, I can't do better. I can probably add this
capability to LyX sometime in january - but I guess it is a little late
for new features now?
An inset would also allow column breaks inside a paragraph.
Yes. Nice, but not that important considering what a column break does.
Still, it'd be nice to just place the cursor in the middle of a sentence
and insert a break. But *not* a box that invites the author to type
stuff into. That is too wrong.
2. It'd be very useful to specify "this insets takes a
mandatory integer parameter" and have the LyX GUI
provide a mechanism for editing that integer. (I.e.
an editable field in the inset label.)
That way, we could do with a single inset for multicols
instead of one for two columns, one for three columns and so on.
I guess it is probably too late for that now?
LyX Styles can take an optional argument. Again citing from
enumitem.module:
An optional argument is useless here, unfortunately.
The argument to \begin{multicols}{ }
is mandatory. If it is missing, you get a compile error in the document.
You will need to define a wrapper in the preamble then. Something like
AddToPreamble
\newenvironment{\lyxmulticols}[1][2]%
{\begin{multicols}{#1}}%
{\end{multicols}}
EndPreamble
I see. But it'd be such a kludge for the users. If they want anything
but two columns they will have to insert a "short title" and make sure
they never ever type in front of that.
I rather program this capability into LyX, improving the usefulness of
modules in general. But the timing is such that it will be for LyX 2.1,
I guess. I hoped this module would be useful in the meantime.
Helge Hafting