Math & ScienceProblems with pseudocode

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
giocarmine
Posts: 2
Joined: Tue May 10, 2011 10:48 pm

Problems with pseudocode

Post by giocarmine »

hello,
i was trying to use the algorithm and algorithmic environments to write some pseudocode.
i'm usin texnic and miktex on windows seven.
this is the pseudocode i'm trying to write:

Code: Select all

\begin{algorithm}
		\label{REDUCE}
		\caption{REDUCE(Pr, (\underline{Rel}, t))}
		\begin{algorithmic}
		
			\STATE $(\underline{Rel}, t) \gets lookahead di P_r$ \\ 
			\STATE $P_j \gets LA(\underline{Rel})$ \\ 
			\IF{$c(P_j) = t$} \\
				\IF{ $P_r = A \rightarrow \alpha \cdot, (\underline{Rel}, t)$		 \\
					\state Riduci da $\alpha$ ad A senza spostare il cursore $P_i$ \\
				\ELSIF{ $P_r = R \rightarrow \cdot, (\underline{R}, t)$ \\
					\state $P_i \gets P_j$		\COMMENT{esegui lo spostamento effettivo} \\
				\ENDIF \\
			\ENDIF \\
	\end{algorithmic}
	\end{algorithm}
and i get this error:

Code: Select all

Latex Error: there is no new line at the end

\IF{$c(P_j) = t$} \\

Runaway Argument?
{ $P_r = A \rightarrow \alpha \cdot, (\underline{Rel}, t)} \\ \state \ETC
i really don't understand what this means..i hope someone can give me some help :)
Last edited by giocarmine on Thu May 12, 2011 5:55 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

giocarmine
Posts: 2
Joined: Tue May 10, 2011 10:48 pm

Re: Problems with pseudocode

Post by giocarmine »

lol there are some missing closed braces, problem solved :P
Post Reply