Here is a patch for LyX 2.0, that adds "multicol.module" and support for
it. The module provides custom insets for 2,3,4,5,6,7 and 8 columns.
Screenshot:
http://www.aitel.hist.no/~helgehaf/sw/multicol/multicol.png
Demo PDF:
http://www.aitel.hist.no/~helgehaf/sw/multicol/multicol.pdf
Demo .lyx file:
http://www.aitel.hist.no/~helgehaf/sw/multicol/multicol.lyx
In addition to the module itself, the patch touches these 3 files:
src/LaTeXFeatures.cpp (support for multicol.sty)
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?
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?
3. In my opinion, a n-column inset should not collapse by default
when moving the cursor out of it. And I want labels
above and below, but not lines on the sides. I.e.:
--- 3 columns start ---
text text text
--- 3 columns ends ---
All this is just cosmetics though, and is
not needed before the 2.0 release.
Helge Hafting
Index: src/LaTeXFeatures.cpp
===================================================================
--- src/LaTeXFeatures.cpp (revisjon 36890)
+++ src/LaTeXFeatures.cpp (arbeidskopi)
@@ -597,6 +597,7 @@
"amscd",
"slashed",
"multirow",
+ "multicol",
"tfrupee"
};
Index: lib/doc/LaTeXConfig.lyx
===================================================================
--- lib/doc/LaTeXConfig.lyx (revisjon 36878)
+++ lib/doc/LaTeXConfig.lyx (arbeidskopi)
@@ -3834,6 +3891,34 @@
\end_layout
\begin_layout Subsection
+multicol
+\end_layout
+
+\begin_layout Description
+Found:
+\begin_inset Info
+type "package"
+arg "multicol"
+\end_inset
+
+
+\end_layout
+
+\begin_layout Description
+CTAN:
+\family typewriter
+macros/latex/required/tools/
+\end_layout
+
+\begin_layout Description
+Notes: The package
+\family sans
+multicol
+\family default
+ is needed by LyX to be able to output text in multiple columns.
+\end_layout
+
+\begin_layout Subsection
textcomp
\end_layout
Index: lib/Makefile.am
===================================================================
--- lib/Makefile.am (revisjon 36773)
+++ lib/Makefile.am (arbeidskopi)
@@ -1144,6 +1144,7 @@
layouts/memoir.layout \
layouts/minimalistic.module \
layouts/moderncv.layout \
+ layouts/multicol.module \
layouts/mwart.layout \
layouts/mwbk.layout \
layouts/mwrep.layout \
#\DeclareLyXModule[multicol.sty]{Multiple columns}
#DescriptionBegin
#Adds support for the multicol.sty package
#
#DescriptionEnd
Format 30
Insetlayout "Flex:2 columns"
MultiPar 1
Decoration Classic
#Do Conglomerate look better than Classic?
#Less intrusive, and doesn't auto-coll
LabelString "2 columns"
LatexType Environment
LatexName multicols
LatexParam {2}
LyxType Custom
ResetsFont 0
Preamble
\usepackage{multicol}
EndPreamble
End
Insetlayout "Flex:3 columns"
CopyStyle "Flex:2 columns"
LabelString "3 columns"
LatexParam {3}
Decoration Classic
End
Insetlayout "Flex:4 columns"
CopyStyle "Flex:2 columns"
LabelString "4 columns"
LatexParam {4}
End
Insetlayout "Flex:5 columns"
CopyStyle "Flex:2 columns"
LabelString "5 columns"
LatexParam {5}
End
Insetlayout "Flex:6 columns"
CopyStyle "Flex:2 columns"
LabelString "6 columns"
LatexParam {6}
End
Insetlayout "Flex:7 columns"
CopyStyle "Flex:2 columns"
LabelString "7 columns"
LatexParam {7}
End
Insetlayout "Flex:8 columns"
CopyStyle "Flex:2 columns"
LabelString "8 columns"
LatexParam {8}
End