如何在 latex 中写入对齐

如何在 latex 中写入对齐
\documentclass[a4paper,11pt]{report}
\usepackage{amsmath,amssymb,graphicx,tikz}
\usepackage{enumitem}

\begin{documennt}
\begin{enumerate}[label=(\arabic*)]

\item 

$x^{p^{r}q^{s}}+1$

\vspace{0.3cm} 
=$(x^{p^{r}})^{q^{s}}+1$

\vspace{0.3cm} 
=$(1+x^{p^r})(1+x^{p^r}+x^{2p^r}+\cdots+x^{(q-1)p^r})(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r})\cdots(1+x^{q^{s-1}p^r}+x^{2q^{s-1}p^r}+\cdots+x^{(q-1)p^{s-1}p^r})$

\vspace{0.3cm} 
=$(1+x)(1+x+x^2+\cdots+x^{p-1})(1+x^p+x^{2p}+\cdots+x^{(p-1)p})\\(1+x^{p^2}+x^{2p^2}+\cdots+x^{(p-1)p^2})\cdots(1+x^{p^{r-1}}+x^{2p^{r-1}}+\cdots+x^{(p-1)p^{r-1}}) \\(1+x^{p^r}+x^{2p^r}+\cdots+x^{(q-1)p^r})(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r})\cdots(1+x^{q^{s-1}p^r}+x^{2q^{s-1}p^r}+\cdots+x^{(q-1)p^{s-1}p^r}) .$

\end{enumerate}
\end{document}

我试图在 LaTeX 中将这些方程式对齐地写出来,但没有成功。我该怎么做呢?请给我一些建议。

答案1

像这样?

在此处输入图片描述 (红线表示文本边框)

\documentclass[a4paper,11pt]{report}
\usepackage{mathtools, nccmath}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\[\medmath{
\begin{aligned}
x^{p^{r}q^{s}}+1
    & = \bigl(x^{p^{r}}\bigr)^{q^{s}}+1                   \\
    & = \begin{multlined}[t]
        \bigl(1+x^{p^r}\bigr)
            \bigl(1+x^{p^r}+x^{2p^r} + \cdots + x^{(q-1)p^r}\bigr)         \\
            \bigl(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r}\bigr)\cdots    \\
            \bigl(1+x^{q^{s-1}p^r}+x^{2q^{s-1}p^r}+\cdots + x^{(q-1)p^{s-1}p^r}\bigr)
        \end{multlined}\\
    & = \begin{multlined}[t]
        \bigl(1+x\bigr)\bigl((1+x+x^2+\cdots+x^{p-1}\bigr)
             \bigl(1+x^p+x^{2p}+\cdots+x^{(p-1)p}\bigr)   \\
        \bigl(1+x^{p^2}+x^{2p^2}+\cdots+x^{(p-1)p^2}\bigr)\cdots
             \bigl(1+x^{p^{r-1}}+x^{2p^{r-1}}+\cdots+x^{(p-1)p^{r-1}}\bigr) \\
        \bigl(1+x^{p^r}+x^{2p^r}+\cdots+x^{(q-1)p^r}\bigr)
             \bigl(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r}\bigr)\cdots\\
             \bigl(1+x^{q^{s-1}p^r} + x^{2q^{s-1}p^r} + \cdots + x^{(q-1)p^{s-1}p^r}\bigr).
        \end{multlined}
\end{aligned}
}
\]
\end{document}

在上面,MWE 使用alignedfrom amsmath(由包加载mathtools)来对齐等号处的方程式,并multlined使用 frommathtools包将长方程式拆分为更多行。使用\medmath{ ... }fromnccmath来减小方程式大小。

目的itemize不明确。你喜欢在左边有编号的等式吗?像这样?

在此处输入图片描述

\documentclass[a4paper,11pt]{report}
\usepackage[leqno]{mathtools, nccmath}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{equation}
\medmath{
\begin{aligned}%[t]
x^{p^{r}q^{s}}+1
    & = \bigl(x^{p^{r}}\bigr)^{q^{s}}+1                   \\
    & = \begin{multlined}[t]
        \bigl(1+x^{p^r}\big)
            \bigl(1+x^{p^r}+x^{2p^r} + \cdots + x^{(q-1)p^r}\big)         \\
            \bigl(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r}\big)\cdots    \\
            \bigl(1+x^{q^{s-1}p^r}+x^{2q^{s-1}p^r}+\cdots +x^{(q-1)p^{s-1}p^r}\big)
        \end{multlined}\\
    & = \begin{multlined}[t]
        \bigl(1+x\big)\bigl(1+x+x^2+\cdots+x^{p-1}\big)
             \bigl(1+x^p+x^{2p}+\cdots+x^{(p-1)p}\big)   \\
        \bigl(1+x^{p^2}+x^{2p^2}+\cdots+x^{(p-1)p^2}\big)\cdots \\
             \bigl(1+x^{p^{r-1}}+x^{2p^{r-1}}+\cdots+x^{(p-1)p^{r-1}}\big) \\
        \bigl(1+x^{p^r}+x^{2p^r}+\cdots+x^{(q-1)p^r}\big)\\
             \bigl(1+x^{qp^r}+x^{2qp^r}+\cdots+x^{(q-1)qp^r}\big)\cdots\\
             \bigl(1+x^{q^{s-1}p^r} + x^{2q^{s-1}p^r} + \cdots + x^{(q-1)p^{s-1}p^r}\big).
        \end{multlined}
\end{aligned}
}
\end{equation}
\end{document}

相关内容