TeX/LaTeX算法包问题

发布于 2024-09-06 01:21:56 字数 548 浏览 6 评论 0原文

我尝试使用 TeX 和“algorithmic”包以伪代码布局算法。它变得一团糟:单词之间没有空格,也没有换行符。谁能帮我一下。

如何在算法注释中添加间距和换行符?

谢谢!

这是我的 TeX 代码:

\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}

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}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月无声 2024-09-13 01:21:56

那么第一个问题是您的文本以美元符号 $ ... $ 表示,这意味着要在数学模式下输入它。所以间距会很远。试试这个

\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$ }

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$ }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文