2
%!TEX program = xelatex
\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}
\begin{algorithm}[]
\caption{LDA}
\begin{algorithmic}[1]
    \FOR{$d$}
    \STATE{
      \FOR{$k\in\{1,...,K\}$} 
      \STATE{Generate$\beta_k=(\beta_{k_1},...,\beta_{k,V})^T \sim Dirichlet(\cdot\vert\eta)$} 
      \ENDFOR
    } 
    \ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}

blank line

1
  • 1
    Welcome to TeX.SX! Commented May 27, 2015 at 14:40

1 Answer 1

4

There is no need for \STATE when you're using \FOR. The latter construction sets a \STATE by default:

enter image description here

\documentclass{article}
\usepackage{algorithm,algorithmic,amsmath}

\begin{document}
\begin{algorithm}
  \begin{algorithmic}[1]
    \FOR{$d$}
      \FOR{$k \in \{1,\dots,K\}$}
        \STATE Generate $\beta_k = (\beta_{k_1},\dots,\beta_{k,V})^T \sim \text{Dirichlet}(\cdot\vert\eta)$
      \ENDFOR
    \ENDFOR
  \end{algorithmic}
\end{algorithm}
\end{document}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.