为什么方程不居中?

为什么方程不居中?

我已经尝试了一个多小时,但还是没能将一个方程式居中。为什么这个方程式没有居中 - 即左边有那么多空白??

这是我的代码:

\documentclass[10pt]{article}
\begin{document}
$$\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}-\frac{\beta\bigg(X_{HS}+X_{HT}+X_{H+{T_T^{(1)}}}+X_{H+T_T^{(2)}}
+X_{H+T_T^{(3)}}\bigg)}{N}-\frac{\tau(X_{ST}+X_{HT})X_{SS}}{N}$$
\end{document}

输出结果如下:

在此处输入图片描述

我已经尝试过 flalign、raggedleft、raggedright、amsmath 包等等......

答案1

这个解决方案怎么样alignedat?只有一个数字自然

    \documentclass[10pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{lmodern}

    \usepackage{mathtools}

    \begin{document}

    I have tried for over one hour now, in vain, on centering one equation. Why in the world is the equation not centered - i.e., so much margin on the left??

    \begin{equation}
    \begin{alignedat}{2}
    \frac{dX_{SS}}{dt} &= \Lambda - \mu X_{SS} &  & -\frac{β \big(X_{HS}+X_{HT}+X_{H+{T_T^{(1)}}}+X_{H+T_T^{(2)}}+X_{H+T_T^{(3)}}\big)}{N} \\
     &  &  &  -\frac{τ(X_{ST}+X_{HT})X_{SS}}{N}
    \end{alignedat}
    \end{equation}

    \end{document} 

在此处输入图片描述

答案2

你有几种方法:我将介绍四种。总之,长分数线已被\frac{1}{N}分子前面的替换,这可能读起来不那么沉重。第一个之后的例子实际上有,\tfrac{1}{N}这可能更好。锻炼你的品味。

\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}

I have tried for over one hour now, in vain, on centering one equation. Why in the world is 
the equation not centered---i.e., so much margin on the left?
\begin{equation*}
\begin{split}
\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}
  &-\frac{1}{N}
      \beta\bigl(X_{HS}+X_{HT}+X_{H+T_T^{(1)}}+X_{H+T_T^{(2)}}+X_{H+T_T^{(3)}}\bigr)\\
  &-\frac{1}{N}\tau(X_{ST}+X_{HT})X_{SS}
\end{split}
\end{equation*}
I have tried for over one hour now, in vain, on centering one equation. Why in the world is 
the equation not centered---i.e., so much margin on the left?
\begin{equation*}
\begin{split}
\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}
  &-\tfrac{1}{N}
      \beta\bigl(X_{HS}+X_{HT}+X_{H+T_T^{(1)}}+X_{H+T_T^{(2)}}+X_{H+T_T^{(3)}}\bigr)\\
  &-\tfrac{1}{N}\tau(X_{ST}+X_{HT})X_{SS}
\end{split}
\end{equation*}
I have tried for over one hour now, in vain, on centering one equation. Why in the world is 
the equation not centered---i.e., so much margin on the left?
\begin{multline*}
\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}
  -\tfrac{1}{N}
      \beta\bigl(X_{HS}+X_{HT}+X_{H+T_T^{(1)}}+X_{H+T_T^{(2)}}+X_{H+T_T^{(3)}}\bigr)\\
  -\tfrac{1}{N}\tau(X_{ST}+X_{HT})X_{SS}
\end{multline*}
I have tried for over one hour now, in vain, on centering one equation. Why in the world is 
the equation not centered---i.e., so much margin on the left?
\begin{multline*}
\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}\\
  -\tfrac{1}{N}
      \beta\bigl(X_{HS}+X_{HT}+X_{H+T_T^{(1)}}+X_{H+T_T^{(2)}}+X_{H+T_T^{(3)}}\bigr)\\
  -\tfrac{1}{N}\tau(X_{ST}+X_{HT})X_{SS}
\end{multline*}
I have tried for over one hour now, in vain, on centering one equation. Why in the world is 
the equation not centered---i.e., so much margin on the left?

\end{document}

在此处输入图片描述

答案3

从放大的版本中可以看出,方程比 长\textwidth,因此无法居中。但一般来说,应该使用$$...$$LaTeX(或其他结构),而不是 TeX 。参见\[...\]为什么 \[ ... \] 比 $$ ... $$ 更可取?

\documentclass[10pt]{article}
\begin{document}


I have tried for over one hour now, in vain, on centering one equation. Why in the world is the equation not centered - i.e., so much margin on the left??

$$\frac{dX_{SS}}{dt}=\Lambda-\mu X_{SS}-\frac{\beta\bigg(X_{HS}+X_{HT}+X_{H+{T_T^{(1)}}}+X_{H+T_T^{(2)}}
+X_{H+T_T^{(3)}}\bigg)}{N}-\frac{\tau(X_{ST}+X_{HT})X_{SS}}{N}$$




I have tried for over one hour now, in vain, on centering one equation. Why in the world is the equation not centered - i.e., so much margin on the left??
\end{document}

在此处输入图片描述

但最好将太长的方程拆分:

\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}


I have tried for over one hour now, in vain, on centering one equation. Why in the world is the equation not centered - i.e., so much margin on the left??

\begin{align*}
\frac{dX_{SS}}{dt}&=\Lambda-\mu X_{SS}-\frac{\beta\bigg(X_{HS}+X_{HT}+X_{H+{T_T^{(1)}}}+X_{H+T_T^{(2)}}
+X_{H+T_T^{(3)}}\bigg)}{N}\\
&\quad{}-\frac{\tau(X_{ST}+X_{HT})X_{SS}}{N}
\end{align*}




I have tried for over one hour now, in vain, on centering one equation. Why in the world is the equation not centered - i.e., so much margin on the left??


\end{document}

在此处输入图片描述

相关内容