如何对齐枚举并添加答案到练习中?

如何对齐枚举并添加答案到练习中?

我想开始列举我的练习。我以前的做法是

\begin{ex}
Find the volume of the following pyramids $ABCD$

\begin{enumerate}[\quad 1)]
\item $A(1; 2; 3)$, \quad $B(2; 1; -2)$, \quad $C(-1; -4; 3)$, \quad $D(2; 1; -5)$;

\hfill Answer. 4.
\item $A(1;-2;-4)$, \quad $B(-2;-1;0)$, \quad $C(3; 4;-2)$, \quad $D(5; 5; -5)$;

\hfill Answer. 5.
\item $A(3; 2; 1)$, \quad $B(2; 4; 6)$, \quad $C(1; 5; 3)$, \quad $D(5; 4; 3)$.

\hfill Answer. 6.
\end{enumerate}
\end{ex}

在此处输入图片描述 现在我想对齐顶点的坐标,,,A。我试过了BCD

\begin{ex}
 Find the volume of the following pyramids

\setcounter{eqn}{0}
\begin{alignat*}{6}
\num&& A(1; 2; 3), \qquad& B(2; 1; -2),\qquad& C(-1; -4; 3),\qquad& D(2; 1; -5); \\
\num&& A(-3; -2; -1), \qquad&  B(2; 4; 6),\qquad& C(1; 5; 3), \qquad& D(5; 4; 3).
\end{alignat*}
\end{ex}

在此处输入图片描述

A我怎样才能将所有顶点、B、对齐到左侧(没有右侧的顶点与第二C张图片相似),以及如何像以前一样将答案添加到每个项目?DAC

我的完整代码

\documentclass{article}
\usepackage{amsmath}
\newcounter{eqn}
\usepackage{enumerate}
\renewcommand*{\theeqn}{\arabic{eqn})}
\newcommand{\num}{\refstepcounter{eqn}\text{\theeqn}\quad}
\usepackage{amsthm}
\theoremstyle{definition} 
\newtheorem{ex}{Exercise}
\begin{document}
\begin{ex}
Find the volume of the following pyramids $ABCD$
\begin{enumerate}[\quad 1)]
\item $A(1; 2; 3)$, \quad $B(2; 1; -2)$, \quad $C(-1; -4; 3)$, \quad $D(2; 1; -5)$;

\hfill Answer. 4.
\item $A(1;-2;-4)$, \quad $B(-2;-1;0)$, \quad $C(3; 4;-2)$, \quad $D(5; 5; -5)$;

\hfill Answer. 5.
\item $A(3; 2; 1)$, \quad $B(2; 4; 6)$, \quad $C(1; 5; 3)$, \quad $D(5; 4; 3)$.

\hfill Answer. 6.

\end{enumerate}
\end{ex}

\begin{ex}
Find the volume of the following pyramids
\setcounter{eqn}{0}
\begin{alignat*}{6}
  \num&& A(1; 2; 3), \qquad& B(2; 1; -2),\qquad& C(-1; -4; 3),\qquad& D(2; 1; -5); \\
\num&& A(-3; -2; -1), \qquad&  B(2; 4; 6),\qquad& C(1; 5; 3), \qquad& D(5; 4; 3).
\end{alignat*}
\end{ex}
\end{document}

答案1

是這樣嗎?

\documentclass{article}
\usepackage{amsmath}
\newcounter{eqn}
\usepackage{enumerate}
\renewcommand*{\theeqn}{\arabic{eqn})}
\newcommand{\num}{\refstepcounter{eqn}\text{\theeqn}\quad}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{ex}{Exercise}

\newcommand*{\mybox}[1]{%
    \makebox[1in][l]{$#1$}
    }
\begin{document}
\begin{ex}
Find the volume of the following pyramids $ABCD$
\begin{enumerate}[\quad 1)]
\item \mybox{A(1; 2; 3),} \mybox{B(2; 1; -2),} \mybox{C(-1; -4; 3),} \mybox{D(2; 1; -5);}

\hfill Answer. 4.
\item \mybox{A(1;-2;-4),} \mybox{B(-2;-1;0),} \mybox{C(3; 4;-2),} \mybox{D(5; 5; -5);}

\hfill Answer. 5.
\item \mybox{A(3; 2; 1),} \mybox{B(2; 4; 6),} \mybox{C(1; 5; 3),} \mybox{D(5; 4; 3).}

\hfill Answer. 6.

\end{enumerate}
\end{ex}

\begin{ex}
Find the volume of the following pyramids
\setcounter{eqn}{0}
\begin{alignat*}{6}
  \num& A(1; 2; 3), && \quad B(2; 1; -2),&&\quad C(-1; -4; 3),&&\quad D(2; 1; -5); \\
\num& A(-3; -2; -1), &&\quad  B(2; 4; 6),&&\quad C(1; 5; 3), &&\quad D(5; 4; 3).
\end{alignat*}
\end{ex}
\end{document}

在此处输入图片描述

相关内容