This article is from the FAQ, by with numerous contributions by others.
The best way to format BETA programs in the LaTeX formatting system is by
using the lgrind LaTeX package.
You can use the following lgrind style:
beta|the BETA programming language:\
:pb=(^\d?\p\d?\:\d?\p?\d?\(#\d?:\
:id=_:\
:bb=\d(\(#|\(if|\(for)\d:\
:be=\d(#\)|if\)|for\))\d|;:\
:oc:\
:cb=\(*:\
:ce=*\):\
:sb=':\
:se=':\
:tb=%%:\
:te=%%:\
:mb=%\$:\
:me=\$%:\
:vb=%\|:\
:ve=\|%:\
:kw=if then else for repeat\
do inner none this enter exit leave restart suspend\
and or xor mod div\
stop:
 
Continue to: