As I know, "align" has the fixed horizontal alignment right-left-right-left-..., and we cannot change this alignment. So if we want to align equations with custom horizontal alignment, e.g., right-center-center-left, we may use "equation" or "gather", "array", "arraycolsep" (for spacing "=" like "align"), and "displaystyle" (for proper handling of "frac" or "lim").

For example,

p_{\mathrm{MLE}}(x) & = & \displaystyle \max_{m} &P(X = x | \theta = m) \\
m_{\mathrm{MLE}}(x) & = & \displaystyle \argmax_{m} &P(X = x | \theta = m)

produces below.

enter image description here

However, this has the only one numbering label. It cannot split numbers for each row. It may be one BAD choice to use "align" and adjust spacing MANUALLY by using "\,", "\phantom{}", "\quad", or "\qquad".

For this case, how can we label different numbers for each row?

  • 1
    You probably already know about the option \notag that removes the numbering of one row in align environment. I think there must be something similar, but instead it forces a tag for each entry in multi-rows of math environments. What you ask is indeed interesting and I am waiting to find the answer – Al-Motasem Aldaoudeyeh Jun 30 '17 at 2:54
  • 2
    Off-topic: Don't use | to denote "given that" items. Instead, write \mid. – Mico Jun 30 '17 at 8:04
  • A newenvironment here could help... But I am waiting for an answer in a problem I found trying to manipulate the rows of my newenvironment... I will come back for an answer... But have to study a little bit about newenvironments – koleygr Jun 30 '17 at 8:08

Since you're using the amsmath package, I would use that package's \DeclareMathOperator* directive to create two new "operators": \argmax and \midmax, where the latter displays the word "max" centered in a box of width equal to "arg max". I would also use a split environment instead of an array environment, an equation environment instead of a gather environment, and \mid instead of \.

If you need to number each row separately, use an align environment instead of the nested equation/ split environments.

enter image description here

%% Create two new math opertors: \argmax and \midmax
\DeclareMathOperator*{\midmax}{\parbox{\mylen}{\centering\upshape max}} % center-set "max"

%% Single equation number for both rows:
p_{\mathrm{MLE}}(x) &= \midmax_{m} P(X = x \mid \theta = m) \\
m_{\mathrm{MLE}}(x) &= \argmax_{m} P(X = x \mid \theta = m)

% Separate equation numbers, one per row:
p_{\mathrm{MLE}}(x) &= \midmax_{m} P(X = x \mid \theta = m) \\
m_{\mathrm{MLE}}(x) &= \argmax_{m} P(X = x \mid \theta = m)
| improve this answer | |

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.