Is there any way to reduce the space between two algorithms?
Here is a screenshot:
\documentclass{article}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{algorithm}
\label{alg:my-alg}
\DontPrintSemicolon
\caption{My algorithm}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\Input{$a,b,...$}
\Output{$R$}
statment1\;
statment2\;
statment3\;
\tikzmark{start}\lIf{$a>b$}{\KwRet{$a$\tikzmark{stop}}}\;
\KwRet{$b$}
\begin{tikzpicture}[remember picture, overlay]
\draw[red,thick] ([yshift=0.5ex]pic cs:start) -- ([yshift=0.5ex]pic cs:stop);
\end{tikzpicture}%
\end{algorithm}
\begin{algorithm}
\label{alg:my-alg}
\DontPrintSemicolon
\caption{My algorithm}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\Input{$a,b,...$}
\Output{$R$}
statment1\;
statment2\;
statment3\;
\tikzmark{start}\lIf{$a>b$}{\KwRet{$a$\tikzmark{stop}}}\;
\KwRet{$b$}
\begin{tikzpicture}[remember picture, overlay]
\draw[red,thick] ([yshift=0.5ex]pic cs:start) -- ([yshift=0.5ex]pic cs:stop);
\end{tikzpicture}%
\end{algorithm}
\end{document}

