简体   繁体   中英

TeX/LaTeX algorithmic package issue

I try to layout an algorithm in pseudocode with TeX and the package "algorithmic". It gets a mess: no spaces between words, and no linebreaks. Can anyone help me out.

How do I get spacing and linebreaks into algorithmic comments?

Thanks!

Here's my TeX code:

\documentclass{llncs}
\usepackage{algorithmic}

\begin{document}
\begin{algorithmic}

\REQUIRE{ $ Some long text here. Unfortunately this text is a mess. Spaces and line breaks are missing and the text gets weird block layout when setting line breaks manually. $}
\FORALL{$i = 1 \ldots \mid L_{items}\mid $  } 
\STATE { $  i miss spaces here, too $}
\ENDFOR

\end{algorithmic}
\end{document}

Well the first problem is that you have your text in dollar signs $ ... $ that means to typest it in math mode. So the spaceing would be way off. Try this

\REQUIRE{ Some long text here. Unfortunately this text is a mess. Spaces and line breaks are missing and the text gets weird block layout when setting line breaks manually. }
\FORALL{$i = 1 \ldots \mid L_{items}\mid $  } 
\STATE {   i miss spaces here, too But I can get math $x = x +1$ }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM