I'm trying to make output that looks like the following:
Code: Select all
3
10
x 2.5
-----
45
Code: Select all
3 \times 10 \times 2.5 = 45
Code: Select all
3
10
x 2.5
-----
45
Code: Select all
3 \times 10 \times 2.5 = 45
NEW: TikZ book now 40% off at Amazon.com for a short time.
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{booktabs,dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}
\begin{alignat*}{2}
\quad & & 3 \\
\times &\quad& 10 \\
\times &\quad& 1.5 \\ \cline{1-3}
& & 45
\end{alignat*}
\[
\begin{array}{@{}cd{2.1}@{}}
& 3 \\
\times & 10 \\
\times & 1.5 \\ \midrule
& 45
\end{array}
\]
\end{document}
Code: Select all
\begin{tabular}{l r}
& 345\\
+& 456\\
\hline
& 801
\end{tabular}
NEW: TikZ book now 40% off at Amazon.com for a short time.