答案1
以下是基于 的两种可能的乘法代码array
。第一个代码将变量的幂和符号对齐,第二个代码稍微简单一些,仅将变量的幂对齐:
\documentclass[11pt,a4paper]{article}
\usepackage{fourier}
\usepackage{array, multirow, booktabs}
\begin{document}
\[ \begin{array}{*{12}{@{}>{{}}r<{{}}@{}}}
& & \multirow{2.5}{*}{$ {}\times{} $} & & x^3 & + & x^2 & & & + & 2 \\[1ex]
& & & & & & x^2 & - & x & + & 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
& & & & x^3 & + & x^2 & & & + & 2 \\
& - & x^4 & - & x^3 & & & - & 2x & & \\
x^5 & + & x^4 & & & + & 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
x^5 & & & & & + & 3 x^2 & - & 2x & + & 2 \
\end{array}
\hspace{4em}
\begin{array}{*{7}{@{}>{{}}r@{}}}
& \multirow{2.5}{*}{$ {}\times{} $} & x^3 & + x^2 & & + 2 \\[1ex]
& & & x^2 & - x & + 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
& & x^3 & + x^2 & & + 2 \\
& - x^4 & - x^3 & & - 2x & \\
x^5 & + x^4 & & + 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
x^5 & & & + 3 x^2 & - 2x & + 2
\end{array} \]
\[ \begin{array}{*{12}{@{}>{{}}r<{{}}@{}}}
& & \multirow{2.5}{*}{$ {}\times{} $} & & x^3 & + & x^2 & & & + & 2 \\[1ex]
& & & & & & x^2 & - & x & + & 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
& & & & x^3 & + & x^2 & & & + & 2 \\
& - & x^4 & - & x^3 & & & - & 2x & & \\
x^5 & + & x^4 & & & + & 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
x^5 & & & & & + & 3 x^2 & - & 2x & + & 2 \
\end{array}
\hspace{4em}
\begin{array}{*{7}{@{}>{{}}r@{}}}
& \multirow{2.5}{*}{$ {}\times{} $} & x^3 & + x^2 & & + 2 \\[1ex]
& & & x^2 & - x & + 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
& & x^3 & + x^2 & & + 2 \\
& - x^4 & - x^3 & & - 2x & \\
x^5 & + x^4 & & + 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
x^5 & & & + 3 x^2 & - 2x & + 2
\end{array} \]
\end{document}