Essentially, it's a matter of page geometry. \usepackage{fullpage}
works, for instance, but you can probably also fool around with the geometry
package to get a more customizable effect.
Also, see One inch margins and the geometry package.
As for the second point about removing the end
s, section 4 of algorithmicx
's documentation describes customizing blocks.
Edit: Here's an example.
If you add \algnotext{EndFor}
, For
blocks will print no end
. You can then apply this to EndIf
and anything else you need.
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath,fullpage}
\algnotext{EndFor}
\algnotext{EndIf}
\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\Function {NMS3D}{$T : array[1..w, 1..h, 1..d], n: int$}
\State \Comment $(2 n +1) \times (2 n +1) \times (2 n +1)$ szomsz\'eds\'gban keress\"uk a lok\'alis maximumokat
\State label \textbf{mainloop:}
\ForAll {$(i, j, k) \in \{ n, 2n+1, ... \}^3 \cap [1..w - n] \times [1..h - n] \times [1..d - n] $}
\State \textbf{initialize:} $(i_{max}, j_{max}, k_{max}) \gets (i, j, k)$
\ForAll {$(i_2, j_2, k_2) \in [i, i+n] \times [j, j+n] times [k, k+n]$}
\If {$T[i_2, j_2, k_2] > T[i_{max}, j_{max}, k_{max}]$}
\State $(i_{max}, j_{max}, k_{max}) \gets (i_2, j_2, k_2)$
\EndIf
\EndFor
\ForAll {$(i_2, j_2, k_2) \in [i_{max}-n, i_{max}+n] \times [j_{max}-n, j_{max}+n] \times [k_{max}-n, k_{max}+n]
- [i, i+n] \times [j, j+n] \times [k, k+n]$}
\If {$T[i_2, j_2, k_2] > T[i_{max}, j_{max}, k_{max}]$}
\State \textbf{continue} mainloop
\State \Comment a maximum jel\"olt t\'ul k\"ozel van egy m\'asik maximumhoz, elvetj\"uk
\EndIf
\EndFor
\State $list_{max} \stackrel{add}{\longleftarrow} (i_{max}, j_{max}, k_{max})$
\EndFor
\State \textbf{return} $list_{max}$
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document}
You could simply do this:
\documentclass{article}
\usepackage{algorithm} %ctan.org\pkg\algorithms
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}
\State $r\gets a\bmod b$
\While{$r\not=0$}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile
\State \textbf{return} $b$ \Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\caption{Euclid's algorithm}
\label{euclid}
\end{algorithm}
\end{document}
Some packages define these kinds of floating environments, like alg
, but that conflicted also.
Best Answer
Nice idea!
We can create a new float style by modifying
ruled
: