我不确定如何在标题中解释它,但这是我想做的:
我希望能够对齐正确的箭头,而不必像我在代码中所做的那样将它们分成两个不同的环境:
\documentclass[fleqn, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage[margin=1.25in]{geometry}
\setlength{\mathindent}{0pt}
\setlength{\jot}{\baselineskip}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.25}
\begin{document}
\begin{align*}
\Rightarrow k \textrm{ is even } (k=2n)
\Rightarrow z_k=i^{2n}=(-1)^n
&\Rightarrow n \textrm{ is even}
\Rightarrow z_k=1+0i \\
&\Rightarrow n \textrm{ is odd}
\Rightarrow z_k=-1+0i \\
\end{align*}
\vspace{-2cm}
\begin{align*}
\Rightarrow k \textrm{ is odd } (k=2n+1)
\Rightarrow z_k=i^{2n+1}=i^{2n}\cdot i= (-1)^n \cdot i
&\Rightarrow n \textrm{ is even}
\Rightarrow z_k=0+1i \\
&\Rightarrow n \textrm{ is odd}
\Rightarrow z_k=0-1i \\
\end{align*}
\end{document}
但是当我尝试使用此代码在单一环境中执行此操作时:
\documentclass[fleqn, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage[margin=1.25in]{geometry}
\setlength{\mathindent}{0pt}
\setlength{\jot}{\baselineskip}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.25}
\begin{document}
\begin{align*}
\Rightarrow k \textrm{ is even } (k=2n)
\Rightarrow z_k=i^{2n}=(-1)^n
&\Rightarrow n \textrm{ is even}
\Rightarrow z_k=1+0i \\
&\Rightarrow n \textrm{ is odd}
\Rightarrow z_k=-1+0i \\
\Rightarrow k \textrm{ is odd } (k=2n+1)
\Rightarrow z_k=i^{2n+1}=i^{2n}\cdot i= (-1)^n \cdot i
&\Rightarrow n \textrm{ is even}
\Rightarrow z_k=0+1i \\
&\Rightarrow n \textrm{ is odd}
\Rightarrow z_k=0-1i \\
\end{align*}
\end{document}
这是我得到的:
我理解这是因为 Latex 会将所有直箭头对齐(因为有“&”),同时使最长行的开头从右侧开始。所以我尝试在某些行的开头添加“&”,以使其看起来像我想要的那样,但没有成功。
提前感谢您的回答。
答案1
欢迎来到 TeX.SE!
您可以aligned
在以下位置嵌套环境align*
:
\documentclass[fleqn]{article}
\usepackage{amsthm, amssymb, mathtools}
\usepackage[margin=1.25in]{geometry}
\setlength{\mathindent}{0pt}
\setlength{\jot}{\baselineskip}
\begin{document}
\begin{align*}
& \begin{aligned}
\Rightarrow k \textrm{ is even } (k=2n)
\Rightarrow z_k=i^{2n}=(-1)^n
& \Rightarrow n \textrm{ is even}
\Rightarrow z_k=1+0i \\
& \Rightarrow n \textrm{ is odd}
\Rightarrow z_k=-1+0i
\end{aligned} \\
%
& \begin{aligned}
\Rightarrow k \textrm{ is odd } (k=2n+1)
\Rightarrow z_k=i^{2n+1}=i^{2n}\cdot i= (-1)^n \cdot i
& \Rightarrow n \textrm{ is even}
\Rightarrow z_k=0+1i \\
& \Rightarrow n \textrm{ is odd}
\Rightarrow z_k=0-1i \\
\end{aligned}
\end{align*}
\end{document}
答案2
我建议您alignedat
对“内部”表达式使用环境,以便您\Rightarrow
也可以对齐“内部”符号。
\documentclass[fleqn, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage[margin=1.25in]{geometry}
\setlength{\mathindent}{0pt}
\setlength{\jot}{\baselineskip}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.25}
\begin{document}
\begin{align*}
&\Rightarrow \textup{$k$ is even } (k=2n) \Rightarrow z_k=i^{2n}=(-1)^n
\begin{alignedat}[t]{2}
&\Rightarrow \textup{$n$ is even} &{}\Rightarrow{}& z_k=\phantom{-}1+0i \\
&\Rightarrow \textup{$n$ is odd} &{}\Rightarrow{}& z_k=-1+0i
\end{alignedat}\\[0.5\jot]
&\Rightarrow \textup{$k$ is odd } (k=2n+1) \Rightarrow
z_k=i^{2n+1}=i^{2n}\cdot i= (-1)^n \cdot i
\begin{alignedat}[t]{2}
&\Rightarrow \textup{$n$ is even} &{}\Rightarrow{}& z_k=0+1i \\
&\Rightarrow \textup{$n$ is odd} &{}\Rightarrow{}& z_k=0-1i
\end{alignedat}
\end{align*}
\end{document}