# Vertical/Horizontal Rules in TabularX

I am trying to help kids identify whole numbers vs mixed numbers vs proper fractions vs improper fractions. I am having them practice using this table which needs two fixes.

1. Vertical rules between the 10 middle columns.
2. The horizontal rule going the entire way.

I tried putting a | in various places in the \begin{tabularx} line, but then it didn't compile. And I have no idea why the horizontal rules are not going the entire way. How do I fix these things?

\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{amssymb}
\newcolumntype{C}{>{\centering\arraybackslash}m{#1}}

\begin{document}

Classify the following numbers as whole, a proper fraction, an improper fraction, or a mixed number.

\begin{tabularx}{13cm}{|C{1.5cm}|*{10}{C{0.7cm}}|X|}

\hline
Number Type & $$\frac{1}{3}$$ & $$10$$ & $$5\frac{2}{7}$$ & $$\frac{2}{9}$$ & $$\frac{10}{7}$$ & $$2$$ & $$0$$ & $$1\frac{1}{2}$$ & $$3\frac{4}{5}$$ & $$\frac{8}{8}$$ & $$\frac{3}{1}$$ \\

\hline
Whole &  &  &  &  &  &  &  &  &  &  &  \\

\hline
Proper & \checkmark  &  &  &  &  &  &  &  &  &  &  \\

\hline
Improper &  &  &  &  &  &  &  &  &  &  &  \\

\hline
Mixed &  &  &  &  &  &  &  &  &  &  &  \\

\hline
\end{tabularx}

\end{document}

• Replace |*{10}{C{0.7cm}} by *{10}{|C{0.7cm}} and compile at least twice for the horizontal rules.
– cfr
Dec 19, 2015 at 23:54
• Also, if your table is too wide, even with the X column at the end, the X will not magically shrink it, but the rules will only be the width specified for the table.
– cfr
Dec 19, 2015 at 23:55

Here is a solution. I redefine tabularx columns to incorporate the features of your C column type, ans set tabularx wdth to \linewidth:

\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{amssymb, amsmath, nccmath}
\renewcommand\tabularxcolumn{>{\centering\arraybackslash}m{#1}}

\begin{document}

Classify the following numbers as whole, a proper fraction, an improper fraction, or a mixed number.
\begin{center}\renewcommand\arraystretch{1.25}
\begin{tabularx}{\linewidth}{|m{1.5cm}|*{11}{X|}}
\hline
Number Type & $$\mfrac{1}{3}$$ & $$10$$ & $$5\frac{2}{7}$$ & $$\mfrac{2}{9}$$ & $$\mfrac{10}{7}$$ & $$2$$ & $$0$$ & $$1\frac{1}{2}$$ & $$3\frac{4}{5}$$ & $$\mfrac{8}{8}$$ & $$\mfrac{3}{1}$$ \\
\hline
Whole & & & & & & & & & & & \\
\hline
Proper & \checkmark & & & & & & & & & & \\
\hline
Improper & & & & & & & & & & & \\
\hline
Mixed & & & & & & & & & & & \\
\hline
\end{tabularx}
\end{center}

\end{document} • Whoa. This \linewidth thing looks awesome... I can't believe I haven't used this before! Thank you! Dec 24, 2015 at 3:35