LaTeX 自动开始新行并缩进

LaTeX 自动开始新行并缩进

因此,在附图中,文本“注意:‘积分变量’无关紧要”应与其下方的公式位于同一行。在代码中,我将所有内容放在一行上,但显示方式并非如此。其上方的公式和中间的所有公式都需要左对齐。我尝试过 flalign 和 align,但 flalign 只会给我错误,并且出于某种原因 align 不起作用。

以下是我想要在一行上显示的全部代码:Note: The "variable of integration" is irrelevant. $$\int_{-2}^{5} x^3 dx = \int_{-2}^{5} y^3 dy = \int_{-2}^{5} t^3 dt = ...$$

我只需要将一些公式左对齐,并在右侧留出一点缩进空间,以使其显示与文本不同。

谢谢 在此处输入图片描述

这是我的完整代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\documentclass[fleqn]{article}
\setlength{\mathindent}{0pt}
\begin{document}


\section{1 Limit of a Riemann Sum}Suppose $f$ is defined on [$a,b$] and $L$ is a real number. We write \\ $$\int_{a}^{b} f(x) dx = \lim_{|| P ||\to\ 0} \sum\limits_{k=1}^n f(C_k)\Delta \chi _k = L$$
if for every $\epsilon$ $>$ 0, there is a  $\delta$ $>$ 0 so that if $P$ is any partition of [$a,b$] with $\left\Vert\left P \left\Vert\left $ $<$ $\delta$ and each $C_k$ is a number in the $k$th subinterval of $P$, then

$$\left\vert\left \sum\limits_{k=1}^n f(C_k)\Delta \chi _k - L \right\vert\right \textless \thinspace \thinspace \epsilon$$
\\
\\
 \newline Note: The "variable of integration" is irrelevant. $$\int_{-2}^{5} x^3 dx = \int_{-2}^{5} y^3 dy = \int_{-2}^{5} t^3 dt = ...$$
 \\
 Ex: Do the following exist?
 \\
 \begin{flalign}
 $$\left \int_{1}^{3} \frac{1}{x^2} dx$$ &&
  \\&&
 $$\left \int_{0}^{2} \frac{1}{x^2} dx$$&&
 \end{flalign}
 \\
 \\
 Ex: Evaluate $$\int_{1}^{4} f(x) dx$$ where $f(x)$ = 

 \end{flalign}

 \\
 \begin{cases}
 $$3x^2 + 1, \quad 1 \leq x \leq 3$$
 \\
 $$28, \quad \quad \quad \quad 3$$ $<$ $$x \leq 4$$

 \end{cases}
 \\
 \\
 \\

 You may use the fact that $$\int_{1}^{3} x^2 dx = \frac{26}{3}$$ where $f(x)$ 


 \section{Miscellaneous Trivia}
 Prove: If A $$\subseteq B, then \quad A \cap C \subseteq B \cap C$$
 \\
 \\
 Fact: $C(n,r)$ = \Bigg(\overset{n}{r}\Bigg) = $$\frac{P(n,r)}{r!} = \frac{\frac{n!}{(n-r)!}}{r!} = \frac{n!}{r!(n-r)!}$$
\end{document}

答案1

发布的代码产生错误

! LaTeX Error: Two \documentclass or \documentstyle commands.

因为有两个\documentclass

如果你注释掉第二个,你会得到错误

! Undefined control sequence.
<argument> \mathindent 

l.6 \setlength{\mathindent}{0pt}

因为长度没有定义

注释掉该行,你会得到错误

! Missing delimiter (. inserted).
<to be read again> 
                   $
l.11 ... with $\left\Vert\left P \left\Vert\left $
                                                   $<$ $\delta$ and each $C_...

\left公式末尾出现。如果您滚动过去,则会收到错误,提示没有匹配项,\right. \left并且\right必须在同一表达式中成对匹配。

如果你修复了不匹配的问题\left,那么你就会得到

! Missing } inserted.
<inserted text> 
                }
l.30  \end{flalign}

正如您所见$flalign这是错误的,因为falign已经进入数学模式。

如果你修复了嵌套数学,你会得到错误

! LaTeX Error: There's no line here to end.

出现\\,但不能强制在没有行的地方换行,所以删除这些,这也会删除警告

Underfull \hbox (badness 10000) in paragraph at lines 18--22

这些是\\错误放置在段落末尾的

然后你得到错误

! Missing $ inserted.
<inserted text> 
                $
