# How to use Algorithm2e?

## How to use Algorithm2e?

Example of how to use Algorithm2e

- Always state your input.
- State the output if any.
- Always number your lines for quick referral.
- Always declare and initialize your local variables.
- Always use gets for assignments.
- Always end with “return” even when not returning any values.

**How do I download a package from LaTeX?**

Adding new packages to LaTeX

- Put the .sty package where LaTeX can access it. If the package has documentation and other things, put those, together with the .sty field, in a folder and save that folder where LaTeX packages get installed.
- Then update LaTeX packages. On terminal run:
- Done!

### What’s the difference between an algorithm and an algorithm?

Algorithmic is a related term of algorithm. is (mathematics|computing) of, relating to, or being an algorithm. a precise step-by-step plan for a computational procedure that possibly begins with an input value and yields an output value in a finite number of steps.

**Which is an example of an algorithm environment?**

See the example for algorithmicx, it uses the algpseudocode layout. This is another algorithm environment just like algorithmic or algorithmicx. The documentation says: Algorithm2e is an environment for writing algorithms in LaTeX2e. An algorithm is defined as floating object like figures.

#### How to switch from old algorithms to new algorithms?

If you are familiar with the algorithmic package, then you’ll find it easy to switch. You can use the old algorithms with the algcompatible layout, but please use the algpseudocode layout for new algorithms. To use algpseudocode, simply use \sepackage {algpseudocode}.

**Is there such a thing as an algorithmic wrapper?**

There are too many options, and it is confusing when to use what. For example, if I use algpseudocode, then I can’t add algorithmic because it is already included in the algorithm package. Is there any definitive guidelines for a streamlined approach? Any suggestion will be appreciated. algorithm – float wrapper for algorithms.