[Tex/LaTex] Making a thick vertical line in a table

tables

I have a table that needs some edits. First, I would like a thick vertical line separating the first column from the remaining four columns. Second, I want "Percentage of base in organism's DNA" typeset on two lines. Third, "Organism" should be centered among three rows – two for "Percentage of base in organism's DNA" and one for the row containing "adenine," "guanine," "cytosine," and "thymine."

Why are there three vertical bars on the left edge of the table? Why is the "||" missing in the second row along the right edge? If I wanted the data in the first column, excluding the word "Organism," to be aligned on the left edge, how would I modify the code?

\documentclass[10pt]{amsart}


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


\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}



\begin{document}

\makegapedcells
\begin{tabular}{||!{\vrule width0.8pt}c | c | c | c | c||} \hline
\multicolumn{5}{|| c ||}{\textbf{Base Composition of DNA}} \\ \hline
Organism        &\multicolumn{4}{|| c ||}{Percentage of base in organism's DNA} \\ \hline
                &   adenine     &   guanine &   cytosine    &   thymine \\ \hline
Maize           &   26.8\%      &   22.8\%  &   23.2\%      &   27.2\% \\ \hline
Octopus         &   33.2\%      &   17.6\%  &   17.6\%      &   31.6\% \\ \hline
Chicken         &   28.0\%      &   22.0\%  &   21.6\%      &   28.4\% \\ \hline
Rat             &   28.6\%      &   21.4\%  &   20.5\%      &   28.4\% \\ \hline
Human           &   29.3\%      &   20.7\%  &   20.0\%      &   30.0\% \\ \hline
Grasshopper     &   29.3\%      &   20.5\%  &   20.7\%      &   29.3\% \\ \hline
Sea urchin      &   32.8\%      &   17.7\%  &   17.3\%      &   32.1\% \\ \hline
Wheat           &   27.3\%      &   22.7\%  &   22.8\%      &   27.1\% \\ \hline
Yeast           &   31.3\%      &   18.7\%  &   17.1\%      &   32.9\% \\ \hline
{\em E. coli}   &   24.7\%      &   26.0\%  &   25.7\%      &   23.6\% \\ \hline
\end{tabular}

\end{document}

Best Answer

You can use V{...} for thicker vertical rules.

\documentclass[10pt]{amsart}

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

\setlength{\textwidth}{6.1in}
\setlength{\textheight}{9in}
\calclayout

\begin{document}

\makegapedcells
\begin{tabular}{|| c V{3} c | c | c | c||} \hline
\multicolumn{5}{|| c ||}{\textbf{Base Composition of DNA}} \\ \hline
Organism        &\multicolumn{4}{ c ||}{Percentage of base in organism's DNA} \\ \hline
                &   adenine     &   guanine &   cytosine    &   thymine \\ \hline
Maize           &   26.8\%      &   22.8\%  &   23.2\%      &   27.2\% \\ \hline
Octopus         &   33.2\%      &   17.6\%  &   17.6\%      &   31.6\% \\ \hline
Chicken         &   28.0\%      &   22.0\%  &   21.6\%      &   28.4\% \\ \hline
Rat             &   28.6\%      &   21.4\%  &   20.5\%      &   28.4\% \\ \hline
Human           &   29.3\%      &   20.7\%  &   20.0\%      &   30.0\% \\ \hline
Grasshopper     &   29.3\%      &   20.5\%  &   20.7\%      &   29.3\% \\ \hline
Sea urchin      &   32.8\%      &   17.7\%  &   17.3\%      &   32.1\% \\ \hline
Wheat           &   27.3\%      &   22.7\%  &   22.8\%      &   27.1\% \\ \hline
Yeast           &   31.3\%      &   18.7\%  &   17.1\%      &   32.9\% \\ \hline
{\em E. coli}   &   24.7\%      &   26.0\%  &   25.7\%      &   23.6\% \\ \hline
\end{tabular}

\end{document}

enter image description here

Don't set \oddsidemargin, \evensidemargin and \topmargin; use \calclayout, with AMS classes.

Alternative code for breaking the long header into two lines and for removing the rule below “Organism”.

\begin{tabular}{|| c V{3} c | c | c | c||} \hline
\multicolumn{5}{|| c ||}{\textbf{Base Composition of DNA}} \\ \hline
Organism        & \multicolumn{4}{ c ||}{%
                    \begin{tabular}{@{}c@{}}
                    Percentage of base\\
                    in organism's DNA
                    \end{tabular}%
                  } \\ \cline{2-5}
                &   adenine     &   guanine &   cytosine    &   thymine \\ \hline
Maize           &   26.8\%      &   22.8\%  &   23.2\%      &   27.2\% \\ \hline
Octopus         &   33.2\%      &   17.6\%  &   17.6\%      &   31.6\% \\ \hline
Chicken         &   28.0\%      &   22.0\%  &   21.6\%      &   28.4\% \\ \hline
Rat             &   28.6\%      &   21.4\%  &   20.5\%      &   28.4\% \\ \hline
Human           &   29.3\%      &   20.7\%  &   20.0\%      &   30.0\% \\ \hline
Grasshopper     &   29.3\%      &   20.5\%  &   20.7\%      &   29.3\% \\ \hline
Sea urchin      &   32.8\%      &   17.7\%  &   17.3\%      &   32.1\% \\ \hline
Wheat           &   27.3\%      &   22.7\%  &   22.8\%      &   27.1\% \\ \hline
Yeast           &   31.3\%      &   18.7\%  &   17.1\%      &   32.9\% \\ \hline
{\em E. coli}   &   24.7\%      &   26.0\%  &   25.7\%      &   23.6\% \\ \hline
\end{tabular}

enter image description here


You can easily make a better table by omitting all vertical rules; double rules and thicker ones serve no purpose whatsoever. Also repeating % in every cell is a waste, because the columns are already stated to contain percentages.

\documentclass[10pt]{amsart}

\usepackage{booktabs,siunitx}

\setlength{\textwidth}{6.1in}
\setlength{\textheight}{9in}
\calclayout

\begin{document}

\begin{tabular}{
 @{}
 l
 *{4}{S[table-format=2.1]}
 @{}
}
\toprule
\multicolumn{5}{c}{\textbf{Base Composition of DNA}} \\
\midrule
Organism        &\multicolumn{4}{c}{Percentage of base in organism's DNA} \\
\cmidrule(l){2-5}
                &   {adenine} &   {guanine} &   {cytosine}    &   {thymine} \\
\midrule
Maize           &   26.8      &   22.8  &   23.2      &   27.2 \\
Octopus         &   33.2      &   17.6  &   17.6      &   31.6 \\
Chicken         &   28.0      &   22.0  &   21.6      &   28.4 \\
Rat             &   28.6      &   21.4  &   20.5      &   28.4 \\
Human           &   29.3      &   20.7  &   20.0      &   30.0 \\
Grasshopper     &   29.3      &   20.5  &   20.7      &   29.3 \\
Sea urchin      &   32.8      &   17.7  &   17.3      &   32.1 \\
Wheat           &   27.3      &   22.7  &   22.8      &   27.1 \\
Yeast           &   31.3      &   18.7  &   17.1      &   32.9 \\
{\em E. coli}   &   24.7      &   26.0  &   25.7      &   23.6 \\
\bottomrule
\end{tabular}

\end{document}

enter image description here