l.44  Fact: $C(n,r)$ = \Bigg(\overset{n}{r}

因为您在 = 之前完成了数学运算,所以 = 后面的数学模式命令会产生错误。

修复该问题最终会生成一个无错误的日志。只有在此时,您才应该查看生成的 PDF,因为 TeX 在发生错误后不会尝试生成合理的 PDF 输出,它只会恢复足够的内容以检查剩余文档的语法,如果您滚动浏览错误,它不会生成可用的输出。

更改$$\[然后导致此文档

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
%\documentclass[fleqn]{article}
%\setlength{\mathindent}{0pt}
\begin{document}


\section{1 Limit of a Riemann Sum}

Suppose $f$ is defined on [$a,b$] and $L$ is a real number. We write
\[\int_{a}^{b} f(x) dx = \lim_{|| P ||\to\ 0} \sum\limits_{k=1}^n f(C_k)\Delta \chi _k = L\]
if for every $\epsilon$ $>$ 0, there is a  $\delta$ $>$ 0 so that if $P$ is any partition 
of [$a,b$] with $\lVert P \rVert < \delta$ and each $C_k$ is a number
in the $k$th subinterval of $P$, then

\[\left\vert \sum\limits_{k=1}^n f(C_k)\Delta \chi _k - L \right\vert < \epsilon\]

Note: The "variable of integration" is irrelevant.
\[\int_{-2}^{5} x^3 dx = \int_{-2}^{5} y^3 dy = \int_{-2}^{5} t^3 dt = ...\]

 Ex: Do the following exist?
 \begin{flalign}
 \int_{1}^{3} \frac{1}{x^2} dx &&
  \\&&
 \int_{0}^{2} \frac{1}{x^2} dx&&
 \end{flalign}
 Ex: Evaluate $$\int_{1}^{4} f(x) dx$$ where $f(x)$ = 
 \[\begin{cases}
 3x^2 + 1, \quad 1 \leq x \leq 3
 \\
 28, \quad \quad \quad \quad 3<x \leq 4
 \end{cases}
 \]

 You may use the fact that $$\int_{1}^{3} x^2 dx = \frac{26}{3}$$ where $f(x)$ 


 \section{Miscellaneous Trivia}
 Prove: If A
\[\subseteq B, then \quad A \cap C \subseteq B \cap C\]

 Fact:
\[C(n,r) = \Bigg(\overset{n}{r}\Bigg) = 
\frac{P(n,r)}{r!} = 
\frac{\frac{n!}{(n-r)!}}{r!} = 
\frac{n!}{r!(n-r)!}\]
\end{document}

在此处输入图片描述

添加fleqn\documentclass将使显示的表达式左对齐,并且所有表达式(例如)$\epsilon$ $>$ 0都应排版为单个数学表达式,以便获得正确的间距,并且最后的 0 在数学内部,因此$\epsilon > 0$,在显示数学之前也永远不会有空行。

最后得到这个,这可能是你所需布局的近似值,我不得不做一些猜测

在此处输入图片描述

\documentclass[fleqn]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
%\documentclass[fleqn]{article}
%\setlength{\mathindent}{0pt}
\begin{document}


\section{1 Limit of a Riemann Sum}

Suppose $f$ is defined on [$a,b$] and $L$ is a real number. We write
\[\int_{a}^{b} f(x) dx = \lim_{|| P ||\to\ 0} \sum\limits_{k=1}^n f(C_k)\Delta \chi _k = L\]
if for every $\epsilon > 0$, there is a  $\delta >0$ so that if $P$ is any partition 
of $[a,b]$ with $\lVert P \rVert < \delta$ and each $C_k$ is a number
in the $k$th subinterval of $P$, then
\[\left\vert \sum\limits_{k=1}^n f(C_k)\Delta \chi _k - L \right\vert < \epsilon\]

Note: The "variable of integration" is irrelevant.
\[\int_{-2}^{5} x^3 dx = \int_{-2}^{5} y^3 dy = \int_{-2}^{5} t^3 dt = ...\]

 Ex: Do the following exist?
 \begin{gather}
 \int_{1}^{3} \frac{1}{x^2} dx\\
 \int_{0}^{2} \frac{1}{x^2} dx
 \end{gather}
 Ex: Evaluate \[\int_{1}^{4} f(x) dx\] where
\[f(x) = 
 \begin{cases}
 3x^2 + 1, \quad 1 \leq x \leq 3\\
 28, \quad \quad \quad \quad 3<x \leq 4
 \end{cases}
 \]

 You may use the fact that
\[\int_{1}^{3} x^2 dx = \frac{26}{3}\]
 where $f(x)$ 


 \section{Miscellaneous Trivia}
 Prove: If 
\[A\subseteq B, then \quad A \cap C \subseteq B \cap C\]

 Fact:
\[C(n,r) = \Bigg(\overset{n}{r}\Bigg) = 
\frac{P(n,r)}{r!} = 
\frac{\frac{n!}{(n-r)!}}{r!} = 
\frac{n!}{r!(n-r)!}\]
\end{document}

相关内容