3

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}
\begin{equation}\small
\label{eq_04}
{
W_{i+1} = W_i - \alpha \frac{\partial}{\partial W_i}f(W_i)
}
\end{equation}

enter image description here

3

(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

\documentclass[twocolumn]{article}
\newenvironment{myalgo}{%
   \begin{equation}\begin{minipage}{0.9\columnwidth}\obeylines}{%
   \end{minipage}\end{equation}}

\begin{document}
\noindent
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)$
\}
\end{myalgo}
Here $W_i$ are network parameters of each \dots

A cross-reference to algorithm \ref{alg:1}.
\end{document}
| improve this answer | |
  • 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 – Aadnan Farooq A May 14 '19 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 '19 at 8:23
  • 3
    please do accept my apology, i have updated my question – Aadnan Farooq A May 14 '19 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.