我正在使用一个名为的文档类informs
,可以访问这里在INFORMS Journal on Computing Style Files
。
我想将两个伪代码并排放置。这个问题似乎之前在不同的帖子中被问过,我尝试了所有推荐的解决方案,但无法解决我的问题。
以下是 MWE:
\documentclass[ijoc,nonblindrev]{informs3} % %current default for
\OneAndAHalfSpacedXII
\usepackage[linesnumbered,ruled,lined, noend]{algorithm2e}
\begin{document}
\begin{minipage}{0.46\textwidth}
\begin{algorithm}[htbp]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Suppose we are given with several parameters}
\For{$i \in I$} { }
\caption{{\sc Animal microRNAs (miRNAs) regulate gene expression by
inhibiting.}}
\end{algorithm}
\end{minipage}
\hfill
\begin{minipage}{0.46\textwidth}
\begin{algorithm}[htbp]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Another set of inputs}
\For{$i \in I$} {}
\caption{{\sc Here we show that a single miRNA can repress the production of
hundreds. }}
\end{algorithm}
\end{minipage}
\end{document}
我收到未定义控制序列错误。如果我逐个放置算法minipage
,则不会出现任何问题。
答案1
这应该与 informs3 一起使用,但我懒得安装它。
\documentclass{article}
\usepackage[linesnumbered,ruled,lined, noend]{algorithm2e}
\usepackage{paracol}
\globalcounter{algocf}
\begin{document}
\begin{paracol}{2}
\begin{algorithm}[htbp]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Suppose we are given with several parameters}
\For{$i \in I$} { }
\caption{{\sc Animal microRNAs (miRNAs) regulate gene expression by
inhibiting.}}
\end{algorithm}
\switchcolumn
\begin{algorithm}[htbp]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Another set of inputs}
\For{$i \in I$} {}
\caption{{\sc Here we show that a single miRNA can repress the production of
hundreds. }}
\end{algorithm}
\end{paracol}
\end{document}
答案2
algorithm
默认情况下,来自的环境是algorithm2e
浮动环境,因此不能将其放置在环境内部minipage
。使用[H]
放置说明符可以防止这种情况发生;使用此选项,algorithm
将不再是浮动环境,并且algorithm
可以将其放置在 中minipage
。
\documentclass[ijoc,nonblindrev]{informs3} % %current default for
\OneAndAHalfSpacedXII
\usepackage[linesnumbered,ruled,lined, noend]{algorithm2e}
\begin{document}
\begin{minipage}{0.46\textwidth}
\begin{algorithm}[H]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Suppose we are given with several parameters}
\For{$i \in I$} { }
\caption{\scshape Animal microRNAs (miRNAs) regulate gene expression by
inhibiting.}
\end{algorithm}
\end{minipage}
\hfill
\begin{minipage}{0.46\textwidth}
\begin{algorithm}[H]
\SetAlFnt{\small}
\DontPrintSemicolon
\KwIn{Another set of inputs}
\For{$i \in I$} {}
\caption{\scshape Here we show that a single miRNA can repress the production of
hundreds.}
\end{algorithm}
\end{minipage}
\end{document}