[Tex/LaTex] colored rule and reference current column width in vwcol

rules

I would like to have

  1. colored vertical rules separating columns in the vwcol package and

  2. some method of referring to the current column
    width in the vwcol package.

We show a vwcol example and then extend it with these two features using multicol package. Is there some way of achieving them in vwcol? (This post inspired some of the code below and may be of some relevance to the second point although that post deals with the tabu package and not with vwcol.)

\documentclass{article}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{vwcol}
\usepackage[table]{xcolor}

\begin{document}

Seems ok but does not have a couple of features we would like:
\begin{center}
\begin{vwcol}[widths={.5,.5}]
\includegraphics[width=.45\textwidth]{myfig}
\includegraphics[width=.45\textwidth]{myfig}
\end{vwcol}
\end{center}

Here is an example using multicol that illustrates two things we
would like to add: (1) set color of vertical rule and (2) some
counterpart to \verb|\columnwidth|.  Using \verb|.45\textwidth| as we 
do above with vwcol is not ideal since it effectively means specifying 
width information twice.

\begin{center}
\setlength{\tabcolsep}{8pt}
\setlength{\columnseprule}{1pt}
\renewcommand\columnseprulecolor{\color{blue}}
\begin{multicols}{2}
\includegraphics[width=\dimexpr\columnwidth-2\tabcolsep\relax]{myfig}
\includegraphics[width=\dimexpr\columnwidth-2\tabcolsep\relax]{myfig}
\end{multicols}
\end{center}

Is this possible with vwcol as it stands now?

\end{document}

EDIT: Added the output shown below.

Here is what the output from the above latex code looks like:

enter image description here

Creative commons info on elephant image is available here.

Best Answer

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.

Related Question