I need to output Prolog
style inside algorithm2e
and It seems that I cannot use \verb
inside algorithm2e
.
How can I use \verb
or verbatim
for only one line inside algorithm2e
in Latex?
algorithm2ealgorithmsverbatim
I need to output Prolog
style inside algorithm2e
and It seems that I cannot use \verb
inside algorithm2e
.
How can I use \verb
or verbatim
for only one line inside algorithm2e
in Latex?
Best Answer
Since
algorithm2e
uses a macro-style interface for its programming structures, usingverbatim
directly is a problem. If its use is really necessary, boxing the content before using it allows you to pass it as an argument to the programming structure commands:The
verbatim
content is stored in\mycode
first using thelrbox
environment. Subsequent usage of this box is via\usebox{\mycode}
.If it's not really necessary, using
\texttt{..}
, say, would (should) suffice. The decide here would be based on whether you have funny characters included in the part you designate as requiringverbatim
.