Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to reproduce this table:

table with thick first vertical and horizontal lines

(apologies for the terrible cameraphone pic)

I don't know how to get the slightly thicker leftmost and topmost line.

Here's a minimal example of what I have so far:

\documentclass[a4paper,12pt]{article}

\begin{document}

\begin{tabular}{c|c|c|c|c|c}
    $*$ & $a$ & $b$ & $c$ & $d$ & $e$ \\\hline
    $a$ & $a$ & $b$ & $c$ & $b$ & $d$ \\\hline
    $b$ & $b$ & $c$ & $a$ & $e$ & $c$ \\\hline
    $c$ & $c$ & $a$ & $b$ & $b$ & $a$ \\\hline
    $d$ & $b$ & $e$ & $b$ & $e$ & $d$ \\\hline
    $e$ & $d$ & $b$ & $a$ & $d$ & $c$
\end{tabular}

\end{document}

Is there an easy way to make the leftmost and topmost lines thicker?

share|improve this question
1  
well your cam pic does have some nice colors! –  flow Aug 28 '13 at 13:10
    
@flow ... none of which appear on the page! Lovely, (: –  Harold Aug 28 '13 at 21:32
add comment

2 Answers

up vote 22 down vote accepted

You could define a thick version of \hline and a thick | as new column type as I did below. Both are based on the original code, only the thickness got changed from \arrayrulewidth to 1pt.

\documentclass[a4paper,png]{standalone}
\usepackage{array}

\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline
}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother


\begin{document}

\begin{tabular}{c"c|c|c|c|c}
    $*$ & $a$ & $b$ & $c$ & $d$ & $e$ \\\thickhline
    $a$ & $a$ & $b$ & $c$ & $b$ & $d$ \\\hline
    $b$ & $b$ & $c$ & $a$ & $e$ & $c$ \\\hline
    $c$ & $c$ & $a$ & $b$ & $b$ & $a$ \\\hline
    $d$ & $b$ & $e$ & $b$ & $e$ & $d$ \\\hline
    $e$ & $d$ & $b$ & $a$ & $d$ & $c$
\end{tabular}

\end{document}

Result

share|improve this answer
add comment

The package tabu provides such a modification by the optional arguments of the vertical line and the command \tabucline

\documentclass[a4paper,12pt]{article}
\usepackage{tabu}
\begin{document}

\begin{tabu}{c|[2pt]c|c|c|c|c}
    $*$ & $a$ & $b$ & $c$ & $d$ & $e$ \\\tabucline[2pt]{-}
    $a$ & $a$ & $b$ & $c$ & $b$ & $d$ \\\hline
    $b$ & $b$ & $c$ & $a$ & $e$ & $c$ \\\hline
    $c$ & $c$ & $a$ & $b$ & $b$ & $a$ \\\hline
    $d$ & $b$ & $e$ & $b$ & $e$ & $d$ \\\hline
    $e$ & $d$ & $b$ & $a$ & $d$ & $c$
\end{tabu}

\end{document}

However to produce nice tables avoid vertical lines and be spare with horizontal lines. For all this I recommend the package booktabs. Via google you will find a lot of examples.

share|improve this answer
    
Thank you for the super-fast and cogent response. I'm going to be typesetting a fair number of these tables which define binary operations on finite sets. Can you elaborate on how you think the appearance could be improved? Should this be a separate question? –  Harold Jan 20 '12 at 18:49
3  
This is possibly one case where rules may remain, as it's really a lattice and not a formal table. But I would avoid thick rules anyway. –  egreg Jan 20 '12 at 18:56
    
@Harold: My note depends on normal tables. For your binary tables I would work in the same way but I would also increase the space between the cells. –  Marco Daniel Jan 20 '12 at 21:18
    
@MarcoDaniel, good. Thanks. –  Harold Jan 20 '12 at 23:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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