11

How does one use the ' symbol ("apostrophe") in math mode without letting it change the depth of subscripts?

For example the following tex code:

\[
\int_{G^d} \varphi_{\ul,\ui} \varphi_{\ul',\ui'} \varphi_{\ul\prime,\ui\prime}  dx
\]

yields the following result

Result

We notice that using the apostrophe ' looks way better than the overall result from using \prime, but sadly using ' affects the depth below the baseline at which subscripts are placed.

How can one use ' properly in math mode?

Difference:

Difference

3
  • Welcome! I'm not sure what you mean by “the subscripts do not have the same size”.
    – egreg
    May 12, 2019 at 17:58
  • hey. Thanks for the answer. If you look really close you see in the screenshot that the secound $\underline{l}', \underline{i}'$ is a big bigger than the other ones. See the picture I added :)
    – mrmeaaan
    May 12, 2019 at 18:12
  • 8
    \prime is a full-size glyph, and is meant to be used only in an explicit superscript, by itself. Hence, instead of \phi_{l\prime}, use \phi_{l^{\prime}}. (The apostrophe is equivalent to ^{\prime} with finagling to allow multiple apostrophes to be input consecutively without triggering a "double superscript" error.) May 12, 2019 at 22:49

2 Answers 2

13

If you want subscripts to be on the same level, just add \mathstrut to them. A strut is an invisible thin vertical rectangle used in vertical spacing.

\int_{G^d} \varphi_{\mathstrut l,i} \varphi_{\mathstrut l',i'} dx

enter image description here

P.S. In addition to \mathstrut, \strut also works, but @Mico suggests below, using \mathstrut instead of \strut is better in math mode.

0
6

They're not smaller, but lowered less than the primed subscripts. Use a phantom, when you have to align subscripts.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ul}{\underline{l}}
\newcommand{\ui}{\underline{i}}
\newcommand{\vp}{^{\vphantom{\prime}}}

\begin{document}

\[
\int_{G^d} \varphi_{\ul\vp,\ui\vp} \varphi_{\ul',\ui'}\,dx
\]

\end{document}

enter image description here

You must log in to answer this question.

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