3

I am wanting to make custom example problems of addition/subtraction/multiplication/long division by hand. I have no faith in word's equation editor (fun fact, it doesn't have the long division symbol!).

I can't find any decent examples. I am perfectly fine with writing something in LaTeX and then saving the image for a word doc. Can anyone show me some good examples how I could write out problems likes this? (taken from the slides provided by my class' book publisher Hawkes Learning. Preparation for College Mathematics by Wright 3rd edition)

(The coloring is not important, if I can figure out this basic structure I can handle changing colors. Sorry about the image sizes)

Addition Example Subtraction Example Multiplication Example Long Division Example

7
  • 3
    Please add a short, but compilable test file which allows us to reproduce the problem. It should include a class, the necessary packages and a document environment. Commented Oct 13 at 21:07
  • 3
    This question is similar to: How to present a vertical multiplication/addition. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Oct 13 at 21:10
  • Note that slides provide more options wrt step-by-step operations, altough the process is more difficult than a simple finished product. See tex.stackexchange.com/questions/547290/… for example. Commented Oct 14 at 0:29
  • 1
    While the question is in part similar to tex.stackexchange.com/questions/11702/… , it is not a duplicate since not all the constructions requested here are addressed in that question. I propose to keep it open. Commented Oct 14 at 7:36
  • 1
    @quarague No I didn't misunderstand the question. Even if the OP does not know how to do this, they can provide a simple test document with a class and \begin/\end{document}. Every latex user can do this. This saves the people willing to help from having to type these boring things. Commented Oct 15 at 7:46

3 Answers 3

7

I suggest to use longdivision package (for example for the divisions).

enter image description here

\documentclass{article}
\usepackage{longdivision}
\begin{document}
\begin{center}
\longdivision{64170}{62}
\end{center}
\end{document}

In general I suggest to use xlop package: Calculates and displays arithmetic operations.

https://ctan.org/pkg/xlop

7

Here is an attempt to display subtraction with carry over digits, using standard LaTeX commands (together with the cancel package to show replacements in red color).

\documentclass{article}
\usepackage{xcolor}
\usepackage{cancel}
\renewcommand{\CancelColor}{\color{red}} 

\newcommand{\replc}[2]{\makebox[1em]{
\ensuremath{\stackrel{{\color{red}#2}}{\cancel{#1}}}}}

\newcommand{\replcc}[3]{\makebox[0pt]{
\ensuremath{\stackrel{{\stackrel{{\color{red}#3}}{{\color{red}\cancel{#2}}}}}{\cancel{#1}}}}}

\begin{document}

\[
\color{blue}
\begin{tabular}{lr} 
  & 1\replc{6}{5}. \replcc{7}{6}{16} \replc{1}{11} 5 \\
\hspace{-1.5ex}$-$ & 4. 8 2 3\\
\hline
  & \color{red} 1 1. 8 9 2
\end{tabular}
\]

\end{document}

enter image description here

The addition and multiplication examples are easier and don't require any additional packages. I didn't fine-tune the spacings; there is certainly an optimal way to do it for a more polished look, but hopefully this is good enough for starters.

\documentclass{article}
\usepackage{xcolor}

\begin{document}

\[
\color{blue}
\begin{tabular}{lr} 
  &  \color{red} \footnotesize 1 2 \phantom{.XXX} \\
  & 56.2{\color{green} 00} \\
  & 85.75{\color{green}0} \\
\hspace{-1.5ex}$+$  & 29.001 \\
\hline
  & \color{red} 170.951
\end{tabular}
\]

\[
\color{blue}
\begin{tabular}{l @{} r}    
  & 2.4 3 2 \\
\hspace{-1.5ex}$\times$ & 5.1\\
\hline
 & \color{black} 2 4 3 2\\
 & \color{black} 1 2 1 6 0 0 \\
\hline
  & \color{red} 1 2.4 0 3 2
\end{tabular}
\]

\end{document}

enter image description here

1

I made the following a while ago for multiplication (FYI it's in mod 7)

LaTeX multiplication with carry

\documentclass{article}
\usepackage{tikz}
\usepackage{aligned-overset}
\begin{document}

\usetikzlibrary{matrix,fit}

\[
\begin{tikzpicture}[baseline=(M.center)]
  \matrix (M) [
    matrix of math nodes,
    nodes={minimum width=1.5em, minimum height=1.5em, inner sep=0pt, outer sep=0pt},
    column sep=0.1em, row sep=0em
  ]{
    % Row 1: multiplicand (9 digits) placed in cols 4–12
      {} & {} & {} &
      2 & 3 & 4 & 2 & 3 & 4 & 6 & 3 & 6 \\
    % Row 2: × and multiplier (10 digits) in cols 3–12
      {} & {} & \times &
      3 & 4 & 0 & 6 & 5 & 3 & 5 & 6 & 2 \\  
      % Row 4: first partial with embedded carries
     {} & {} & {} &
     \overset{\scriptscriptstyle1}{5} &
     \overset{\scriptscriptstyle1}{0} &
     \overset{}{1} &
     \overset{\scriptscriptstyle1}{5} &
     \overset{\scriptscriptstyle1}{0} &
     \overset{\scriptscriptstyle1}{2} &
     \overset{\scriptscriptstyle1}{6} &
     \overset{\scriptscriptstyle1}{0} &
     \overset{}{5} \\
% Row 4: first partial with embedded carries
     {} & {} & {} &
      &
      &
      &
      &
      &
     \ldots &
     \overset{\scriptscriptstyle 5}{0} &
     \overset{}{1} &
     {} \\
     {} & {} & {} &
      &
      &
      &
      &
      &
      &
     \vdots &
      &
      {}\\ 
  };
% horizontal rule under
    \draw[line width=0.4pt]
  (M-2-3.south west) -- (M-2-12.south east);
  \draw[line width=0.4pt]
  (M-5-3.south west) -- (M-5-12.south east);
  % Box the four entries in the rightmost column:
  \node[draw,thick,inner sep=0pt,fit=(M-1-12)(M-3-12)] {};
\end{tikzpicture}
\]

\end{document}

Full disclosure, I did use LLM assistance when I first cooked this up, but I have since then used this template for general multiplication problems.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.