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



\begin{tabular}{p{0.52\linewidth} @{\hspace{0.05\linewidth}} c @{\hspace{0.05\linewidth}} p{0.32\linewidth}}
  \vrule height 0.35\textheight depth 0.35\textheight



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.

2 Answers 2


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

\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{$
      \vrule height .4\height depth.4\height %<<<--- here is your \vrule 

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

  • 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
    Commented Apr 22, 2016 at 13:17
  • For some reason \usepackage{mathpazo} doesn't like \setbox0 etc., but \setbox1, \setbox2 etc. is totally totally fine.
    – dessert
    Commented Apr 25, 2016 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.)

enter image description here


\hrule\medskip % to illustrate width of textblock

\setlength\tabcolsep{1em}%  % choose amount of intercolumn whitespace
\end{tabularx}% snug up the two tabularx environments

  • 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
    Commented Apr 22, 2016 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
    Commented Apr 22, 2016 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
    Commented Apr 22, 2016 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .