我想在一小段之后立即开始我的算法,而不是从下一页开始。我尝试了很多方法,例如将浮动更改为“h!”或“H”,但都无济于事。有人能帮帮我吗?
梅威瑟:
\documentclass[10pt,a4paper, openright,titlepage,fleqn,%
headinclude,footinclude,BCOR5mm,%
numbers=noenddot,cleardoublepage=empty]{scrreprt}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
The following is some random algorithm.
\begin{algorithm}[H]
\caption{: (optimization procedure}
\label{alg:cmaes}
\begin{algorithmic}[1]
\Procedure{(1+1)-CMA-ES } {n, m, z, i}
\State Check the initial or existing iteration parameters.
\If{$i = 0$} \Comment{If it is the start of iteration, use initial parameters.}
\State $\boldsymbol{x} = \boldsymbol{x}_0$ \Comment{Parental var., shape = (n, 1)}
\State $\boldsymbol{\sigma} = \boldsymbol{\sigma}_0$ \Comment{e.g.: 0.5}
\State $\boldsymbol{A} = I$ \Comment{(n, n)}
\EndIf
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
为了给您提供一些图像,以下是结果(使用真实脚本,不同于 MWE):
由于某种原因,算法从新的(下一页)页面开始。我可以做些什么让算法紧跟在段落之后(从与段落相同的页面开始)吗?