2

This is a table where is shown an exercise on long division. The grid needs to look like a notebook. I have one problem with column width in the table, depending on the character shown, the column width changes. It is wider when the remainder "R" is shown, and narrower in the column with the ")"

I've tried some ways to solve this issue, but all of them are not compatible with the packages or the code.

Please, I need a clue of how to fix this problem.

Long Division Grid

\documentclass[twoside, 12pt]{article}
\usepackage[hmargin=0.75in, vmargin=0.5in, includeheadfoot, headheight=10mm, headsep=4mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage[table]{xcolor}
\usepackage{pslatex}
\usepackage{booktabs}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.0pt}

\definecolor{bluegray}{rgb}{0.90, 0.90, 1.0}
\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}
\def\Hline{\arrayrulecolor{bluegray}\specialrule{1pt}{0pt}{0pt}}
\arrayrulecolor{bluegray}

\begin{document}
\begin{tabular}{ccc}
\begin{minipage}[c][4.0in][t]{2.33333333333in}
\setlength{\tabcolsep}{2pt}

\begin{tabular}{
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}}
\Hline
\textcolor{red}{ } & \textcolor{red}{ } &  & \textcolor{red}{ } & \textcolor{red}{ } & \textcolor{red}{9} & \textcolor{red}{2}\\ \Hline
\arrayrulecolor{black}
\cline{3-7}
\arrayrulecolor{bluegray}
9 & 7 & ) & 8 & 9 & 4 & 6 \\ \Hline
  &   & - & 0 &   &   &   \\ \Hline
\arrayrulecolor{black}
\cline{4-4}
\arrayrulecolor{bluegray}
  &   &   & 8 & 9 &   &   \\ \Hline
  &   &   & - & 0 &   &   \\ \Hline
\arrayrulecolor{black}
\cline{5-5}
\arrayrulecolor{bluegray}
  &   &   & 8 & 9 & 4 &   \\ \Hline
  &   & - & 8 & 7 & 3 &   \\ \Hline
\arrayrulecolor{black}
\cline{4-6}
\arrayrulecolor{bluegray}
  &   &   &   & 2 & 1 & 6 \\ \Hline
  &   &   & - & 1 & 9 & 4 \\ \Hline
\arrayrulecolor{black}
\cline{5-7}
\arrayrulecolor{bluegray}
  &   &   &   & R & 2 & 2 \\ \Hline
\end{tabular}
\end{minipage}
\end{tabular}
\end{document}
4

I suggest you

  • insert the instruction \hphantom{0} in the third cell of the first row and

  • load the mathtools package in the preamble and replace the R in the final row with $\mathclap{\text{R}}$.

Optional: replace the four - (minus) symbols with $\mathclap{-}$.

enter image description here

\documentclass[twoside, 12pt]{article}
\usepackage[hmargin=0.75in, vmargin=0.5in, includeheadfoot, headheight=10mm, headsep=4mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage[table]{xcolor}
\usepackage{pslatex}
\usepackage{booktabs}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.0pt}

\definecolor{bluegray}{rgb}{0.90, 0.90, 1.0}
\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}
\def\Hline{\arrayrulecolor{bluegray}\specialrule{1pt}{0pt}{0pt}}
\arrayrulecolor{bluegray}

\usepackage{mathtools}

\begin{document}
\begin{tabular}{ccc}
\begin{minipage}[c][4.0in][t]{2.33333333333in}
\setlength{\tabcolsep}{2pt}

\begin{tabular}{
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}c
!{\color{bluegray}\VRule[1pt]}}
\Hline
 &  & \hphantom{0} &  & & \textcolor{red}{9} & \textcolor{red}{2}\\ \Hline
\arrayrulecolor{black}
\cline{3-7}
\arrayrulecolor{bluegray}
9 & 7 & ) & 8 & 9 & 4 & 6 \\ \Hline
  &   & $\mathclap{-}$ & 0 &   &   &   \\ \Hline
\arrayrulecolor{black}
\cline{4-4}
\arrayrulecolor{bluegray}
  &   &   & 8 & 9 &   &   \\ \Hline
  &   &   & $\mathclap{-}$ & 0 &   &   \\ \Hline
\arrayrulecolor{black}
\cline{5-5}
\arrayrulecolor{bluegray}
  &   &   & 8 & 9 & 4 &   \\ \Hline
  &   & $\mathclap{-}$ & 8 & 7 & 3 &   \\ \Hline
\arrayrulecolor{black}
\cline{4-6}
\arrayrulecolor{bluegray}
  &   &   &   & 2 & 1 & 6 \\ \Hline
  &   &   & $\mathclap{-}$ & 1 & 9 & 4 \\ \Hline
\arrayrulecolor{black}
\cline{5-7}
\arrayrulecolor{bluegray}
  &   &   &   & $\mathclap{\text{R}}$ & 2 & 2 \\ \Hline
\end{tabular}
\end{minipage}
\end{tabular}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.