I'm trying to make a table where the row lines only span a percentage of each column (say 75% centered on the middle of the cell). In other words instead of connecting column lines like this "H" they look more like |-|. Additionally I only want some of the columns to have this and not all of them (for example columns 1 to 3 of a 4 column table. I could do this if I used FIXED width tables using \rule but it requires a width parameter and I haven't been able to figure out how to make the width adjust to whatever the width of the column ends up being.

Possible avenues might be to use \rule in a way I haven't tried. Or to modify \cline so it doesn't span the whole column.


Well it is possible, but one would have to think about a suitable interface to set the percentage:


some longer text & an some more\\\cpartline{1-1}\cpartline{2-2}
blb & blb\\\cpartline{1-2}

enter image description here

  • I tested this and it seems to work great. Unfortunately it's beyond my tex understanding to know how it's working. Quick question, should the second \makeatletter be a \makeatother? Also, if you are feeling frisky adding "left only gap" and "right only gap" commands would complete the possibilities, making your commands also useful for data spanning multiple columns, for instance. – Dr. Person Person II Mar 10 '16 at 18:32
  • 1
    Yes it should have been \makeatother. Also I got the math wrong. I have 5 \hfill where 3 draw a line (the leaders line) which gives 60% and not 75%. You need a relation of 2 simple \hfill and 6 "leader \hfill". – Ulrike Fischer Mar 10 '16 at 18:42
  • I ended up using a fixed space on each side rather than a percent (by replacing the leading and trailing \hfill with \kern4pt which means I only need one of the \leaders lines). Worked fantastic. I cannot thank you enough for your answer and am quite jealous of your tex-fu. – Dr. Person Person II Mar 11 '16 at 18:57

You can leave some space before and after the column, then use a cline{<>} command to skip horizontal rules within the extra empty columns. To achieve the desired percentage, (75%) for example, you should fine tune the empty column-width, @{ }.

\begin{tabular}{|*3{c@{ }c@{ }c|} c|}\hline 
& c11 & & & c12 & & & c13 & & c14 \\ \cline{2-2}\cline{5-5}\cline{8-8}\cline{10-10} 
& c21 & & & c22 & & & c23 & & c24 \\ \cline{2-2}\cline{5-5}\cline{8-8}\cline{10-10} 
& c31 & & & c32 & & & c33 & & c34 \\ \cline{2-2}\cline{5-5}\cline{8-8}\cline{10-10} 
& c41 & & & c42 & & & c43 & & c44 \\ \hline 

enter image description here

  • This is an interesting idea. This one would be harder to implement for my tables and since Ulrike Fischer's answer also works I accepted it, at least for now. Thank you. – Dr. Person Person II Mar 10 '16 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.