# vertical rule in tabular cell over part of its height

I want to insert a vertical line in a tabular cell which doesn't run over the full height of the cell, but only 90% of it. I tried:

• \vrule height 0.45\height depth 0.45\height, but \height throws errors in tabular cells
• scaling down \vrule, but \scalebox{1}[.9]{\vrule} doesn't work

## MWE

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{blindtext}

\begin{document}
\begin{tabular}{p{0.52\linewidth} @{\hspace{0.05\linewidth}} c @{\hspace{0.05\linewidth}} p{0.32\linewidth}}
\begin{minipage}{\linewidth}\blindtext[2]\end{minipage}
&
\vrule height 0.35\textheight depth 0.35\textheight
&
\begin{minipage}{\linewidth}\blindtext\end{minipage}
\end{tabular}
\end{document}

## Output

This roughly produces the output I want, but of course using \textheight isn't the right thing to do here.

If that helps, I thought of a way of filling the cell with some box in which I then can use \height. Would that be an approach?

PS: I am aware of the multicol package, but it doesn't meet my needs of vertically centered columns with different widths.

Suppose your:

\vrule height 0.4\height depth 0.4\height

If you mean \height as maximal height of two columns, then you must to measure them using setbox:

\input plipsum
\newdimen\height

\def\twocols#1:#2#3:#4{{\emergencystretch=2em \parindent=0pt
\setbox0=\vbox{\hsize=#1\hsize #2}\setbox1=\vbox{\hsize=#3\hsize #4}%
\height=\ht0 \ifdim\height<\ht1 \height=\ht1 \fi % maximal height
\hbox to\hsize{$\vcenter{\unvbox0} \hfil \vrule height .4\height depth.4\height %<<<--- here is your \vrule \hfil \vcenter{\unvbox1}$}}}

\twocols .5:{\lipsum1} .4:{\lipsum{2-3}}

\bye
• Thank you very much! There's a tiny mistake in your code: \ifdim\dimen0<\ht1 should be \ifdim\dimen0>\ht1, at least for my use (length of the rule relative to height of the tallest column). You may want to edit your answer. – dessert Apr 22 '16 at 13:17
• For some reason \usepackage{mathpazo} doesn't like \setbox0 etc., but \setbox1, \setbox2 etc. is totally totally fine. – dessert Apr 25 '16 at 14:47

I'm assuming the height of the vertical bar should correspond to the height of the block on the right-hand side. If this assumption is correct, you could achieve your formatting objective by placing two tabularx environments side by side. By default, they will be centered vertically relative to each other.

(The horizontal line at the top edge of the following screenshot is there just to illustrate the width of the text block.)

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{blindtext,tabularx}

\begin{document}
\hrule\medskip % to illustrate width of textblock

\noindent
\setlength\tabcolsep{1em}%  % choose amount of intercolumn whitespace
\begin{tabularx}{0.55\textwidth}{@{}X}
\blindtext[2]
\end{tabularx}% snug up the two tabularx environments
\begin{tabularx}{0.45\textwidth}{|X@{}}
\blindtext
\end{tabularx}

\end{document}
• Thank you, but I want the rule to be 90% of the height of the tallest column in general. Your solution will again create a 100% rule if the second column is the taller one. – dessert Apr 22 '16 at 12:54
• @dessert - It's rather easy to switch the "|" symbol between the two tabularx environments, isn't it? Where does the "90% of the height of the taller column" objective come from -- and won't it fail if the two columns are roughly equally tall? – Mico Apr 22 '16 at 13:17
• Well, I don't like the idea of 100% rules, there are some scenarios (like with prevented orphans) where they appear too long to me. Measuring the height of the columns as in wipets answer seems to be the way. – dessert Apr 22 '16 at 13:31