[Tex/LaTex] Pseudo code for this algorithm algorithms I am new to LaTeX … I have searched many examples of algo pseudocode for this type of code.I don't know which package to use to write this algorithm. Please help me with the code. Best Answer Here is a simple example with algorithm2e.You can find more about it in the documentation in CTAN. \documentclass{article} \usepackage[linesnumbered]{algorithm2e} \begin{document} \begin{algorithm}[htb] \caption{An Algorithm} \label{alg:algo1} \KwIn{Some input} \KwOut{Some Output} $F_{i}\leftarrow0$\; Do something\; \For {$i=1$ \thinspace to 100}{ Do something one thing\; $F_{i}\leftarrow F_{i} + 1$\; } \end{algorithm} \end{document} Related Solutions[Tex/LaTex] How to format a pseudocode algorithm Here it is: Code: \documentclass{article} \usepackage{amsmath} \usepackage[linesnumbered,ruled]{algorithm2e} \begin{document} \begin{algorithm} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \underline{function Euclid} $(a,b)$\; \Input{Two nonnegative integers $a$ and $b$} \Output{$\gcd(a,b)$} \eIf{$b=0$} { return $a$\; } { return Euclid$(b,a\mod b)$\; } \caption{Euclid's algorithm for finding the greatest common divisor of two nonnegative integers} \end{algorithm} \end{document} [Tex/LaTex] How to insert algorithm pseudocode in Lyx I have found the answer: add the \usepackage{algorithm,algpseudocode} into the premble insert a algorithm block (Insert --> Floating --> Algorithm) insert the tex code in the algorithm block (Insert --> Tex Code) add the following latex code \begin{algorithmic}[1] \Require{$\rho \geq 1$} \Ensure{$X_k$} \While{not converged} \State{Solve $X_{k+1}=\min_{X} L(X,Y_k, \mu_k)$} \State{$Y_{k+1}=Y_k+\mu_k h(X_{k+1})$} \State{$\mu_{k+1}=\rho \mu_k$} \EndWhile \end{algorithmic} Related Question[Tex/LaTex] How to i write the pseudo code Algorithm in Latex
Best Answer
Here is a simple example with algorithm2e.You can find more about it in the documentation in CTAN.