0

An age old issue of the extra leading \, white space in aligned was solved in the Nov.5th 2016 release.

I don't know if the following is related, but ....

why are the aligned blocks misaligned only for self-defined symbols when the ampersand are placed differently within?

Is this something basic that I'm missing?

In the image below, the align block tagged (1) has an extra negative white space \! compared with the block tagged (4) or just equations (2) and (3).

There's no such problem when the leading symbol is an ordinary letter and not DeclareMathOperator, and I have found the same problem with newcommand*. See equation (5) ~ (8) or directly use \mathbb{E} instead of \E.

The situation is the same When the outer environment is flalign or alignat. (codes not included in this post)

I'd like to know if I must manually insert a \, for self-defined symbols. Thank you.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{amsmath, amssymb} 
\DeclareMathOperator{\E}{  \mathbb{E}  }

\begin{document}

\begin{align}
&\begin{aligned}[t]
    \E &= L \\
    \E &= \E
\end{aligned} \\
&\E = L \\
&\E = \E \\
&\begin{aligned}[t]
    &\E = L \\
    &\E = \E
\end{aligned} \\    
&\begin{aligned}[t]
    L  &= L \\
    L &= \E
\end{aligned} \\
&L  = L \\
&L = \E \\
&\begin{aligned}[t]
    &L  = L \\
    &L = \E
\end{aligned}
\end{align}

\end{document}
  • You should remember that even numbered columns in align, alignat and aligned start with {}, so a thin space is inserted if a math operator is at the beginning of the material in such cells. It also happens with \sin, for instance. What you see is a thin space in lines 3–6, rather than negative spaces in the other lines. – egreg Feb 20 '17 at 16:58
  • having declared \E to be an operator the expected use would be like \sin with a following argument \sin\theta the mathop spacing makes sure there is a thin space in \sin x (or \E x) in none of your examples is \E used in that way. – David Carlisle Feb 20 '17 at 16:59
2

This is by design and has nothing to do with the recent changes in amsmath.

In general it is expected that cells in even numbered columns of align, alignat or aligned start with a relation symbol. Therefore, in order to get the spacing right, an implicit empty subformula {} is automatically inserted at the start of these cells.

This has a bad consequence when the cell starts with a math operator such as \sum, \sin, \log or whatever is defined by means of \DeclareMathOperator.

In fact, the sequence of atoms Ord Op (here the implicit {} and \E) causes TeX to insert a thin space (which is wanted in expressions such as $2\sin x$). In these cases, remember to add \! in order to remove the automatic thin space.

What you see is not a negative space in lines 1–2 and 7–12, but a thin (positive) space in lines 3–6.

  • oh this totally makes sense. Yeah the same happens when \sin is used in my example, even though there's not an Ord coefficient in front. I get it now. Really good to know. No wonder I've had inconsistent experiences in the past. Thanks. – Lee David Chung Lin Feb 20 '17 at 17:17

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.