是的,我试图停止使用 $$ 来表示方程式,但\[
自动将方程式放在中心的事实有点烦人,有没有命令可以禁用此功能。
答案1
答案2
您似乎正在使用如下输入
This is some text before an equation\\
$x+y=y+x$\\
and this text follows
因为无论如何使用$$...$$
都会使方程式居中。
这种编写 TypeScript 代码的方式在很多方面都是错误的,即使你使用类似
This is some text before an equation\\[1ex]
$x+y=y+x$\\[1ex]
and this text follows
获取数学显示周围的垂直空间。
绝不用于\\
结束普通段落中的行。TeX 不是文字处理器!
如果希望方程式放在左边,则可以使用\[...\]
或其他amsmath
显示环境,但要避免将显示数学运算与左边距齐平打印。
\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
\section{Bad display}
The following fact should be known to every mathematician \\[1ex]
$\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}$\\[1ex]
and was definitely a surprise when it was discovered.
\section{Good display}
The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.
\end{document}
如果你确实希望显示屏与左对齐,
\documentclass[fleqn]{article}
\usepackage{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
\section{Not so good display}
The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.
\end{document}
为什么不太好?因为通常采用左对齐显示,并在左侧显示方程式数字。请看以下内容。
\documentclass[fleqn,leqno]{article}
\usepackage{amsmath}
\begin{document}
\section{Unnumbered}
The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^2}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.
\section{Numbered}
The following fact should be known to every mathematician
\begin{equation}
\int_{-\infty}^{\infty} e^{-x^2}\,dx=\sqrt{\pi}
\end{equation}
and was definitely a surprise when it was discovered.
\end{document}
如果设置\mathindent
为零,则会得到次优输出。