# How can I align this equation in latex?

How can Ii handle this equation to prevent it to out from the page I wrote it in latex as form

\begin{eqnarray*}
g^{\prime}(x)=\frac{(27+520x^2+560x^4)((14555+1012\sqrt{205})\log(-65+4\sqrt{205}-140 x^2)+7(205-4\sqrt{205})\log(65+4\sqrt{205}+ 140x^2))}{492(65+4\sqrt{205}+140x^2)(27+4(65+4\sqrt{205})x^2)}
\end{eqnarray*}

• Welcome to TeX SX! Could you please post a compilable code illustrating your problem? – Bernard Aug 23 at 19:55
• i wrote this equation as like that in latex \begin{eqnarray*} g(x)=--------------- \end{eqnarray*} – user193663 Aug 23 at 20:01
• i don't know write here equations as latex !! so i write it just text – user193663 Aug 23 at 20:03
• LyX makes it relatively easy to write the LaTeX equations: lyx.org – AndréC Aug 23 at 20:14
• @AndréC - Does lyx know about the \splitfrac macro? :-) – Mico Aug 23 at 21:47

## 2 Answers

I would use a \splitfrac macro (provided by the mathtools package) to split the very long numerator term into two parts.

Note that I replaced the outermost pair of round parentheses with \big square brackets. This change should make it easier for your readers to find their way around the numerator term.

Finally, do also note that there's no point in employing an eqnarray* environment here -- quite apart from the fact that eqnarray is deprecated and should not be used any longer.

\documentclass{article}
\usepackage{mathtools}  % for \splitfrac macro
\begin{document}
$g'(x)=\frac{% \splitfrac{(27+520x^2+560x^4)\bigl[(14555+1012\sqrt{205}\,)\log(-65+4\sqrt{205}-140 x^2)}{% +7(205-4\sqrt{205}\,)\log(65+4\sqrt{205}+ 140x^2)\bigr]}}{% 492(65+4\sqrt{205}+140x^2)(27+4(65+4\sqrt{205}\,)x^2)}$
\end{document}

• mico thanks for your helping – user193663 Aug 23 at 23:21

I propose 3 other possibilities, using each the medium-size commands from nccmath (ca 80 % of \displaystyle), with the geometry package, which produces by default more decent margins if you don't use marginal notes.

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools, nccmath}

\begin{document}
\
\begin{flalign*}
& g'(x)= & & & & \\ & \mfrac{%
(27+520x^2+560x^4)\bigl[(14555+1012\sqrt{205}\,)\log(-65+4\sqrt{205}-140 x^2)%
+7(205-4\sqrt{205}\,)\log(65+4\sqrt{205}+ 140x^2)\bigr]}{%
492(65+4\sqrt{205}+140x^2)(27+4(65+4\sqrt{205}\,)x^2)}
\end{flalign*}

\begin{multline*}
g'(x)=(27+520x^2+560x^4) \times \\ \mfrac{%
(14555+1012\sqrt{205}\,)\log(-65+4\sqrt{205}-140 x^2)%
+7(205-4\sqrt{205}\,)\log(65+4\sqrt{205}+ 140x^2)}{%
492(65+4\sqrt{205}+140x^2)(27+4(65+4\sqrt{205}\,)x^2)}
\end{multline*}

\begin{multline*}
g'(x)=\mfrac{(27+520x^2+560x^4)}{ 492(65+4\sqrt{205}+140x^2)(27+4(65+4\sqrt{205}\,)x^2)}\times \\
\medmath{\bigl[(14555+1012\sqrt{205}\,)\log(-65+4\sqrt{205}-140 x^2)%
+7(205-4\sqrt{205}\,)\log(65+4\sqrt{205}+ 140x^2)\bigr]}
\end{multline*}

\end{document}


• thanks for your clear and helping bernard – user193663 Aug 23 at 23:20