If you want to write an algorithm, you have to write three commands to initialize a writing environment.


\begin{algorithm} % no.1
\begin{algorithmic} % no.2
\Procedure{Sum}{100} % no.3
\State abcd

And write three lines to end it. So is there any way to wrap it up, using one command to simplify it?


You can define a myalgorithm environment (you can call it anything you want) that does this. If you add


you can use this in your document as

  \State abcd

The two arguments are those that are given to the \Procedure command. Note that this will not allow you to add a caption or label to the algorithm floating environment.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.