子枚举练习和对齐

子枚举练习和对齐

我有以下内容:

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}

\newenvironment{theorem}[2][Theorem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{lemma}[2][Lemma]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{exercise}[2][Exercise]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{reflection}[2][Reflection]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{proposition}[2][Proposition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{corollary}[2][Corollary]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}

\begin{document}

\title{xxx}%replace X with the appropriate number
\author{xxx\\ %replace with your name
xxx} %if necessary, replace with your course title

\maketitle

\begin{exercise}{1} Consider the PDE \[ u_{xx} - 2u_{xy} - 3u_{yy} = 0 \]
\end{exercise}

(i) Show that this PDE is hyperbolic. \\
%Note 1: The * tells LaTeX not to number the lines.  If you remove the *, be sure to remove it below, too.
%Note 2: Inside the align environment, you do not want to use $-signs.  The reason for this is that this is already a math environment. This is why we have to include \text{} around any text inside the align environment.
A second-order linear PDE in two variables is an equation of the form
\begin{align*}
Au_{xx} + Bu_{xy} + Cu_{yy} + Du_{x} + Eu_{y} + Fu = G,
\end{align*}

where $A, B, C, D, E, F,$ and $G$ can be constants or given functions of $x$ and $y$.

\end{document}

我希望能够将我的练习细分为 (i)、(ii)、(iii) 等。然后我希望能够按照 (i)、(ii) 等的对齐方式编写我的解决方案,而不会出现文本错位的情况,如上例所示(见下图)。因此,与练习 1 相关的所有工作都整齐地归入练习 1 的对齐方式,练习 1 (i) 对齐方式下的所有工作都整齐地归入练习 1 (i) 的对齐方式,等等。

错位:

在此处输入图片描述

在上图中,Exercise 1应排在最前面,然后(i)排在第二位,并对齐到其下方。然后其他所有内容都应对齐到其下方(i)

谢谢。

答案1

这是你想要的吗?我使用了一个真正的枚举列表,用包定制enumitem。两种可能性:第一种是默认的,标签在列表的左边距右对齐,第二种是自定义的,标签在其框中左对齐:

\documentclass[12pt]{article}

\usepackage[margin=1in, showframe]{geometry}
\usepackage{amsmath,amsthm,amssymb}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}

\newenvironment{theorem}[2][Theorem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{lemma}[2][Lemma]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{exercise}[2][Exercise]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{reflection}[2][Reflection]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{proposition}[2][Proposition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{corollary}[2][Corollary]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}

\usepackage{enumitem}

\begin{document}

\title{xxx}%replace X with the appropriate number
\author{xxx\\ %replace with your name
xxx} %if necessary, replace with your course title

\maketitle

\begin{exercise}{1} Consider the PDE \[ u_{xx} - 2u_{xy} - 3u_{yy} = 0 \]
\end{exercise}

\begin{enumerate}[label=(\roman*), leftmargin=*, listparindent=0pt]
\item Show that this PDE is hyperbolic.

%Note 1: The * tells LaTeX not to number the lines. If you remove the *, be sure to remove it below, too.
%Note 2: Inside the align environment, you do not want to use $-signs. The reason for this is that this is already a math environment. This is why we have to include \text{} around any text inside the align environment.
A second-order linear PDE in two variables is an equation of the form
\begin{align*}
Au_{xx} + Bu_{xy} + Cu_{yy} + Du_{x} + Eu_{y} + Fu = G,
\end{align*}
where $A, B, C, D, E, F,$ and $G$ can be constants or given functions of $x$ and $y$.
\item
\end{enumerate}
\vspace{4ex}
\begin{enumerate}[label=(\roman*), wide=2.5em, leftmargin=*, labelsep =-0.5em, listparindent=0pt]
\item Show that this PDE is hyperbolic.

%Note 1: The * tells LaTeX not to number the lines. If you remove the *, be sure to remove it below, too.
%Note 2: Inside the align environment, you do not want to use $-signs. The reason for this is that this is already a math environment. This is why we have to include \text{} around any text inside the align environment.
A second-order linear PDE in two variables is an equation of the form
\begin{align*}
Au_{xx} + Bu_{xy} + Cu_{yy} + Du_{x} + Eu_{y} + Fu = G,
\end{align*}
where $A, B, C, D, E, F,$ and $G$ can be constants or given functions of $x$ and $y$.
\item
\end{enumerate}

\end{document} 

在此处输入图片描述

相关内容