在 algorithm2e 中使用 TikZ 时如何删除多余的空白行?

在 algorithm2e 中使用 TikZ 时如何删除多余的空白行?

我想删除第 13 行的空白。但是不起作用。有人能帮我吗?谢谢!

在此处输入图片描述

\documentclass[11pt,titlepage,letterpaper]{article}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{fullpage}
\usepackage[linesnumbered]{algorithm2e}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\newcommand*{\AddNote}[4]{%
    \begin{tikzpicture}[overlay, remember picture]
       \draw [decoration={brace,amplitude=0.5em},decorate,ultra thick,black]
        ($(#3)!(#1.north)!($(#3)-(0,1)$)$) --
        ($(#3)!(#2.south)!($(#3)-(0,1)$)$)
        node [align=center, text width=2.5cm, pos=0.5, anchor=west] {#4};
\end{tikzpicture}
}%

\begin{document}
\begin{table}
\centering \caption{Algorithm} \vspace{.1in}
\begin{tabular}{p{15cm}}
\hline
\begin{algorithm}[H]
\KwIn{$R$.}
\KwOut{the optimal solution.}
\textbf{Setup:} Set the iteration number $r=0$.\tikzmark{right}\\
\For{$r=0$ to $R-1$} {
\tikzmark{top}
  \For{$j=1$ to $n$}
  {
    \For{$t=1$ to $h$}
{
Compute $P_{1}$\\
\If{$a<b$}
{
   break
}
\If{$a==b$}
{
Include solution
}
}
\tikzmark{bottom}}
} 
Return solution\\
\end{algorithm}
\\[-12pt] \hline
\AddNote{top}{bottom}{right}{Stage 1}
\end{tabular}
\end{table}

\end{document}

相关内容