2

I have the code for a table. What is the default thickness for the lines? I would like to double the thickness for the vertical line to distinguish the "total column", and I would like to double the thickness for the horizontal line to distinguish the "total row." (I guess that I should make the line separating the title thicker, too.)

\documentclass{amsart}

\begin{document}
\noindent \hspace*{\fill}
\begin{tabular}{|| c | c | c | c ||} \hline
\multicolumn{4}{|| c ||}{{\bf Residents of Preston City}} \\ \hline
        &   Employed    &   Unemployed  &   Total \\ \hline
Men     &   27,000      &               &          \\ \hline
Women   &               &               &   21,500 \\ \hline
Total   &   48,000      &               &   50,500 \\ \hline
\end{tabular}
\hspace{\fill} 

\end{document}
  • 1
    How about just using a booktabs approach? – Werner May 6 '15 at 19:41
  • I agree with @Werner. Consider getting rid of the vertical rules and most of the horizontal ones. The table will be more readable (although I understand why people think it's the opposite). – Alenanno May 6 '15 at 20:03
  • @Alenanno I am making a review for a standardized test. The rows and columns on this standardized test are always separated by horizontal and vertical lines. (I did look at the web site that Werner referenced. Now I know that making thicker lines on a table cannot be done with LaTeX.) – user74973 May 7 '15 at 18:54
6

You can use makecell, which has \Xhline{thickness} and \Xcline{thickness}{col1-col2} commands.

Alternatively, the boldline package, from the shipunov bundle, has \hlineBand \clineB commands; the argument is num times \arrayrulewidth. It also has a V{num} specifier for vertical rules, which replaces |.

By the way, the default \arrayrulewidth is 0.4pt.

Demo of both solutions:

\documentclass{amsart}
\usepackage{makecell}
\usepackage{boldline}
\setcellgapes{3pt}

\begin{document}
\noindent \hspace*{\fill}
\begin{center}
  \makegapedcells
  \begin{tabular}{|| c | c | c !{\vrule width0.8pt}c ||}
    \hline
    \multicolumn{4}{|| c ||}{{\bf Residents of Preston City}} \\
    \hline
          & Employed & Unemployed & Total \\
    \hline
    Men & 27,000 & & \\
    \hline
    Women & & & 21,500 \\
    \Xhline{0.8pt}
    Total & 48,000 & & 50,500 \\
    \hline
  \end{tabular}

  \vskip3ex
  \begin{tabular}{|| c | c | c V{2}c ||}
    \hline
    \multicolumn{4}{|| c ||}{{\bf Residents of Preston City}} \\
    \hline
          & Employed & Unemployed & Total \\
    \hline
    Men & 27,000 & & \\
    \hline
    Women & & & 21,500 \\
    \hlineB{2}
    Total & 48,000 & & 50,500 \\
    \hline
  \end{tabular}
\end{center}

\end{document} 

enter image description here

  • What is \setcellgapes{3pt}? I got an error when I had TikZ compile the code without this in the preamble. – user74973 May 7 '15 at 19:59
  • 1
    It defines a vertical padding of 3pt at the top and bottom of cells (you surely noticed vertical spacing is often too tight. This is one of the ways to circumvent this problem). You make it active for a given table adding \makegapedcells before the table begins. Normally, it has nothing to do with TikZ. – Bernard May 7 '15 at 20:04

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.