2

I have a few issues with the alignment of the baselines when using the tensor package. Here is a MWE:

\documentclass[12pt, a4paper]{book}

\usepackage{tensor}

\begin{document}

\begin{equation}
\lbrace \tensor*{S}{^A_\alpha} , \tensor{\bar{S}}{_{\dot{\beta}B}} \rbrace = 2 ( \tensor{\sigma}{^\mu} ) \tensor{}{_{\alpha\dot{\beta}}} \tensor{K}{_\mu} \tensor{\delta}{^A_B}
\end{equation}

\end{document}

There are quite a few problems with the output:

enter image description here

Basically it is all about the baseline alignment: for some reason, the alpha of the left-hand side is on the same line as the mu and B of the right-hand side, while the dotted beta and B of the LHS are on the same baseline as the alpha dotted beta of the RHS. Why is that, and how can I solve it?

If possible, I would prefer a solution that does not involve changing all the code by hand, as I have already typed many pages of such equations before noticing the problem...

3

The dot is the problem; it lowers the baseline. I think the easiest way to fix this is to use \smash{...} to enclose the dotted beta and B on the LHS and the alpha and dotted beta on the RHS. As described in What does \smash do, and where is it documented?, the \smash{...} command reduces the argument's height and depth to zero, which has the effect of raising the baseline to match that of the other subscripts.

Yes, this this would involve editing each occurrence, but your editor (I use TeXShop and BBEdit on macOS) may have a search/replace feature to automate this for you. I'm sorry that I don't know any other way to do it.

\documentclass[12pt, a4paper]{article}

\usepackage{tensor}

\begin{document}

\begin{equation}
\lbrace \tensor*{S}{^A_\alpha} , \tensor{\bar{S}}{_{\smash{\dot{\beta}B}}} \rbrace = 2 ( \tensor{\sigma}{^\mu} ) \tensor{}{_{\smash{\alpha\dot{\beta}}}} \tensor{K}{_\mu} \tensor{\delta}{^A_B}
\end{equation}

\end{document}

Output using \smash

In response to the OP's comments, I searched this site for related issues and here are questions I found:

Differences in vertical positioning of superscripts and subscripts depending on grouping (`{ }`): Why? Caveats? Workarounds? (contains interesting details)

{(x+y)}^2 or (x+y)^2?

How to shift characters and numbers in math mode to make them vertically centered around the formula axis (contains code for visualizing baselines)

Why do all symbols in $x \in X$ have their own baseline? (also contains visualization code)

What is the reason behind the extra vertical space between the superscript and the subscript in a grouping mode? (also includes baseline visualization, but no code for it)

Vertical position of subscripts with commands

It may be worth emailing the tensor package maintainer to ask if there's a way to address this issue.

UPDATE: The tensor maintainer has responded and says he will attempt to address the issue.

UPDATE: The tensor maintainer has released version 2.2 which should address the issue. It should be on CTAN very soon!

| improve this answer | |
  • Perfect solution, thanks a lot. I actually did not even realize that the dot was causing the issue. The replace all idea was also great. – Jxx Aug 16 at 13:56
  • Actually, I still have a problem: expressions like \tensor*{S}{^A_\alpha} \tensor{\bar{S}}{_{A \smash{\dot{\alpha}}}} still are not aligned, probably because of the A? In that case \smash{A} does not help. – Jxx Aug 16 at 14:12
  • Here is another example without dots: \tensor*{x}{_1^\mu} \tensor*{x}{_2^\nu}. I am a little frustrated by this one, since aligning mu's and nu's (or 1's and 2's) seem like it should be the point of the tensor package. What am I doing wrong? – Jxx Aug 16 at 15:25
  • 1
    Interesting issue! I've spent over an hour researching it. To avoid excessive comments, I'm editing my answer to include what I've found (which isn't a definitive solution I'm afraid.) – LaTeXereXeTaL Aug 16 at 16:40
  • 1
    @Jxx See update. – LaTeXereXeTaL Aug 21 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.