General ⇒ Long Multiplication
Long Multiplication
http://mathworld.wolfram.com/LongMultiplication.html) and vertical form addition http://mathworld.wolfram.com/Addition.html but I don't know how to do this cleanly in Latex. I used \begin{array} but it doesn't looks very nice. Do you have any suggestions?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Long Multiplication
using tabular environments could be an option:
Code: Select all
\documentclass{article}
\usepackage{array}
% command that will typeset the carriage
% syntax: \mycarr{<value>} or \mycarr (default carriage=1)
\newcommand\mycarr[1][1]{\scriptstyle #1\rule{8pt}{0pt}}
\begin{document}
{\setlength\arrayrulewidth{.8pt}
\setlength\tabcolsep{4pt}
\begin{tabular}{*{5}{>{$}c<{$}}}
&& 3 & 8 & 4\\
\times &&& 5 & 6 \\\hline
& 2 & 3 & 0 & 4\\
1 & 9 & 2 & 0 &\\\hline
2 & 1 & 5 & 0 & 4
\end{tabular}}
\vspace{1cm}
{\setlength\arrayrulewidth{.8pt}
\setlength\tabcolsep{4pt}
\begin{tabular}{*{4}{>{$}c<{$}}>{$}l<{$}>{\bfseries}l}
& \mycarr & \mycarr && \leftarrow & carries\\[-4pt]
& 1 & 5 & 8 & \leftarrow & adddend1\\
+ & 2 & 4 & 9 & \leftarrow & adddend2 \\\cline{1-4}
& 4 & 0 & 7 & \leftarrow & sum\\
\end{tabular}}
\vspace{1cm}
{\setlength\arrayrulewidth{.8pt}
\setlength\tabcolsep{4pt}
\begin{tabular}{*{4}{>{$}c<{$}}>{$}l<{$}>{\bfseries}l}
& \mycarr[2] & \mycarr[2] & & \leftarrow & carries\\[-4pt]
& 9 & 9 & 9 & \leftarrow & adddend1\\
& & 9 & 9 & \leftarrow & adddend2\\
+ & & 9 & 9 & \leftarrow & adddend3 \\\cline{1-4}
1 & 1 & 9 & 7 & \leftarrow & sum\\
\end{tabular}}
\end{document}