Results 1 to 5 of 5

Math Help - display an algorithm in latex

  1. #1
    Junior Member
    Joined
    Sep 2008
    From
    Wilmington NC
    Posts
    30

    display an algorithm in latex

    i want to type an algorithm in latex
    i have a mac and i am using texshop

    i want to display the algorithm as seen in the attachment

    do i need to download and install soltware?

    please help me type it or explain to me how to load the picture into my paper!

    i need a step by step guide here!
    thanks in advance
    Attached Thumbnails Attached Thumbnails display an algorithm in latex-alg.png  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    You could specify the algorithm exactly as written between
    \begin{verbatim}

    my algorithm here

    \end{verbatim}


    however it does not seem to work here but works fine in TeXnic Center under Windows.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Sep 2008
    From
    Wilmington NC
    Posts
    30
    when you use verbatim does it retain the spaces and allow you to type special symbols and subscripts?

    because it types it "verbatim" for me.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Sep 2008
    From
    Wilmington NC
    Posts
    30

    help- typo? i'm losing my mind!

    I can not get this to display properly, i kee running into a problem on the bolded line....
    can anyone tell me when my "error" is?

    \documentclass[11 pt]{article}
    \author{Emily}
    \title{An Algorithm for Computing Gr\"obner Bases}
    \renewcommand{\baselinestretch}{1.5}
    \newtheorem{ex}{Example}[section]
    \newtheorem{thm}{Theorem}[section]
    \newtheorem{deff}{Definition}[section]
    \usepackage{algorithm}
    \usepackage{algorithmic}

    \begin{document}
    \maketitle
    \section{Algorithm}


    \begin{algorithm}
    \caption{Buchberger's Algorithm}
    \begin{algorithmic}
    \REQUIRE A polynomial set $F = \{f_1, \dots ,f_n\}$, that generates an ideal $I $
    \ENSURE A Gr\"obner basis $G = \{g_1, \dots , g_t\}$, that generates the same ideal $I$ with $F \subset G$
    \STATE $G := F$
    \STATE $M := \{f_i, f_j\} | f_i, f_j \in G$ and $f_i \neq f_j\}
    \REPEAT
    \STATE $\{p, q\} :=$ a pair in $M$
    \STATE $M := M \{\{p, q\}\}$
    \STATE $S := Spoly(p, q)$
    \STATE $h := NormalForm(S, G)$
    \IF{$h \neq 0$}
    \STATE $M := M \cup \{\{ g , h \}\} \forall g\in G \}$
    \ENDIF
    \UNTIL{M=0}
    \end{algorithmic}
    \end{algorithm}


    \end{document}
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Super Member flyingsquirrel's Avatar
    Joined
    Apr 2008
    Posts
    802
    Quote Originally Posted by mlemilys View Post
    I can not get this to display properly, i kee running into a problem on the bolded line....
    can anyone tell me when my "error" is?
    When LaTeX stops compiling at line n it does not mean that there is an error on line n, it means that there is an error before line n.
    You just forgot the closing $ at the end of line #24, two lines before the bolded one.
    Code:
    \STATE $G := F$
    \STATE $M := \{f_i, f_j\} | f_i, f_j \in G$ and $f_i \neq f_j\}$
    \REPEAT
    \STATE $\{p, q\} :=$ a pair in $M$
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Matlab 3D Interpolation/Display
    Posted in the Math Software Forum
    Replies: 4
    Last Post: July 6th 2010, 07:25 AM
  2. MathCad 14 does not display 3D plot!
    Posted in the Math Software Forum
    Replies: 0
    Last Post: March 31st 2010, 05:48 AM
  3. Display a number...
    Posted in the Math Topics Forum
    Replies: 2
    Last Post: February 22nd 2008, 08:54 AM

Search Tags


/mathhelpforum @mathhelpforum