LaTeX top row on a stem and leaf plot table
I am trying to represent a stem and leaf plot in a tabular environment in LaTeX using the following:
\begin{table}[htbp]
\centering
\caption{Stem Plot of sit ups, Key: $1 | 1= 1.1$}
\begin{tabular}{r|l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}}
\multirow{2}{*}{} Stem & Leaf \\
\hline
1 &开发者_Go百科; 1 & 1 & 2 & 3 & 3 & 4 & 4 & & \\
1 & 5 & 6 & 6 & 8 & & & & & \\
2 & 0 & 3 & & & & & & & \\
2 & 7 & 8 & & & & & & & \\
3 & & & & & & & & & \\
3 & 5 & 7 & 8 & 8 & & & & & \\
4 & 0 & 0 & 0 & 1 & 2 & 4 & 4 & 4 & \\
4 & 5 & 5 & 6 & 7 & 7 & 7 & 8 & 8 & 9 \\
\end{tabular}
\label{tab:addlabel}
\end{table}
But when I do this, the 2nd column has is too wide and there is a gap between the 2nd and 3rd column of leaf values. How can I make it so that the 'Leaf' cell overlaps into the next column or somehow remove the gap?
You can put Leaf
into a \multicolumn{9}{l}{Leaf}
. The number (9
here) gives how many columns that should span, the l
gives the formatting of the cell. If you need a right bar, you have to use l|
there, by the way.
You do not need the \multirow
then, I think.
\begin{table}[htbp]
\centering
\caption{Stem Plot of sit ups, Key: $1 | 1= 1.1$}
\begin{tabular}{r|l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}l@{\hspace{4 pt}}}
Stem & Leaf \\
\hline
1 & 1 1 2 3 3 4 4\\
1 & 5 6 6 8\\
2 & 0 3\\
2 & 7 8\\
3 &\\
3 & 5 7 8 8\\
4 & 0 0 0 1 2 4 4 4\\
4 & 5 5 6 7 7 7 8 8 9 \\
\end{tabular}
\label{tab:addlabel}
\end{table}
\multirow
and \multicolumn
somehow mess up the first row when used.
精彩评论