Jason discovered a few things about making very nice looking psuedo code
with Latex. If you have psuedo code in your thesis or anywhere else, this
seems like a really good way to deal with it.

He writes...
===========================================

I discovered that there are two environments that were already installed
for me.  Used together, they can generate pseudo-code that looks a lot
like the style used the in big "Introduction to Algorithms" book that
everyone seems to use.  There are other environments with different
looks that you can find with Google.

The basic commands are \STATE, \FOR, \FORALL, \IF, \ELSE, \ENDIF,
\ENDFOR, etc.  I think there's an \ELIF or \ELSIF.  Generally speaking,
every line should start with \STATE unless it starts with something
else.  This webpage might be helpful:

http://www.cs.washington.edu/homes/zasha/latex.html

Here's what my LaTeX file looks like:

% Near the top, in the report.tex file:
\usepackage{algorithm}
\usepackage{algorithmic}

% Then in the file where I want the actual algorithm:

\begin{algorithm}
\caption{Word Sense Disambiguation algorithm} \label{wsd}
\begin{algorithmic}[1]

\newcommand{\algorithmicprocedure}{\textbf{procedure}\ }
\newcommand{\algorithmicfunction}{\textbf{function}\ }
\newcommand{\algorithmicprocend}{\textbf{end procedure}\ }
\newcommand{\algorithmicfunctionend}{\textbf{end function}\ }
%\PROCEDURE disamb
\STATE \algorithmicprocedure disambiguate-all-words
\FORALL{$w$ in input}
     \STATE disambiguate-single-word ($w$)
\ENDFOR
\STATE \algorithmicprocend

\

\STATE \algorithmicfunction disambiguate-single-word ($w$) : $s$
\FORALL{$s_{ti}$ of target word $t$}
     \STATE  $score_i \leftarrow 0$
     \FORALL{$w_j$ in context window}
         \IF{$j = t$}
             \STATE next $s_{ti}$
         \ENDIF
         \FORALL{$s_{jk}$ of $w_j$}
             \STATE $temp\mbox{-}score_k$
                    $\leftarrow$ relatedness $(s_{ti}, s_{jk})$
         \ENDFOR
         \STATE $best\mbox{-}score \leftarrow \max\ temp\mbox{-}score$
         \IF{$best\mbox{-}score > threshold$}
            \STATE $score_i \leftarrow score_i + best\mbox{-}score$
         \ENDIF
     \ENDFOR
\ENDFOR
\STATE {\bf return} $sense_i$ s.t.
        $score_i > score_j$ for all $j$ in ${s_{t0}, ... s_{tN}}$
\STATE \algorithmicfunctionend
\end{algorithmic}
\end{algorithm}







-- 
http://www.d.umn.edu/~mich0212/


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Give the gift of life to a sick child. 
Support St. Jude Children's Research Hospital's 'Thanks & Giving.'
http://us.click.yahoo.com/h8TXDC/6WnJAA/HwKMAA/x3XolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/nlpatumd/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to