我有一个算法,我需要删除最后一条规则。
\usepackage[ruled]{algorithm} % Use the package to make algorithms
\usepackage[noend]{algpseudocode}
\documentclass[a4paper,10pt,twoside]{report}
\begin{document}
\begin{algorithm}[H]
\caption{\protect \Call{spawn} implementation}
\label{alg:spawn}
\centering
\begin{algorithmic}[1]
\Function{spawn}{task}
\State{\Call{push}(task)}
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document
这会在第二条线之后生成一条水平线。如何仅针对这个单一算法删除这一行?
您可以暂时重新定义
\fs@ruled
:
\documentclass[a4paper,10pt,twoside]{report}
\usepackage[ruled]{algorithm} % Use the package to make algorithms
\usepackage[noend]{algpseudocode}
\begin{document}
{
\makeatletter
\renewcommand\fs@ruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
\def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}%
\def\@fs@post{}%
\def\@fs@mid{\kern2pt\hrule\kern2pt}%
\let\@fs@iftopcapt\iftrue}
\makeatother
\begin{algorithm}[H]
\caption{\protect \Call{spawn} implementation}
\label{alg:spawn}
\centering
\begin{algorithmic}[1]
\Function{spawn}{task}
\State{\Call{push}(task)}
\EndFunction
\end{algorithmic}
\end{algorithm}
}
\begin{algorithm}[H]
\caption{\protect \Call{spawn} implementation}
\label{alg:spawn}
\centering
\begin{algorithmic}[1]
\Function{spawn}{task}
\State{\Call{push}(task)}
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document}