4

I have the following code.

\begin{align*}
H([(1,0,0)], [(1,0,1)]) &= \min{}\{ &|(1 - 0) - (1 - 1)| + |(0 - 0) - (0 - 1)|, \\ 
&|(1 - 0) - (1 - 0)| + |(0 - 0) - (1 - 0)|, \\
&|(0 - 1) - (0 - 1)| + |(0 - 1) - (1 - 1)| \}
\end{align*}
\begin{equation*}
= \min{(2,1,1)} = 1
\end{equation*}

This produces an environment where my absolute values are nice and aligned exactly the way I want them, and one separate equation. Is there a way I can make the equals sign in the second equation line up with the equals sign in the align environment?

9

I guess you want to nest aligned:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
H([(1,0,0)], [(1,0,1)]) 
&= \min\{
     \begin{aligned}[t]
     &|(1 - 0) - (1 - 1)| + |(0 - 0) - (0 - 1)|, \\
     &|(1 - 0) - (1 - 0)| + |(0 - 0) - (1 - 0)|, \\
     &|(0 - 1) - (0 - 1)| + |(0 - 1) - (1 - 1)| \}
     \end{aligned}\\
&= \min\{2,1,1\} = 1
\end{align*}

\end{document}

enter image description here

  • Thank you! This is exactly what I wanted. – wz-billings Dec 11 '19 at 23:02
  • Shouldn't \lvert and \rvert be used instead of | |? – L. F. Dec 12 '19 at 11:17
  • @L.F. Yes, but in this case the simplified input is good. – egreg Dec 12 '19 at 11:56
  • I’m a bit confused. In which cases the simplified input produces the desired result? – L. F. Dec 12 '19 at 13:01

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.