How to make the below equations with bars being precisely above selected indices and not crossing other unbarred indices?

enter image description here

        \frac{1}{\alpha'}\int_\Sigma d^2x[g_{\mu\nu}\partial\phi^\mu\bar{\partial}\phi^\nu + ig_{i\bar{j}}\eta^\bar{j}(D_z\rho^i_{\bar{z}} + D_\bar{z}\rho^i_z) + i\theta_i(D_\bar{z}\rho^i_z - D_z\rho^i_\bar{z}) + R_{i\bar{i}j\bar{j}}\rho^i_z\rho^j_\bar{z}\eta^\bar{i}\theta_kg^{k\bar{j}}]

Thanks in advance.

  • 2
    As said before: please don't post just code fragments. Always make a MWE Commented Oct 31, 2023 at 16:31
  • 3
    The code you post raises errors but doesn't produce the output you show. Anyway, you've discovered that omitting braces leads to errors: you've got a lot of things like \eta^\bar{j} which should be \eta^{\bar{j}}.
    – campa
    Commented Oct 31, 2023 at 16:32

1 Answer 1


Never disregard errors raised during the LaTeX run.

Subscripts and superscripts should always be braced. In some cases (a single letter or digit) the braces can be omitted, but


is definitely a syntax error, because TeX will take just \bar as the superscript.

You should also split such a long expression and make the brackets a little more prominent.



\frac{1}{\alpha'}\int_{\Sigma} d^{2}x\,\bigl[
  + ig_{i\bar{j}}\eta^{\bar{j}}(D_z\rho^{i}_{\bar{z}} + D_{\bar{z}}\rho^{i}_{z})
  + i\theta_{i}(D_{\bar{z}}\rho^{i}_{z} - D_z\rho^{i}_{\bar{z}})
  + R_{i\bar{i}j\bar{j}}\rho^{i}_{z}\rho^{j}_{\bar{z}}\eta^{\bar{i}}\theta_kg^{k\bar{j}}


enter image description here

You must log in to answer this question.

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