请问大家我想让全文公式左对齐,于是按照网上说的

\documentclass[12pt,a4,fleqn]{article}
\setlength{\mathindent}{0pt}

再输入公式

\begin{eqnarray} \label{lgt}
{\rm Logit}({\Pr}(Y=1|G_{f1},G_{f2},\boldsymbol{X_f}))=\beta_{f0} + \beta_{f1} G_{f1}+ \beta_{f2} G_{f2}+ \beta_{f3} G_{f1}G_{f2}+\boldsymbol{ b_f^T} \boldsymbol{X_f},
\end{eqnarray}

可是公式并没有和文本对齐,左边会有空白,请问这个要怎么调整呢?

image.png

2 回答2

0
<p></p><section><p style="font-size: inherit; color: inherit; line-height: inherit; padding: 0px; margin-top: 1.5em; margin-bottom: 1.5em;">我这里测试没问题啊,附上MWE</p><pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;"><code class="hljs ruby" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; padding: 0.5em; background: rgb(253, 246, 227); color: rgb(101, 123, 131); overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 1</span>\documentclass[<span class="hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(42, 161, 152); word-wrap: inherit !important; word-break: inherit !important;">12</span>pt,a4,fleqn]{article}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 2</span>\usepackage{amsmath}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 3</span>\setlength{\mathindent}{0pt}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 4</span>\usepackage{lipsum}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 5</span>\<span class="hljs-keyword" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(133, 153, 0); word-wrap: inherit !important; word-break: inherit !important;">begin</span>{document}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 6</span><br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 7</span>\lipsum[<span class="hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(42, 161, 152); word-wrap: inherit !important; word-break: inherit !important;">2</span>]<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 8</span><br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;"> 9</span>\<span class="hljs-keyword" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(133, 153, 0); word-wrap: inherit !important; word-break: inherit !important;">begin</span>{eqnarray}&nbsp;\label{lgt}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">10</span>{\rm&nbsp;Logit}({\Pr}(Y=<span class="hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(42, 161, 152); word-wrap: inherit !important; word-break: inherit !important;">1</span><span class="hljs-params" style="font-size: inherit; color: inherit; line-height: inherit; margin: 0px; padding: 0px; word-wrap: inherit !important; word-break: inherit !important;">|G_{f1},G_{f2},\boldsymbol{X_f}))=\beta_{f0}&nbsp;+&nbsp;\beta_{f1}&nbsp;G_{f1}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">11</span>\<span class="hljs-keyword" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(133, 153, 0); word-wrap: inherit !important; word-break: inherit !important;">end</span>{eqnarray}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">12</span><br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">13</span>\lipsum[2]<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">14</span>\<span class="hljs-keyword" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(133, 153, 0); word-wrap: inherit !important; word-break: inherit !important;">end</span>{document}<br/><span class="linenum hljs-number" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px 20px 0px 0px; color: rgb(42, 161, 152); overflow-wrap: inherit !important; word-break: inherit !important;">15</span></span><br/></code></pre></section><p><img src="/data/ueditor/php/upload/image/20190903/1567499276531538.png" title="1567499276531538.png" alt="image.png"/></p><p></p>
  • 可能是的,宏包的调用顺序会影响结果。 – 兰铃 2019-09-03 20:46 回复
  • 非常感谢,原来\usepackage{amsmath} 要在\setlength{\mathindent}{0pt}前面才可以 – fisher 2019-09-03 17:00 回复
  • 难道他会和别的包冲突?我运行你的也是可以的 – fisher 2019-09-03 16:42 回复
  • 真是奇怪了 – fisher 2019-09-03 16:41 回复
0
<pre class="brush:plain;toolbar:false">\documentclass[12pt,fleqn]{article} \usepackage[a4paper,margin=1in]{geometry} \usepackage{mathtools} \usepackage{lipsum} \setlength{\mathindent}{0pt} \begin{document}   \lipsum[1]   \begin{equation}\label{lgt}   \operatorname{Logit} \bigl( \Pr  ( Y=1 | G_{f1}, G_{f2}, \boldsymbol{X_f} ) \bigr) = \beta_{f0} + \beta_{f1} G_{f1} + \beta_{f2} G_{f2} + \beta_{f3} G_{f1} G_{f2} + \boldsymbol{b_f^T X_f},   \end{equation}   \lipsum[2] \end{document}</pre><p><img src="/data/ueditor/php/upload/image/20190903/1567520294338070.png" title="1567520294338070.png" alt="image.png"></p><p>原代码是不是用机器识别的?我真的不觉得这样好看</p>

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。