
私は正の数と負の数の両方を列挙したリストを作成しており、数字を互いに整列させ、つまりすべて同じ列に並べたいと思っています。また、小数を含む2番目のリストもあり、小数点を整列させたいと思っています。列挙リスト内で次のように\begin{align}を使用しようとしました。
\begin{enumerate}
\begin{align*}[t]
\item $-&2$
\item $3$
\item $-18$
\item $83.2$
\item $-112.2$
\end{align*}
\end{enumerate}
しかし、\begin{aligned} は数式モードでのみ許可されるというエラーが発生します。 amsmath パッケージをロードし、xelatex でコンパイルしています。
編集: 問題のある領域をコメント アウトしても、xelatex はこのエラーを表示します。
答え1
\item
数式モードでは使用できないため、次の構文になります。
\begin{enumerate}
\begin{align*}[t]
\item $-&2$
\item $3$
...
\end{enumerate}
エラーが発生します。
希望する配置(列挙された行と特定の列の小数点の配置を含む表のような素材)を得るには、環境を使用できますtabular
。配置は、siunitx
パッケージ:
\documentclass{article}
\usepackage{siunitx}
\newcounter{tmp}
\begin{document}
\noindent\begin{tabular}{>{\stepcounter{tmp}\thetmp}lSS[table-format = 3.4]}
& 6 & 2.3456 \\
& -7 & 34.2345 \\
& 20 & -6.7835 \\
& -12 & 90.473 \\
\end{tabular}
\end{document}
他に 2 つのオプションがあります。1 つはalign
(パッケージからamsmath
) だけを使用するオプションで、もう 1 つは標準を使用するオプションですtabular
。
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcounter{tmp}
\begin{document}
\noindent Using \texttt{align*}:
\begin{align*}
1 && 6 && 2.3456 \\
2 && -7 && 34.2345 \\
3 && 20 && -6.7835 \\
4 && -12 && 90.473\phantom{0} \\
5 && 10 && 3.4\phantom{000}
\end{align*}
\noindent Using \texttt{tabular}:
\setcounter{tmp}{0}
\noindent\begin{tabular}{@{}>{\stepcounter{tmp}\thetmp}lrr@{.}l}
& 6 & 2 &3456 \\
& -7 & 34 & 2345 \\
& 20 & -6 & 7835 \\
& -12 & 90 & 473 \\
& 10 & 3 & 4
\end{tabular}
\end{document}
最初のソリューション ( を使用siunitx
) では作業量が少なくなることに注意してください。