如何在LaTex(texmaker)中编写伪算法?

如何在LaTex(texmaker)中编写伪算法?

我是 LaTeX 的新用户。我正在用 Texmaker 写文档。我想用 编写算法algorithm。问题是 给了我错误:

! LaTeX Error: File `algorithm.sty' not found.
! LaTeX Error: File `algorithmic.sty' not found.

一个简单的例子:

\documentclass[10pt]{article}
%\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\section{Algorithm in \LaTex}
\begin{algorithm}
\begin{algorithmic}
\STATE sort the input set $s_i$
\STATE search for $x_i$ in $s_i$
\end{algorithmic}
\end{algorithm}
\end{document}

我应该下载算法包吗?如果是,我该怎么做?
我在 Windows XP 上使用 Texmaker。我在 Google 上搜索过,但没有找到有关此问题的解决方案。

答案1

如果你在 Windows 上工作,你有一个包管理器比如MiKTeX。TeXmaker只是你的.tex文件的编辑器。TeXmaker会调用另一个软件来编译你的文件并获取.pdf文件。

你必须遵循这个说明如何获取 algorithm2e 包?使用 algorithm2e 或算法包更新你的包管理器。

相关内容