Don't try to adjust the column width directly: multicol
is designed to calculate it. What you should do instead is first set up a notional page with a 'text block' which represents the text you would get if you had a single column. This involves quite a number of potential lengths, and you would be well-advised to use the geometry
package to do this: most non-typesetters find that the most intuitive thing is to set the margins, and geometry
will let you do this, and then calculate the other lengths, rather than forcing you to do that directly.
Having done that, your two (or three, or four ...) column environment produced by multicol
will calculate the necessary width, dividing the available text block into the appropriate number of columns, leaving space (defined by \columnsep
) between them. You can adjust that separately if you need to.
So, for instance:
\documentclass{article}
\usepackage[margin={1cm,1cm}]{geometry}
\usepackage{multicol}
\usepackage{lipsum}
\begin{document}
\begin{multicols*}{2}
\lipsum
\end{multicols*}
\end{document}
Gives you a wide textblock, and wide columns.
But if you change the margins so the textblock becomes narrow:
\usepackage[margin={5cm,5cm}]{geometry}
You get narrow columns
For completeness, if you adjust the spacing between those columns with \setlength{\columnsep}{2cm}
you can see the result:
(Please note that these settings are very ugly: they show you the idea, and are not intended as a guide to good typography!)
I'm in a rush so can't answer in much detail. Having coloured rules is easy; just find in the code where it uses \vrule
and surround it with some \color
commands. Remind me again about this and I'll try to add it at some point :)
.
Your second question is more difficult. I believe the answer is ‘no’ — it's not possible to know how wide the current line is, because while TeX is typesetting the content it has not yet broken the paragraph into lines.
Note that the way vwcol works is pushing the limits of what TeX can easily achieve in terms of its hyphenation/justification routine; it won't like much more than just text in terms of what can be inserted into the environment. Unlike multicols which is a generally robust solution.
Best Answer
Here is one option via the new environment
multicolumns
. It takes a single argument, similar in nature to that of themulticol
environment:At
\begin{multicolumns}
, a vertical correction is made in terms of the skip (\multicolsep
), added by themulticol
package. This is also corrected at\end{multicolumns}
. However, capturing\prevdepth
is also required, leading to the use ofetoolbox
to patch\endmulticol
.The
\hrule
has been made to match\columnseprule
. This can be changed, if needed. To see the effect, use something like\setlength{\columnseprule}{1pt}
. Additionally, sincexcolor
is loaded, you can modify the colour of the column separation rule\columnseprulecolor
, which will translate to the top/bottom horizontal rules. For example, use\renewcommand{\columnseprulecolor}{\color{orange}}
to see the effect.One caveat: The use of
\prevdepth
relies on the last line within themulticolumn
environment. As such, if the last line (in the right-most column) has no descenders (like j, p, q, g or y), then the alignment will be off. Consider, for example:This should be manually corrected with either some
\vphantom{<descender>}
(say), or an ending\strut
. Or, alternatively, could be included in the patch of\endmulticol
for more general usage. The latter is preferred since it also leaves a better vertical gap between the descenders and the\hrule
. For example, consider