
나는 양수와 음수를 모두 열거한 목록을 만들고 있는데, 숫자가 서로 정렬되도록(즉, 모두 같은 열에) 하고 싶습니다. 또한 소수점이 포함된 두 번째 목록이 있는데 소수점을 정렬하고 싶습니다. 다음과 같이 열거 목록 내에서 \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}
여기에 두 가지 다른 옵션이 있습니다. 하나는 align
(패키지에서 amsmath
) 그냥 사용하는 것이고 다른 하나는 표준을 사용하는 것입니다 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
)은 작업량이 적다는 것을 의미합니다.