# Center equation ignoring condition/remark

I have this code:

\documentclass[a4paper]{scrreprt}
\usepackage{fontspec}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
\end{equation*}

\end{document}


What I get is this:

But I want something like this (the "for j"-part should be ignored when the equation is centered):

Probably it would look better, if the "for j"-part is aligned to the right margin, unfortunately I don't know how to do that, too.

-

Just load mathtools instead of amsmath (it loads the latter) and use its \mathrlap command. You may put the \qquad inside the \rlap or not. In my opinion, if you put it inside, the main part of the equation doesn't look centred to the reader,though it is.

You must also be aware the condition might overlap the right margin. In such a case, I would one of the multi-line amsmath environment and put the condition on a separate line.

\documentclass[a4paper]{scrreprt}
\usepackage{fontspec}
\usepackage{mathtools}
\usepackage[showframe, nomarginpar]{geometry}

\begin{document}

\begin{equation*}
\end{equation*}

\begin{equation*}
\end{equation*}

\begin{equation*}
\end{equation*}

\end{document}


-
I'd put the \qquad inside \mathrlap; one should be aware that the condition might stick outside the margin. – egreg Jul 14 '14 at 12:19
You're perfectly right. I'll change that at once, thanks. – Bernard Jul 14 '14 at 12:34

You could align the condition to the right margin and center the equation to the rest of the line using flalign.

\documentclass{scrreprt}
\usepackage{fontspec}

\usepackage{showframe}% to show the page layout

\begin{document}

\begin{flalign*}
&&x_j = 1,\quad y_j = 2,\quad z_j = 3 &&\text{for }j=1, 2, 3, \dots, n&
\end{flalign*}

\end{document}


Only if you are sure that the equation and the condition will not overlap each other, you can use \mathllap to ignore the condition while centering the equation to the whole line.

\documentclass{scrreprt}
\usepackage{fontspec}

\usepackage{showframe}% to show the page layout

\begin{document}

\begin{equation*}