Latex superscript of the second row overlap

  • Context: LaTeX 
  • Thread starter Thread starter ehrenfest
  • Start date Start date
  • Tags Tags
    Latex Overlap Row
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
16 replies · 6K views
ehrenfest
Messages
2,001
Reaction score
1
When I compile the following latex code on my computer, the subscript of the first row and the superscript of the second row overlap. Is there any way to make the rows farther apart?

[tex]\begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 \\ <br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \end{array} \right)<br /> \end{array}[/tex]
 
Physics news on Phys.org
they shouldn't under the equation environment, but you could try \vspace{..cm} at the end of first line
 
That did not work. I uploaded the file as .txt
 

Attachments

I don't see any overlap in in firefox.

Testing...

[tex]\begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 \\<br /> \\<br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \end{array} \right)<br /> \end{array}[/tex]

How's that?
 
Gokul43201 said:
I don't see any overlap in in firefox.

That is true. I was compiling in TexNic center with Miktex. There should be a better solution than inserting a blank row! Why would the TeXnic center compile differently than Firefox? I need to make a pdf. Is there anyway I can do that with Firefox?
 
What mjsd was suggesting was to use \vspace, which offers a little more control.

[tex] \begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 <br /> \\<br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \end{array} \right)<br /> \end{array}[/tex]

vs.

using \vspace{0.15ex} [using units which scale with the font]
[tex] \begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 <br /> \vspace{0.15ex}<br /> \\<br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \end{array} \right)<br /> \end{array}[/tex]


vs.

using \smallskip [alt: \bigskip]
[tex] \begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 <br /> \smallskip<br /> \\<br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \end{array} \right)<br /> \end{array}[/tex]
 
That works. Thanks.
 
[tex]\begin{equation}<br /> \left( \begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \cos^2\phi_x^1 & \cos^2\phi^1_z - \cos^2\phi_x^1 & 2\cos\phi_x^1 cos\phi_y^1 & 2\cos\phi_x^1\cos\phi_z^1 & 2\cos \phi^1_y \cos\phi_z^1 \bigskip \\<br /> \cos^2\phi_y^2 - \cos^2\phi_x^2 & \cos^2\phi^2_z - \cos^2\phi_x^2 & 2\cos\phi_x^2 cos\phi_y^2 & 2\cos\phi_x^2\cos\phi_z^2 & 2\cos \phi^2_y \cos\phi_z^2 \bigskip \\<br /> <br /> \vdots & \vdots & \vdots & \vdots & \vdots \bigskip\\<br /> <br /> <br /> \cos^2\phi_y^n - \cos^2\phi_x^n & \cos^2\phi^n_z - \cos^2\phi_x^n & 2\cos\phi_x^\n cos\phi_y^n & 2\cos\phi_x^n\cos\phi_z^n & 2\cos \phi^2_n \cos\phi_z^n \end{array} \right)<br /> <br /> \end{equation}[/tex]

One more thing. Can someone help me figure out what is wrong in my equation environment? Why is the (1) below the equation and not beside it?
 
Your line is too long...

[tex]\begin{equation}<br /> \left( \begin{array}{ccccc}<br /> \cos^2\phi_y^1 - \bigskip \\<br /> \cos^2\phi_y^2 - \bigskip \\<br /> <br /> \vdots & \vdots & \vdots & \vdots & \vdots \bigskip\\ \cos^2\phi_y^n - \end{array} \right)<br /> <br /> \end{equation}[/tex]

You might be able to force a longer line using
\setlength{\textwidth}{6.0in}
 
It is not too long for my pdf, however. Is there a way I can left align the array, because it starting way too far to the right with miktex?
 
\hspace{-1in} worked! Thanks.

I am really starting to hate MikTex and the stupid texnic center!
 
CompuChip said:
You can also use split or eqnarray, instead of array inside equation.
I think array switches to textstyle be default, which is also ugly when you have fractions.

I would still need an array inside of the eqnarray since I have a matrix that is part of the equation, right?
 
Also, is there a way I could have an equation and then a text explanation to the right that is against the margin on that same line?
 
Sorry, one more thing. How would I get the nice pretty font for classical Hamiltonian H in a latex document.