# Drawing a thick line through rows of a table to separate first column from second column

I have code for a table to be drawn. It is almost what I want. I am requesting three modifications to be made to it.

I would like vertical lines, forming the left and right edges of the table, to be drawn. These lines together with the horizontal line above the title and the horizontal line after the last row of the table should make a rectangle.

There are two vertical lines separating the three columns. I would like the vertical line separating the first column from the other two columns to be either 1.5 times thicker than the vertical line separating the second and third column and the vertical lines forming the left and right edges of the table. (In the code provided, two parallel lines drawn close to each other separate the first and second columns.)

The data - certain percentages - should be horizontally centered in their rows.

\documentclass{amsart}

\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\begin{center}
\begin{tabular}{l||r|r}
\hline
\multicolumn{3}{c}{\textbf{---Title is Lengthy --- Here is First Line}}\\
\multicolumn{3}{c}{\textbf{Here is Second Line}} \\ \hline\hline
\textbf{Class}&\multicolumn{1}{C{1.5in}|}{\textbf{Percent Present in Habitat A}}&\multicolumn{1}{C{1.75in}}{\textbf{Percent Present in Habitat B}}\\\hline

\textbf{Mammals}                        &                   &               \\
\hspace*{1em}Dog                        &   20\%            &   5\%         \\
\hspace*{1em}Cow                        &   10\%            &   7\%         \\ \hline
\textbf{Bird}                           &                   &               \\
\hspace*{1em}Peacock                    &   15\%            &   25\%        \\ \hline
\hspace*{1em}Turkey                     &   25\%            &   40\%        \\ \hline
\textbf{Animals}                        &   \textbf{3\%}    &   \textbf{5\%}    \\
\hline
\end{tabular}
\end{center}

\end{document}


For the thicker vertical line, you have the boldline package which does exactly what you want, with syntax V{num} in the table preamble to obtain a vertical rule with thickness num times \arrayrulewidth.

Other than that, I simplified a bit your code, and propose two variants,– the second with the \thead command, from makecell, which allows for line breaks within standard columns and a common formatting. Furthermore, the content of \thead is centred by default, both vertically and horizontally.

\documentclass{amsart}

\usepackage{array}
\usepackage{boldline}\usepackage{makecell}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\setlength{\extrarowheight}{3pt}

\begin{document}

\begin{center}
\begin{tabular}{|lV{1.5}c|c|}
\hline
\multicolumn{3}{|c|}{\textbf{---Title is Lengthy --- Here is First Line}}\\
\multicolumn{3}{|c|}{\textbf{Here is Second Line}} \\ \hline\hline
\textbf{Class}&\multicolumn{1}{C{1.5in}|}{\textbf{Percent Present in Habitat A}}&\multicolumn{1}{C{1.75in}|}{\textbf{Percent Present in Habitat B}}\\\hline

\textbf{Mammals} & & \\
\quad Dog & 20\% & 5\% \\
\quad Cow & 10\% & 7\% \\ \hline
\textbf{Bird} & & \\
\quad Peacock & 15\% & 25\% \\ \hline
\quad Turkey & 25\% & 40\% \\ \hline
\textbf{Animals} & \textbf{3\%} & \textbf{5\%} \\
\hline
\end{tabular}
\end{center}
\vskip 1cm

\begin{center}
\begin{tabular}{|lV{1.5}c|c|}
\hline
\multicolumn{3}{|c|}{\thead{---Title is Lengthy --- Here is First Line\\ Here is Second Line}} \\ \hline\hline
\textbf{Class}&\thead{Percent Present in \\ Habitat A} &\thead{Percent Present in \\ Habitat B}\\\hline

\textbf{Mammals} & & \\
\quad Dog & 20\% & 5\% \\
\quad Cow & 10\% & 7\% \\ \hline
\textbf{Bird} & & \\
\quad Peacock & 15\% & 25\% \\ \hline
\quad Turkey & 25\% & 40\% \\ \hline
\textbf{Animals} & \textbf{3\%} & \textbf{5\%} \\
\hline
\end{tabular}
\end{center}

\end{document}


To have an unboxed title, and a bigger vertical spacing between the title and the first horizontal line, you can use this code:

    \begin{tabular}{|lV{1.5}c|c|}
\multicolumn{3}{c}{\thead{---Title is Lengthy --- Here is First Line\\ Here is Second Line}} \\
\noalign{\vspace{2ex}}\hline
\textbf{Class}&\thead{Percent Present in \\ Habitat A} & \thead{Percent Present in \\ Habitat B}\\ \hline
\textbf{Mammals} & & \\
\quad Dog & 20\% & 5\% \\
\quad Cow & 10\% & 7\% \\ \hline
\textbf{Bird} & & \\
\quad Peacock & 15\% & 25\% \\ \hline
\quad Turkey & 25\% & 40\% \\ \hline
\textbf{Animals} & \textbf{3\%} & \textbf{5\%} \\
\hline
\end{tabular}


• That is the display that I want. Jan 15, 2019 at 22:55
• Which one, out of curiosity? Jan 15, 2019 at 22:56
• Wait a moment, I'll post an example. Jan 15, 2019 at 23:06
• I've posted an example. Is it more or less like you want? Jan 15, 2019 at 23:22
• It is used to insert things between two rows, which do not have to be aligned within a column. Jan 16, 2019 at 0:04