Centering the “main” part of an equation

centerequationsmath-mode

As per the title, I want to center the "main" part of a display math equation and have the rest be positioned offset to it.

What I mean is, considering the following document:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
Here is my favorite equation:
\[ a = b + c \;\text{where}\; a = 5, b = 3, c = 2 \]
\end{document}

The equation is centered considering all of its content, which is expected behavior.

What I would want is something akiing to WithArrows's DispWithArrows: Just the "a = b + c" at the center of the page, with the "where" bit to the right of it.

Arrays, align, alignat et ceter aobviously do not work for what I'm saying. one idea I've thought of is having a phantom of the "annotation" on the other side in an array with rcl columns, but that's very dirty.

Thank you all in advance for any help.

Best Answer

Smash it! Looks terrible, but I think it's what you asked for (actually it might look better with a wider space after the equation; try \quad or \qquad in place of \;).

\documentclass{article}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
Here is my favorite equation:
\[ a = b + c \mathrlap{\;\text{where}\; a = 5, b = 3, c = 2} \]
\lipsum[1]
\end{document}

Horizontally smashing places objects inside boxes of zero width, so they don't affect centering etc. You can find details of \mathrlap in the mathtools package documentation.

enter image description here

Related Question