Write multiple lines in a cell of a table.
The easiest way is to use \shortstack. Few other options are suggested here.
April 24, 2013
April 19, 2013
How to write algorithm using Latex
I got a nice introductory video on writing algorithm using Latex.
This video uses the algorithmic package. You can find the basic set of commands of this package and few alternative packages here. The detail document is available here. The algorithmicx package (link) is an advanced package for writing algorithm.
A sample code snippet for the simple bubble sort algorithm using algorithmic package and its output is given below:
\begin{algorithm}
\begin{algorithmic}
\STATE $S$ is an array of integer
\FOR {$i$ in $1:length(S)-1)$}
\FOR {$j$ in $(i+1):length(S)$ }
\IF {$S[i]> S[j]$}
\STATE swap $S[i]$ and $S[j]$
\ENDIF
\ENDFOR
\ENDFOR
\end{algorithmic}
\caption{Bubble sort algorithm}
\label{algo:bubble_sort}
\end{algorithm}
This video uses the algorithmic package. You can find the basic set of commands of this package and few alternative packages here. The detail document is available here. The algorithmicx package (link) is an advanced package for writing algorithm.
A sample code snippet for the simple bubble sort algorithm using algorithmic package and its output is given below:
\begin{algorithm}
\begin{algorithmic}
\STATE $S$ is an array of integer
\FOR {$i$ in $1:length(S)-1)$}
\FOR {$j$ in $(i+1):length(S)$ }
\IF {$S[i]> S[j]$}
\STATE swap $S[i]$ and $S[j]$
\ENDIF
\ENDFOR
\ENDFOR
\end{algorithmic}
\caption{Bubble sort algorithm}
\label{algo:bubble_sort}
\end{algorithm}
Subscribe to:
Posts (Atom)