# LaTeX table floating problem

Table unnecessarily floats to next page. I want it to be placed where it is specified.

\renewcommand{\familydefault}{\sfdefault}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[scaled=1]{helvet}
\usepackage[helvet]{sfmath}
\usepackage{graphicx}
\setcounter{chapter}{0}
\frontmatter
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\begin{document}
\chapter{Exponents}
\begin{multicols}{2}
\renewcommand{\theenumii}{\Alph{enumii}}
\begin{enumerate}
\item
\begin{table*}[!htbp]
\begin{tabular}{cc|c|c|c|c}
\cline{3-5}
&        & \multicolumn{3}{c|}{Course}       &
\\ \cline{3-6}
&        & Algebra I & Geometry & Algebra II & \multicolumn{1}{c|}
{Total} \\ \hline
\multicolumn{1}{|c|}{\multirow{2}{*}{Gender}} & Female & 35        & 53       & 62         & \multicolumn{1}{c|}{150}   \\ \cline{2-6}
\multicolumn{1}{|c|}{}                        & Male   & 44        & 59       & 57         & \multicolumn{1}{c|}{160}   \\ \hline
\multicolumn{2}{|c|}{Total}                            & 79        & 112      & 119        & \multicolumn{1}{c|}{310}   \\ \hline
\end{tabular}
\end{table*}
A group of tenth-grade students responded to a survey that asked which math
course they were currently enrolled in. The survey data were broken down as
she able above. Which of the following categories accounts for approximately
19 percent of all the survey respondents?
\begin{enumerate}
\item   Females taking Geometry
\item   Females taking Algebra II
\item   Males taking Geometry
\item   Males taking Algebra I
\end{enumerate}
\item
Which of the following expressions is equivalent to
$\sqrt[3]{a}\cdot a \cdot \sqrt[5]{a^2}$  for $a > 0$ ?
\\
\begin{enumerate}
\item $a^\frac{2}{15}$\\
\item $a^\frac{6}{15}$\\
\item $a^\frac{11}{15}$\\
\item $a^\frac{26}{15}$\\
\end{enumerate}
\item
$$\sqrt{16y^2}$$
If $x>0$, which of the following is equivalent to the given expression?\\
\begin{enumerate}
\item $4y$\\
\item $4y^2$\\
\item $32y$\\
\item $32y^2$\\
\end{enumerate}
\end{enumerate}
\end{multicols}
\end{document}

• Your example doesn't use \begin{table}, but you probably mean why doesn't that work where you have used tabular. The table environment is a "float" -- it is meant to be independent of the location where it is input, and can move around to where it fits best in the document (usually on the same or the next page), It doesn't make sense within a list since it will not end up where it is input. Using tabular is the best approach in this situation. – barbara beeton Feb 28 at 3:53
• thanks for your prompt reply, can we fix the issue of overlapping table content – Praveen25488 Feb 28 at 3:56
• You haven't said what document class you're using, but presumably the table is wider than the column. Since you said that it does fit in a full-width page, you might want to enter it separately with table*, give it a caption and a label, and say "see Table \ref{<label value>}" at the item. – barbara beeton Feb 28 at 4:03
• If you want to use floats, do not use the multicol package but the twocolumn option in the document class. To fit the table in the column, use a smaller font inside the float (e.g.: \tiny), and/or remove the perfectly useless column "Gender", or use a float for two columns (i.e.,table* instead of table). – Fran Feb 28 at 4:12
• unrelated but all the \\  around and inside the enumerate are wrong and should be removed, and  should not be used in latex and should be $...$ – David Carlisle Feb 28 at 7:49

My answer focuses one just one aspect of your posting: How to make the tabular material fit inside the width of a column.

You haven't indicated which document class, which font size, or which page and text block dimensions you employ. The following solutioin may thus not fully meet your formatting needs. If it does not, feel free provide more details regarding the missing pieces of information.

The following screenshot shows both your original tabular environment, with lots and lots of vertical and horizontal lines, as well as a proposed new tabular* environment. The former is obviously much wider than \columnwidth. The latter environment takes up much less horizontal space, mainly because it gets by with 5 instead of 6 columns. Conversely, the newly proposed solution (a) aligns the numbers on their respective (implicit) decimal markers and (b) strives to provide a much more "open" look, mainly by omitting all vertical lines and employing fewer, but well-spaced horizontal lines. The second solution also aims to provide an informative caption.

\documentclass[twocolumn]{article}  % ?
\renewcommand{\familydefault}{\sfdefault}
\usepackage{booktabs,siunitx,multirow}
\usepackage[skip=0.333\baselineskip]{caption} % optional
\begin{document}

\begin{table}

\caption{Original solution}
\begin{tabular}{cc|c|c|c|c}
\cline{3-5}
&        & \multicolumn{3}{c|}{Course}       &
\\ \cline{3-6}
&        & Algebra I & Geometry & Algebra II & \multicolumn{1}{c|}
{Total} \\ \hline
\multicolumn{1}{|c|}{\multirow{2}{*}{Gender}} & Female & 35        & 53       & 62         & \multicolumn{1}{c|}{150}   \\ \cline{2-6}
\multicolumn{1}{|c|}{}                        & Male   & 44        & 59       & 57         & \multicolumn{1}{c|}{160}   \\ \hline
\multicolumn{2}{|c|}{Total}                            & 79        & 112      & 119        & \multicolumn{1}{c|}{310}   \\ \hline
\end{tabular}

\vspace{1cm}

\caption{Student enrolments, by gender and course}
\setlength\tabcolsep{0pt} % make LaTeX figure out amount of inter-column whitespace
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}l *{4}{S[table-format=3.0]}}
\toprule
Gender & \multicolumn{3}{c}{Course} & {Total} \\
\cmidrule{2-4}
& {Algebra I} & {Geometry} & {Algebra II} \\
\midrule
Female & 35 & 53 &  62 & 150 \\
Male   & 44 & 59 &  57 & 160 \\
Total  & 79 &112 & 119 & 310 \\
\bottomrule
\end{tabular*}

\end{table}
\end{document}