BookML test: algorithm2e.sty — package for algorithms
release 5.2
July 18 2017
- BookML
-
v0.28.5
- LaTeXML
-
0.8.8
- LaTeX
-
2018/12/01
Data: this text
Result: how to write algorithm with LaTeX2e
initialization;
while not at end of this document do
read current section;
if understand then
go to next section;
current section becomes this one;
else
go back to the beginning of current section;
end if end while
1
input : A bitmap of size
output : A partition of the bitmap
2
special treatment of the first line;
3
for to do
4
special treatment of the first element of line ;
5
for to do
6
left FindCompress();
7
up FindCompress();
8
this FindCompress();
9
if left compatible with this then // O(left,this)==1
10
if left this then Union(left,this);
11
else Union(this,left);
12
13
end if
14
if up compatible with this then // O(up,this)==1
15
if up this then Union(up,this);
16
// this is put under up to keep tree as flat as possible
17
else Union(this,up);
18
// this linked to up
19
end if
20
21
end for
22
foreach element of the line do FindCompress(p);
23
24
end for
Data: such that is an order.
Result: with such that is an
interval order.
begin
for do
for do
if and then
1
while do
REM
remove from the list of of maximal index
2
while do
for do
{ remove from all the arcs : }
for do
remove the arc from
move in to the list preceding its present list
{i.e. If , move from to
}
1
Function FnRecursive(some args) /* algorithm as a recursive function */
Data: Some input data these inputs can be displayed on several lines and one
input can be wider than line’s width.
Result: Same for output data
2
/* this is a comment to tell you that we will now really start code */
3
if this is true then /* a simple if but with a comment on the same line */
4
we do that, else nothing
5
/* we will include other if so you can see this is possible */
6
if we agree that then
7
we do that
8
9
else
10
else we will do a more complicated if using else if
11
if this first condition is true then
12
we do that
13
14
else if this other condition is true then
15
this is done
16
/* else if */
17
18
else
19
in other case, we do this
20
/* else */
21
22
end if
23
24
end if
25
26
end if
27
/* now loops */
28
for to do
29
a for loop
30
31
end for
32
while do
33
a while loop including a repeat–until loop
34
repeat
35
do this things
36
37
until this end condition
38
end while
39
They are many other possibilities and customization possible that you have to
discover by reading the documentation.
40
end