[Tex/LaTex] Mathematica equations to LaTeX but equation is too long, how to split it

equationswolfram-mathematica

I am new user of LaTeX. I have a problem of splitting long equation which I generate by Mathematica. I tried to use \\, multiline, and split commands but it gives error. Is there way to export equation from Mathematica written in multiline because the equation is too long?

My equation is

\[\left(\text{xg} \text{Cos}\left[\alpha _2+\theta _1\right]+(g+\text{yg}) \text{Sin}\left[\alpha _2+\theta _1\right]\right) m_2 R_2+\left(\text{Cos}\left[\alpha
_c+\theta _1\right] \text{Cos}\left[\theta _1+\omega _c\right] d_c k_d+\left(\text{xg} \text{Cos}\left[\alpha _c+\theta _1\right]+(g+\text{yg}) \text{Sin}\left[\alpha
_c+\theta _1\right]\right) m_d-\text{Cos}\left[\alpha _c+\theta _1\right] \text{Sin}\left[\alpha _1\right] k_d R_1\right) R_c<\left(d \text{Cos}\left[\omega
-\alpha _2\right] m_2 R_2+\text{Cos}\left[\alpha _c-\omega _c\right] d_c m_d R_c\right) \left(\theta _1'\right){}^2+\left(\text{IG2}+d \text{Sin}\left[\omega
-\alpha _2\right] m_2 R_2-\text{Sin}\left[\alpha _c-\omega _c\right] d_c m_d R_c\right) \theta _1''\]

Best Answer

I've done the following with your equation:

  • I've gotten rid of all \left and \right statements in favor of the following bracketing system: Innermost: square brackets, size default (small); next: round parentheses, size \big; outermost (just one instance): curly braces, size \big. The explicit sizing instructions are needed because the material enclosed in the \left ... \right pairs isn't big; hence the "fences" (brackets, parentheses, and braces) will all have the same minimum size unless explicit sizing instructions are provided.

  • Using the multline* environment of the amsmath package, I've broken up the expression into four lines, placing the < symbol at the start of the third line.

  • Replaced all \text{Sin} and \text{Cos} instances with \sin and \cos, respectively.

enter image description here

\documentclass{article}
\usepackage[margin=1.5in]{geometry} %choose margins for your document
\usepackage{amsmath}
\begin{document}
\begin{multline*}
\bigl(\text{xg} \cos[\alpha_2+\theta_1]
+(g+\text{yg}) \sin[\alpha_2+\theta_1]\bigr) m_2 R_2
+\bigl\{\cos[\alpha_c+\theta_1] \cos[\theta_1+\omega_c] d_c k_d\\
+\bigl(\text{xg} \cos[\alpha_c+\theta_1]
+(g+\text{yg}) \sin[\alpha_c+\theta_1]\bigr) m_d
-\cos[\alpha_c+\theta_1] \sin[\alpha_1] k_d R_1\bigr\} R_c\\
<\bigl(d \cos[\omega -\alpha_2] m_2 R_2
+\cos[\alpha_c-\omega_c] d_c m_d R_c\bigr)(\theta_1')^2\\
+\bigl(\text{IG2}+d \sin[\omega -\alpha_2] m_2 R_2
-\sin[\alpha_c-\omega_c] d_c m_d R_c\bigr) \theta_1''
\end{multline*}
\end{document}

Addendum: As @egreg has remarked in a comment, it's more common to use round parentheses as the innermost fences, square brackets for the mid-rank fences, and curly braces for the outermost fences. Switching the order of parentheses and brackets in the preceding examples produces the following look:

enter image description here

\documentclass{article}
\usepackage[margin=1.5in]{geometry} %choose margins for your document
\usepackage{amsmath
\begin{document}
\begin{multline*}
\bigl[\text{xg} \cos(\alpha_2+\theta_1)
+(g+\text{yg}) \sin(\alpha_2+\theta_1)\bigl] m_2 R_2
+\bigl\{\cos(\alpha_c+\theta_1) \cos(\theta_1+\omega_c) d_c k_d\\
+\bigl[\text{xg} \cos(\alpha_c+\theta_1)
+(g+\text{yg}) \sin(\alpha_c+\theta_1)\bigl] m_d
-\cos(\alpha_c+\theta_1) \sin(\alpha_1) k_d R_1\bigr\} R_c\\
<\bigl[d \cos(\omega -\alpha_2) m_2 R_2
+\cos(\alpha_c-\omega_c) d_c m_d R_c\bigl](\theta_1')^2\\
+\bigl[\text{IG2}+d \sin(\omega -\alpha_2) m_2 R_2
-\sin(\alpha_c-\omega_c) d_c m_d R_c\bigl] \theta_1''
\end{multline*}
\end{document}