title: What is the right way to insert an equation within a pseudo code
body: <p>I start writing my note in Latex and I am trying to write a pseudo code based on this equation:</p>
  
  <p><a href="https://i.stack.imgur.com/cxrGu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxrGu.jpg" alt="equation"></a></p>
  
  <p>Here is my code I have tried so far.</p>
  
  <pre class="lang-latex prettyprint-override"><code>\begin{addmargin}[10mm]{0mm}
       \textbf{Repeat until convergence:} \ \{ 
       \[
           \theta_j := \theta_j + \alpha \sum_{i=1}^m(y^{(i)}-h_\theta(x^{(i)})) \ x_j^{(i)} \quad (\text{for every} \ j).
       \]
       \}
    \end{addmargin}
  </code></pre>
  
  <p>I still think it is a bit messy. Do you have an easier way to write this?</p>