Math & ScienceAlgorithmic and beamer

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
panagiotispapadakos
Posts: 2
Joined: Tue Apr 20, 2010 2:30 pm

Algorithmic and beamer

Post by panagiotispapadakos »

Hello everybody.

I am trying to use algorithmic with beamer, and unfortunately I have come to the following
problem.

I create a new frame with the following code:

Code: Select all

\begin{algorithmic}[1]
    \Function{CheckSubScopeOf}{$b1$, $b2$}: Boolean
   \State  \Return False
    \EndFunction
\end{algorithmic}
and I get this error:

Code: Select all

(/usr/share/texmf-texlive/tex/latex/amsfonts/umsb.fd) [3] [4] [5] [6] [7]
! Undefined control sequence.
\beamer@doifinframe ...{algorithmic}[1] \Function
                                                  {CheckSubScopeOf}{$b1$, $b...
l.163 \end{frame}
Can anybody help?

Thanks in advance!

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Algorithmic and beamer

Post by gmedina »

Hi,
panagiotispapadakos wrote:...

Code: Select all

\begin{algorithmic}[1]
    \Function{CheckSubScopeOf}{$b1$, $b2$}: Boolean
   \State  \Return False
    \EndFunction
\end{algorithmic}
...
No wonder you are getting errors. \Function, \State, \Return, and \EndFunction are not commands defined by the package. The package defines \STATE, and \RETURN; for the other two, there's no provision made, so perhaps you would have to define them?

Addendum: I don't know the specific details of the code you are trying to write, but perhaps you are aiming at something like the following:

Code: Select all

\documentclass{beamer}
\usepackage{algorithmic}

\begin{document}

\begin{frame}
\begin{algorithmic}[1]
    \STATE Function\{CheckSubScopeOf\}\{\$b1\$, \$b2\$\}: Boolean
    \RETURN False
    \STATE EndFunction
\end{algorithmic}
\end{frame}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
panagiotispapadakos
Posts: 2
Joined: Tue Apr 20, 2010 2:30 pm

Algorithmic and beamer

Post by panagiotispapadakos »

Thanks for the reply.
Stupid me, I just needed

Code: Select all

\usepackage[noend]{algpseudocode}
Post Reply