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
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
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}
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