I am trying to get vertical lines to appear in this:
\begin{spacing}{0.8}
\begin{algorithm}
\caption{Cost-Vector Algorithm}\label{costalgorithm}
\begin{algorithmic}[1]
\Require \begin{varwidth}[t]{\linewidth}
Training sentences $S_{i}$\par
\end{varwidth}
\Ensure Sentence instances with cost-vectors for training $S_{i,c_i}$
\Function{generateCosts}{$EV_{i,v,r}$}
\State $S_{i,c_{i}} = \left[\right]$
\ForAll{$s \in S , v \in EV $}
\State $c_{i} = \left\{\right\}$
\State set $region \;r= EV_{i,r}$
\For {$p \leftarrow 1, properties$}
\State $c_{i,p}:=cost(kb_{r,p},v_{i,r}$
\If {$c_{p} > Cost_t$}
\State {$c_{p}:=\infty$}
\Else
\State continue
\EndIf
\EndFor
\If {$min(c) > APE_t$}
\State $c_{i,no\_property}:=0$
\Else
\State $c_{i,no\_property}:=\infty$
\EndIf
\State push($S_{i,c_{i}},(s,c_{i}))$
\EndFor\label{endfor}
\State \textbf{return} $S_{i,c_{i}}$
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{spacing}
And this is loaded before my document starts:
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}%http://ctan.org/pkg/algorithmicx
% \usepackage[linesnumbered,ruled]{algorithm2e}
\algrenewcommand\textproc{}% Used to be \textsc
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\usepackage{calc} % for \widthof
\algrenewcommand\algorithmicensure{%
\makebox[\widthof{\textbf{Require:}}][l]{\textbf{Ensure:}}}
Currently it looks like:
I am trying to emulate this link: https://cl.ly/0d3g3k1c3D1g.
Best Answer
You can use
\usepackage[ruled, vlined, linesnumbered]{algorithm2e}
.Please give a MWE next time.
I hope, this is what you want:
I changed some little things, like:
coloneqq
instead of:=
\min
instead ofmin
Output: