# Need help -- Having trouble with eqnarray*/gathered/aligned

• LaTeX
Homework Helper
TL;DR Summary
I have a long chain of equalities that I trying to get to display correctly with looking ugly or going off the page. I got this to work on this forum (MathJax) but having various issues in Overleaf
Code:
\begin{gathered} Z(n) = \int_{C^n}  {\tfrac{{\prod\nolimits_{i = 1}^n {d{x_i}} }}{{1 - \prod\nolimits_{k = 1}^n {{x_k}} }} \\ &=& \int_{C^{n - 1}}  {\log \left( {\tfrac{1}{{1 - \prod\nolimits_{k = 1}^{n - 1} {{x_k}} }}} \right) \cdot \prod\limits_{i = 1}^{n - 1} {\tfrac{{d{x_i}}}{{{x_i}}}} }   \\ &=& \int_{C^{n - 1}}   {\log \left[ {\prod\limits_{q = 0}^\infty  {\left( {1 + \prod\limits_{k = 1}^{n - 1} {x_k^{{2^q}}} } \right)} } \right] \cdot \prod\limits_{i = 1}^{n - 1} {\tfrac{{d{x_i}}}{{{x_i}}}} }  \\  = \sum\limits_{q = 0}^\infty  \int_{C^{n - 1}}  {\log \left( {1 + \prod\limits_{k = 1}^{n - 1} {x_k^{{2^q}}} } \right) \cdot \prod\limits_{i = 1}^{n - 1} {\tfrac{{d{x_i}}}{{{x_i}}}} }   \\ = \mathop  \lim\limits_{N \to \infty } \,\sum\limits_{q = 0}^\infty  {\sum\limits_{k = 1}^\infty  {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{k}\int_{C_N^{n - 1}}  {\prod\limits_{k = 1}^{n - 1} {x_k^{k{2^q} - 1}d{x_k}} } } }   \\ &=& \mathop  \lim\limits_{N \to \infty } \,\sum\limits_{q = 0}^\infty  {\sum\limits_{k = 1}^\infty  {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{k}{{\left( {n - 2} \right)}^{\sum\limits_{p = 1}^n {\frac{{k{2^q}}}{{2N}}} }}{{\prod\limits_{i = 1}^{n - 1} {\left[ {\frac{1}{{2N}}\Gamma \left( {\frac{{k{2^q}}}{{2N}}} \right)} \right]} } \mathord{\left/ {\vphantom {{\prod\limits_{i = 1}^{n - 1} {\left[ {\frac{1}{{2N}}\Gamma \left( {\frac{{k{2^q}}}{{2N}}} \right)} \right]} } {\Gamma \left( {1 + \sum\limits_{j = 1}^{n - 1} {\frac{{k{2^q}}}{{2N}}} } \right)}}} \right. } {\Gamma \left( {1 + \sum\limits_{j = 1}^{n - 1} {\frac{{k{2^q}}}{{2N}}} } \right)}}} }  \\ &=& \sum\limits_{q = 0}^\infty  {\sum\limits_{k = 1}^\infty  {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{{{k^n}{2^{\left( {n - 1} \right)q}}}} \cdot \underbrace {\mathop  \lim\limits_{N \to \infty } \,{{\left( {n - 2} \right)}^{\frac{{\left( {n - 1} \right)k{2^q}}}{{2N}}}}}_{ = {{\left( {n - 2} \right)}^0}} \cdot \underbrace {\mathop  \lim\limits_{N \to \infty } \,\tfrac{{{\Gamma ^{n - 1}}\left( {1 + \frac{{k{2^q}}}{{2N}}} \right)}}{{\Gamma \left( {1 + \tfrac{{\left( {n - 1} \right)k{2^q}}}{{2N}}} \right)}}}_{ = 1{\text{ Limit 2.4}}}} } \\  = \sum\limits_{q = 0}^\infty  {\sum\limits_{k = 1}^\infty  {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{{{k^n}}} \cdot {{\left( {\tfrac{1}{{{2^{n - 1}}}}} \right)}^q}} }  = \sum\limits_{k = 1}^\infty  {\left[ {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{{{k^n}}}\sum\limits_{q = 0}^\infty  {{{\left( {\tfrac{1}{{{2^{n - 1}}}}} \right)}^q}} } \right]}  \\ = {\left( {1 - {2^{1 - n}}} \right)^{ - 1}}\sum\limits_{k = 1}^\infty  {\tfrac{{{{\left( { - 1} \right)}^{k - 1}}}}{{{k^n}}}} = \sum\limits_{k = 1}^\infty  {\tfrac{1}{{{k^n}}}}  = \zeta \left( n \right)  \\ \end{gathered}

Note there were \$'s at the beginning and end of the above code. I can't get it to compile with eqnarray in Overleaf so I posted the gathered. When I use aligned it ignores the newline commands and just runs off the page in just a single row.

This is what Overleaf does with that code

Ideally we will get this to work with eqnarray*, that is how I want it to display with aligned equal signs, on the forum it looks like this (except in latex I used only a single integral sign to denote the multiple integrals)

Note the Latex code above is slightly different. Thanks. BTW this is the first time using an actual LaTeX editor.[/code]