I am using the pseudocode
package for an algorithm. (Here is the documentation: Pseudo Code Package Documentation)
There is no spacing between normal text inside the pseudocode block. I have to manually insert \
after every word for spacing.
\documentclass{report}
\usepackage{pseudocode}
\begin{document}
This is a text area. Another text\\
\begin{pseudocode}{Celsius To Fahrenheit}{c}
f \GETS {9c/5} + 32\\
\RETURN{f}\\
\\
\BEGIN
basic\ algo\ for\ nothing\\
secondary\ algo
\END
\\\\
This\ is\ experimental\ text
\\\\
\end{pseudocode}
Outside Pseudocode
\begin{pseudocode}{Name}{Parameter 1, 2 ,3}
\IF True
\THEN
\BEGIN
something\ to\ do\\
or\ ther\ thing\ to\ do
\END
\ELSEIF otherwise
\THEN
\BEGIN
Do\ other\ things\\
Don't\ do\ something\ else
\END
\\
\FOR i \GETS 0 \TO 10
\DO something\ processing
\\
\WHILE not\ true \DO don't\ do\ it
\\\\
\REPEAT something
\UNTIL exception
\\\\
\PROCEDURE{Procedure name}{proc\ params}
something
\ENDPROCEDURE
\DO \BEGIN
1.something\\
2.anything\\
3.nothing\\
4.many\ things\\
5.everything
\END
\\
\REPEAT repeat something
\UNTIL some condition is met
\end{pseudocode}
\end{document}
But, according to the documentation it should automatically insert space between words in text. Please help, is there anyway to activate spacing? or any other having these problem? I really liked the output of this package.
Thanks!
Best Answer
The manual also says
By using
\mbox
or\text
(requiresamsmath
) for the text parts, it works. The manual is a bit wrong in the first examples actually, here is a code excerpt frompseudocode.tex
, used to create the manual:The first code will not create the output shown right after, as that uses
\mbox
, whereas the code example does not. Below is an example for your original code, where I've used both\text
and\mbox
. Stick to just one of them though. Consider also the\COMMENT
macro that LaRiFaRi mentioned in a comment.