I am new to Latex and extremely new to the algorithm stuff in Latex.
Please look at this simple code I downloaded from the internet.
Code: Select all
Code, edit and compile here:
\usepackage{algorithm}\usepackage{algorithmic}\begin{document}\begin{algorithm}\begin{algorithmic}\STATE{$S \leftarrow 0$}\STATE{$i:=0$}\FOR{$i=0$ to $10$} \STATE a[i]:=0\ENDFOR\IF{$x>y$} \RETURN{true}\ELSE \RETURN{false}\ENDIF\end{algorithmic}\end{algorithm}\end{document}
S<-0
i:=0
for i=0 to 10
a:=0
if x>y
return true
else
return false
But the output is simply:
S<-0i:=0i=010x>y
Would really appreciate if someone could answer these questions:
a) Why is everything in the same line? And why no space?
b) Why is it not displaying the keywords like for, if?
Thank you