Jump to content

File:Latex-algorithm2e-if-else.png

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikibooks, open books for an open world

Original file (2,747 × 1,658 pixels, file size: 105 KB, MIME type: image/png)

Summary

Description
Date
Source Own work
Author Lavaka

The example for the code is from the manual (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                                        
$ # Compile latex:
$ pdflatex algorithm2e.tex
...
$ pdftoppm -r 600 algorithm2e.pdf algorithm
$ convert algorithm-1.ppm latex-algorithmic2e-if-else.png

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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

5 July 2012

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current16:31, 5 July 2012Thumbnail for version as of 16:31, 5 July 20122,747 × 1,658 (105 KB)Lavaka

The following 2 pages use this file:

Global file usage

The following other wikis use this file: