# Latex superscript of the second row overlap

1. Aug 4, 2007

### ehrenfest

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?

$$\begin{array}{ccccc} \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 \\ \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) \end{array}$$

2. Aug 4, 2007

### mjsd

they shouldn't under the equation enviroment, but you could try \vspace{..cm} at the end of first line

3. Aug 4, 2007

### ehrenfest

That did not work. I uploaded the file as .txt

File size:
1.9 KB
Views:
59
4. Aug 4, 2007

### Gokul43201

Staff Emeritus
I don't see any overlap in in firefox.

Testing...

$$\begin{array}{ccccc} \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 \\ \\ \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) \end{array}$$

How's that?

5. Aug 5, 2007

### ehrenfest

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?

6. Aug 5, 2007

### robphy

What mjsd was suggesting was to use \vspace, which offers a little more control.

$$\begin{array}{ccccc} \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 \\ \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) \end{array}$$

vs.

using \vspace{0.15ex} [using units which scale with the font]
$$\begin{array}{ccccc} \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 \vspace{0.15ex} \\ \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) \end{array}$$

vs.

using \smallskip [alt: \bigskip]
$$\begin{array}{ccccc} \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 \smallskip \\ \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) \end{array}$$

7. Aug 5, 2007

### ehrenfest

That works. Thanks.

8. Aug 5, 2007

### ehrenfest

$$\left( \begin{array}{ccccc} \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 \\ \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 \\ \vdots & \vdots & \vdots & \vdots & \vdots \bigskip\\ \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)$$

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?

9. Aug 5, 2007

### robphy

$$\left( \begin{array}{ccccc} \cos^2\phi_y^1 - \bigskip \\ \cos^2\phi_y^2 - \bigskip \\ \vdots & \vdots & \vdots & \vdots & \vdots \bigskip\\ \cos^2\phi_y^n - \end{array} \right)$$

You might be able to force a longer line using
\setlength{\textwidth}{6.0in}

10. Aug 5, 2007

### ehrenfest

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?

11. Aug 5, 2007

### robphy

You might be able to use \hspace{-1in} or hspace*{-1in}.

Alternatively, you might try \lefteqn

I'm not sure if \smash{your equation} followed by an appropriate \hspace would work as well.

12. Aug 5, 2007

### ehrenfest

\hspace{-1in} worked! Thanks.

I am really starting to hate MikTex and the stupid texnic center!

13. Aug 6, 2007

### CompuChip

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.

14. Aug 6, 2007

### ehrenfest

I would still need an array inside of the eqnarray since I have a matrix that is part of the equation, right?

15. Aug 8, 2007

### ehrenfest

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?

16. Aug 8, 2007

### ehrenfest

Sorry, one more thing. How would I get the nice pretty font for classical Hamiltonian H in a latex document.

17. Aug 8, 2007

### robphy

you could try \marginpar{my comment}...
but it might not work from within a math environment.

maybe \cal{H}