I'm using the algorithmic package to create pseudo-code for my document. One of the algorithms has a few lines that are too long and they go too far to the edge of the page so I wanted to add a breakline in between a function and the second part of the function to indent so that it starts on the same indentation where the function started.
I found this solution here: Include a line break in algorithmic while maintaining indentation. And wanted to use the solution using varwidth and parbox. So I did this on my code:
\begin{algorithm}[tbp]
\caption{Bla bla}
\label{alg:traintestdeep}
\begin{algorithmic}[1]%
\Procedure{train\_test}{$train\_features, test\_features, unlabeled\_features$} \label{imgpix}
\Statex Returns test results of the deep classifier.
\State $\mathit{ResNet} \gets load()$ \Comment{ResNet50 weights}
\State $\mathit{Incep} \gets load()$ \Comment{InceptionV3 weights}
\State $\mathit{Xcep} \gets load()$ \Comment{Xception weights}
\State \begin{varwidth}[t]{\linewidth}
\State {$res\_features \gets ResNet(train\_features,$\par
\hskip\algorithmicindent $test\_features,unlabeled\_features)$}
\State {$inc\_features \gets Incep(train\_features,$\par
\hskip\algorithmicindent $test\_features,unlabeled\_features)$}
\State {$xcp\_features \gets Xcep(train\_features,$\par
\hskip\algorithmicindent $test\_features,unlabeled\_features)$}
\end{varwidth}
\State {$all\_features \gets concat(res\_features,inc\_features,xcp\_features)$}
\If{$save\_features = True$}
\State {$savef(all\_features)$}
\EndIf
\State {$model \gets create\_model()$} \label{alg:model}
\If {$training = True$}
\State {$fitted\_model \gets model.fit(all\_features[train], labels)$} \label{alg:fitmodel1}
\If {$pseudo = True$}
\State \begin{varwidth}[t]{\linewidth}
\State {$newly\_labeled \gets $\par
\hskip\algorithmicindent $pseudo\_labeling(fitted\_model,all\_features[unlabeled])$} \label{alg:fitmodel2}
\end{varwidth}
\State {$fitted\_model \gets fitted\_model.fit(newly\_labeled, labels)$} \label{alg:fitmodel3}
\EndIf
\State {$model \gets fitted\_model$}
\EndIf
\If {$testing = True$}
\State {$results \gets fitted\_model(all\_features[test])$}
\EndIf
\State\Return $results$
\EndProcedure
\end{algorithmic}
\end{algorithm}
But the result is messy like shown here:
on lines 6, 7, 8 and 18 that is where I need to escape and indent the line. Any idea how to fix it?

