How can I write this algorithm in left align latex of 2 column?

enter image description here

I have tried this but its not working

    \textit{repeat till convergence}
W_{i+1} = W_i - \alpha \frac{\partial}{\partial W_i}f(W_i)

enter image description here

1 Answer 1


(Remark: I updated this answer completely after the OP provided more information about formatting requirements.)

The following solution works by setting up a dedicated environment called myalgo. The "outer" equation environment assures that there's some vertical separation between the algo material and the text above and below it, and it also provides an equation number. The "inner" minipage environment, whose width is set to 0.9\columnwidth, assures that each line starts flush-left within the minipage. Instances of myalg may be cross-referenced via the usual \label-\ref mechanism.

enter image description here


Generally, for a simple supervised learning the \dots
\begin{myalgo} \label{alg:1}
\qquad\textit{repeat until convergence}
$\displaystyle W_{i+1} = W_i - \alpha \frac{\partial}{\partial W_i} f(W_i)$
Here $W_i$ are network parameters of each \dots

A cross-reference to algorithm \ref{alg:1}.
  • Thanks. its coming in the middle. However, i want it to be left align in two column article. Also, the equation number is number coming with this May 14, 2019 at 8:18
  • 3
    @AadnanFarooqA - Please edit your posting to state all of your formatting requirements up front. How was I supposed to know that you use a two-column layout?
    – Mico
    May 14, 2019 at 8:23
  • 3
    please do accept my apology, i have updated my question May 14, 2019 at 8:27

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.