latex:等式中的缩进(方框而不是数字)

问题描述 投票:-1回答:1

我想做任务 - 添加到未知数字的列。

如何制作一切使其在盒子和数字的中心对齐?

数字位于数字下方,数字下方的方框,方框下方的数字?

\def\msquare{\mathord{\scalerel*{\Box}{gX}}}


\begin{multline*}
\begin{array}{r}
+
\begin{array}{r}
\msquare64\msquare\msquare\msquare\\
661977\\
\end{array}\\
\hline
\begin{array}{r}
1\msquare\msquare631\msquare
\end{array}\\
\end{array}
\end{multline*}

enter image description here

latex alignment vertical-alignment digits text-alignment
1个回答
1
投票

这可以使用数组完成。由于您的值只是正方形或数字,因此最好使用表格环境,其中可以更精细地控制列间间距。要做到这一点,更简单的是重新定义tabcolsep长度,但是像数组这样的包可以提供其他方法来控制它。

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}
% \def\msquare{\mathord{\scalerel*{\Box}{gX}}} % redifined, because I do know what \Box does.
\def\msquare{\raisebox{1mm}{\framebox[2mm][r]{}}}


\setlength{\tabcolsep}{0.5pt}
\begin{multline*}
  \begin{array}{r}
    +
    \begin{tabular}{ccccccc}
      &\msquare&6&4&\msquare&\msquare&\msquare\\
      &6&6&1&9&7&7\\
      \hline
      1&\msquare&\msquare&6&3&1&\msquare
    \end{tabular}\\
  \end{array}
\end{multline*}
\end{document}

enter image description here

为避免在所有文档中重新定义tabcolsep,请将此代码括在大括号中。

© www.soinside.com 2019 - 2024. All rights reserved.