10

Let us look at the following code:

\documentclass{article}

\usepackage{amsmath}
\begin{document}

\[
\frac{\partial^2u}{\partial x^2} = \frac{\left(y-y_0\right)^2-(x-x_0)^2}{\left((x-x_0)^2+\left(y-y_0\right)^2\right)\displaystyle\mathstrut^2}.
\]


\end{document}

and its result:

enter image description here

The parentheses made by (...) and \left(...\right) are of the same height, but the position of 2 is different. Why? Moreover, \mathstrut should have the same height as parenthesis, but the position of 2 is yet another. Why?

6
  • 1
    Have you tried using \Bigl ?
    – Sebastiano
    Jan 2, 2022 at 7:54
  • 2
    @Sebastiano I can obtain different sizes of parentheses. The problem is: why the same size gives 3 different heights of indices? Jan 2, 2022 at 7:57
  • I think that the problem Is the fraction. My upvoted there Is ☺️
    – Sebastiano
    Jan 2, 2022 at 8:00
  • 1
    @Sebastiano: But the problem occurs also in the numerator.
    – Marian G.
    Jan 2, 2022 at 8:43
  • Use \left( and \right) throughout, to see the effect: \[ \frac{\partial^2u}{\partial x^2} = \frac{\left( y - y_0 \right)^2 - \left( x - x_0 \right)^2}{\left( \left(x - x_0 \right)^2 + \left( y - y_0 \right)^2 \right)^2}.\]. And remove the strut and display command, for the moment. It's introducing height.
    – Cicada
    Jan 2, 2022 at 10:30

2 Answers 2

8

\mathstrut has the same height as a normal size parenthesis and you're basically setting the last exponent to an empty subformula, because \vphantom{...} doesn't make a math atom.

You get the same output with

$\Bigg)\vphantom)^2$\par
$\Bigg)\vphantom{\Bigg)})^2$

namely

enter image description here

In order to set a superscript to a \right delimiter, you need to have nothing between the delimiter and the exponent.

This almost settles the denominator. What about the numerator? The construction \left<delimiter>...\right<delimiter> builds a subformula, so TeX takes into account the full height when deciding for the placement of the superscript.

More simply,

\[
\left(y_0\right)^2\ne (y_0)^2
\]
\[
\left(y_0\right)_2\ne (y_0)_2
\]

enter image description here

This also explains why the denominator has oversized parentheses.

So you have discovered a rather good example why \left and \right should be used with great care. Choose among the following two examples.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\frac{\partial^2u}{\partial x^2} =
\frac{(y-y_0)^2-(x-x_0)^2}
     {\bigl((x-x_0)^2+(y-y_0)^2\bigr)^2}.
\]

\[
\frac{\partial^2u}{\partial x^2} =
\frac{(y-y_0)^2-(x-x_0)^2}
     {((x-x_0)^2+(y-y_0)^2)^2}.
\]

\end{document}

enter image description here

I have little doubts about the second one being better and clearer.

3

\left\right has spacing effects even when it doesn't select a larger delimiter.

enter image description here

\documentclass{article}

\usepackage{amsmath}
\begin{document}

\[
\frac{\partial^2u}{\partial x^2} =
\frac{(y-y_0)^2-(x-x_0)^2}
{\bigl((x-x_0)^2+(y-y_0)^2\bigr)^2}.
\]


\end{document}

If you add \showoutput to your original and look at the ) in the numerator the first ) using \right is

.........\hbox(7.5+2.5)x3.8889
..........\OT1/cmr/m/n/10 )

The second one does not have the surrounding box

........\OT1/cmr/m/n/10 )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .