在 Latex 中,如何在已经处于 flushleft 环境中时进行左对齐

在 Latex 中,如何在已经处于 flushleft 环境中时进行左对齐

在 \centering 之后,我不断创建新的 \begin{flushleft},我认为这非常低效,有没有另一种方法可以左对齐,而不会创建这么多这样的环境在此处输入图片描述? 谢谢你!

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\begin{document}

    \begin{flushleft}
    If $f(x) = x^{n}$, then  $f'(x) = nx^{n-1}$ and $f''(x) = n(n-1)x^{n-2}$.
    \newline
    \hfill\break
    \\
    The addition formula for cosine is $\cos(\alpha+\beta)$ = $\cos\alpha$$\cos\beta$ - $\sin\alpha$$\sin\beta$.
    \\
    The addition formula for tangent is
    \newline
    \\
    \centering
    $\tan(\alpha+\beta)$ = 
    $\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}$
    \newline
    \\
        \begin{flushleft}
            The bionomial theorem states that
            \newline
            \\
            \centering
            $(a+b)^n$ = $\sum_{i=0}^{n} {n \choose i}a^ib^{n-i}$
            \begin{flushleft}
                for any real numbers a and b and for any integer n $\ge$ 0
                \newline
                \\
                The modulus of a complex number z = a+bi is $\left|z\right|$ = $\sqrt{a^2+b^2}$ and the argument of z, $\varphi$ = arg z satisfies a =  $\left|z\right|$cos$\varphi$ and b = $\left|z\right|$sin$\varphi$, so $\tan{\varphi}$ = $\frac{b}{a}$.
                \newline
                \hfill \break
                \\
                The general formula for the integral of a power of x is
                \newline
                \\
                \centering
                $\int x^ndx$ = $\frac{x^{n+1}}{n+1}$ + C,
                \begin{flushleft}
                    \raggedleft so
                    \newline
                    \centering
                    $\int\limits_{0}^{2} x^3 dx$ = $\left[\frac{x^4}{4}\right]_0^2$ = 4
                    \begin{flushleft}
                        The determinant of a 2 $\times$ 2 matrix is given by the formula
                        \newline
                        \\
                        \centering
                        $\det$
                        $\begin{pmatrix} 
                            a & b\\ c & d
                        \end{pmatrix}$


                    \end{flushleft}
                \end{flushleft}

            \end{flushleft}
        \end{flushleft}

    \end{flushleft}

\end{document}

答案1

许多您的代码中有错误。

  1. 不要拆分公式
  2. 数学就是数学,所以n$\ge$0应该$n\ge 0$
  3. \newline\\是错的
  4. 对于显示方程式使用\[...\]

我在下面的代码中还做了许多其他修复。研究一下它们。

我加载了它,parskip因为你似乎想要它。对于这样的文档,它可以是一个选择。不要将它用于真正的论文:只需使用空白行来分隔段落即可。

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{parskip}

\begin{document}

If $f(x) = x^{n}$, then  $f'(x) = nx^{n-1}$ and $f''(x) = n(n-1)x^{n-2}$.

The addition formula for cosine is $\cos(\alpha+\beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta$.

The addition formula for tangent is
\[
\tan(\alpha+\beta) = \frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}
\]

The binomial theorem states that
\[
(a+b)^n = \sum_{i=0}^{n} \binom{n}{i}a^ib^{n-i}
\]
or any real numbers $a$ and $b$ and for any integer $n\ge 0$

The modulus of a complex number $z=a+bi$ is $\lvert z\rvert=\sqrt{a^2+b^2}$ and the argument 
of $z$, $\varphi=\arg z$ satisfies $a=\lvert z\rvert\cos\varphi$ and $b=\lvert z\rvert\sin\varphi$, 
so $\tan{\varphi}=\frac{b}{a}$.

The general formula for the integral of a power of $x$ is
\[
\int x^n\,dx =\frac{x^{n+1}}{n+1} + C,
\]
so
\[
\int_{0}^{2} x^3 \,dx = \left[\frac{x^4}{4}\right]_0^2 = 4
\]

The determinant of a $2\times 2$ matrix is given by the formula
\[
\det\begin{pmatrix} 
    a & b\\ c & d
    \end{pmatrix}
=ad-bc
\]

\end{document}

在此处输入图片描述

相关内容