File:Latex-algorithm2e-if-else.png

Summary

Description
Date
Source Own work
Author Lavaka

The example for the code is from the manual[dead link] (v.4.01). Following the example at Latex-algorithmic-if-else.png, this was produced by the following:

$ cat algorithm2e.tex          
\documentclass[12pt]{article}                                           
\usepackage[lined,boxed,commentsnumbered]{algorithm2e}
\usepackage[right=5cm]{geometry}                                        
\usepackage[active,pdftex,tightpage]{preview}                           
\PreviewEnvironment[]{algorithm}                                      
\begin{document}

\begin{algorithm}[H]
 \SetAlgoLined % new in release 4.01 (Dec 2009); doesn't work in release 3.9 (Oct 2005)
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
  \eIf{understand}{
  go to next section\;
  current section becomes this one\;
  }{
  go back to the beginning of current section\;
  }
 }
 \caption{How to write algorithms}
\end{algorithm}

\end{document}
$ # Download the package:
$ wget http://www.tex.ac.uk/tex-archive/macros/latex/contrib/algorithm2e/algorithm2e.sty%5Bdead+link%5D                                        
$ # Compile latex:
$ pdflatex algorithm2e.tex
...
$ pdftoppm -r 600 algorithm2e.pdf algorithm
$ convert algorithm-1.ppm latex-algorithmic2e-if-else.png
Category:Images with LaTeX source code Category:LaTeX

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Latex-algorithm2e-if-else.png
Category:Self-published work
Category:CC-BY-SA-3.0 Category:Images with LaTeX source code Category:LaTeX Category:Self-published work