可能重复:
将图形放置在双栏文档中
这是我的 MWE:
\documentclass{article}
\usepackage{multicol}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{lipsum}
\begin{document}
\title{How to insert algorithm inside multicols environment}
\author{pythonee}
\date{}
\maketitle
\begin{abstract}
\lipsum[1-2]
\end{abstract}
\begin{multicols*}{2}
\begin{algorithm}
\caption{Euclid’s algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{multicols*}
\end{document}
当我编译它时,它输出警告消息:
Package multicol Warning: Floats and marginpars not allowed inside `multicols'
environment!.
并且缺少伪代码。
你能告诉我如何插入单列浮点算法环境吗?我不想要algorithm*
样式。